:root {
  --bg: #060505; --ink: #e9e1d2; --dim: #9a8f7e; --accent: #c8862a; --blood: #a3242a;
  --mind: #4a7bb0; --card: #12100e; --line: #3a3026;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font-family: "Noto Serif", Georgia, serif; }
.hidden { display: none !important; }
button { font: inherit; color: var(--ink); background: rgba(14, 11, 8, .82); border: 1px solid var(--accent);
  padding: 10px 16px; border-radius: 4px; cursor: pointer; font-size: 16px; }
button:hover:not(:disabled), button:focus-visible { background: var(--accent); color: #000; outline: none; }
button:disabled { opacity: .45; cursor: default; border-color: var(--line); }
button.hiddenev { border-color: #e8c76a; box-shadow: 0 0 14px rgba(232, 199, 106, .45);
  animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 4px rgba(232, 199, 106, .2); } }

/* home */
.screen { min-height: 100%; }
#home { max-width: 980px; margin: 0 auto; padding: 32px 16px 24px; }
.brand h1 { font-size: clamp(32px, 7vw, 56px); margin: 0; letter-spacing: .02em; }
.brand p { color: var(--dim); margin: 6px 0 28px; font-size: 18px; }
.films { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.film { background: var(--card); border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  display: flex; flex-direction: column; }
.film .poster { aspect-ratio: 16 / 9; background-size: cover; background-position: center; filter: brightness(.8); }
.film .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.film .genre { color: var(--accent); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.film h3 { margin: 0; font-size: 22px; }
.film .sub, .film .blurb, .film .mins { margin: 0; color: var(--dim); font-size: 15px; }
.film button { margin-top: auto; align-self: flex-start; }
.film.soon { opacity: .5; justify-content: center; align-items: center; min-height: 160px; }
.note { color: var(--dim); font-size: 13px; margin-top: 32px; border-top: 1px solid var(--line); padding-top: 12px; }

/* pick */
#pick { max-width: 980px; margin: 0 auto; padding: 32px 16px; }
#pick h2 { margin: 0 0 4px; }
.sub { color: var(--dim); margin: 0 0 20px; }
.chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.char { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 16px; text-align: left;
  display: flex; flex-direction: column; gap: 8px; }
.char:hover:not(:disabled), .char:focus-visible { background: #221b14; color: var(--ink); border-color: var(--accent); }
.char h3 { margin: 0; }
.char p { margin: 0; color: var(--dim); font-size: 15px; }
.statrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 15px; }
.pips { color: var(--accent); letter-spacing: 2px; }

/* game */
#game { position: fixed; inset: 0; overflow: hidden; }
#stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #000; }
#bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0;
  transition: opacity .6s; }
#bg.on { opacity: 1; animation: kb 30s linear forwards; }
@keyframes kb { from { transform: scale(1); } to { transform: scale(1.1); } }
video { position: relative; width: 100%; height: 100%; object-fit: contain; }
#stage.dimmed video, #stage.dimmed #bg { filter: brightness(.45); }
#mirror { position: absolute; top: 18%; left: 50%; transform: translateX(-50%) scaleX(-1);
  font-size: clamp(18px, 4vw, 40px); font-weight: 700; color: rgba(225, 232, 238, .82); text-align: center;
  max-width: 88vw; text-shadow: 0 0 10px rgba(180, 200, 220, .5), 0 0 2px #000; letter-spacing: .05em;
  filter: blur(.6px); }
body.shaken #stage { animation: shake 2.4s infinite; }
@keyframes shake {
  0%, 100% { filter: none; transform: none; }
  20% { filter: hue-rotate(-20deg) blur(.6px); transform: translate(2px, -1px) skewX(.6deg); }
  23% { filter: none; transform: none; }
  61% { filter: saturate(1.6) contrast(1.2); transform: translate(-3px, 1px); }
  64% { filter: none; transform: none; }
}
#hud { position: absolute; top: 0; left: 0; right: 0; padding: 10px 12px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  background: linear-gradient(rgba(0, 0, 0, .7), transparent); font-size: 14px; pointer-events: none; }
#bars { display: flex; gap: 12px; flex-wrap: wrap; }
.bar { min-width: 130px; }
.bar .lab { display: flex; justify-content: space-between; }
.bar .track { height: 7px; background: rgba(255, 255, 255, .15); border-radius: 4px; overflow: hidden; margin-top: 3px; }
.bar .fill { height: 100%; transition: width .5s; }
.bar.mau .fill { background: var(--blood); }
.bar.tinhtao .fill { background: var(--mind); }
.bar.hit { animation: hit .6s; }
@keyframes hit { 30% { transform: scale(1.12); color: #ff6b6b; } }
#stats { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip { border: 1px solid var(--line); border-radius: 12px; padding: 2px 8px; background: rgba(0, 0, 0, .5); }
.chip.item { border-color: #e8c76a; color: #e8c76a; }
#panel { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 16px max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, .88) 28%); display: flex; flex-direction: column;
  align-items: center; gap: 10px; }
#text { max-width: 760px; margin: 0; text-align: center; font-size: clamp(16px, 2.4vw, 21px); line-height: 1.5;
  text-shadow: 0 2px 6px #000; }
#text:empty { display: none; }
#text .deathtitle { display: block; font-size: 1.6em; color: #ff8a80; margin-bottom: 4px; }
#text .small { display: block; color: var(--dim); font-size: .8em; margin-top: 6px; }
#timer { font-size: 22px; color: #e8c76a; }
#buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 820px; }
#dice { position: absolute; inset: 0; background: rgba(0, 0, 0, .72); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; }
#die { width: 120px; height: 120px; display: flex; align-items: center; justify-content: center;
  font-size: 54px; font-weight: 700; color: #000; background: var(--ink);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
#die.spin { animation: spin .12s linear infinite; }
@keyframes spin { 50% { transform: rotate(14deg) scale(.94); } }
#die.win { background: #e8c76a; }
#die.lose { background: var(--blood); color: var(--ink); }
#diceLine { font-size: 18px; color: var(--dim); text-align: center; padding: 0 16px; }
#diceVerdict { font-size: 26px; font-weight: 700; text-align: center; padding: 0 16px; }
@media (max-width: 520px) {
  .bar { min-width: 100px; }
  #hud { font-size: 12px; }
  button { font-size: 15px; padding: 9px 12px; }
}
