/* Start page for the Vampire Slayer browser port. System fonts only: the server sends COEP require-corp,
   so cross-origin fonts would be blocked. Accent red is the VS6 HUD red (255, 32, 32). */
:root {
  --bg: #0a0607;
  --bg-2: #130c0d;
  --panel: #181012;
  --line: #3b1c1f;
  --blood: #ff2020;
  --blood-deep: #8d0f12;
  --bone: #eadfc8;
  --muted: #a39484;
  --slayer: #e0b85a;
  --slayer-deep: #6b5a2a;
  --ok: #6fcf7a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* author display rules (grid, flex) would otherwise beat the hidden attribute */
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--bone); font: 16px/1.5 var(--sans);
  background: radial-gradient(ellipse 80% 50% at 50% -10%, #3a0a0d 0%, transparent 70%), var(--bg);
}
a { color: #ff7b72; }
a:hover { color: #ffb0aa; }
code, kbd { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.muted { color: var(--muted); font-size: .9rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--blood); color: #000; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

:focus-visible { outline: 2px solid var(--blood); outline-offset: 2px; }

/* Masthead */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  max-width: 1200px; margin: 0 auto; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .85rem; }
.sigil { font-size: 2rem; color: var(--blood); text-shadow: 0 0 14px rgba(255, 32, 32, .55); line-height: 1; }
h1 { margin: 0; font: 700 1.6rem/1.1 var(--serif); letter-spacing: .12em; text-transform: uppercase; color: var(--bone); }
.tagline { margin: .15rem 0 0; color: var(--muted); font-size: .85rem; }
.upstream { font-size: .85rem; color: var(--muted); }
/* ES | EN switch (i18n.js). Hidden while playing: the lobby is the only place whose text it redoes. */
.lang-switch { display: inline-flex; align-items: center; gap: .15rem; font-size: .8rem; color: var(--muted); }
.lang-btn {
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 .5rem; font: 600 .8rem/1 var(--sans); letter-spacing: .08em;
  color: var(--muted); background: none; border: 1px solid transparent; border-radius: 4px; cursor: pointer;
}
.lang-btn:hover { color: var(--bone); border-color: var(--line); }
.lang-btn[aria-pressed="true"] { color: var(--bone); border-color: var(--blood-deep); background: #1a0e10; }
.lang-sep { opacity: .5; }
body.playing .lang-switch { display: none; }

main { max-width: 1200px; margin: 0 auto; padding: 1.25rem; display: grid; gap: 1.25rem; }

/* Panels */
.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--line);
  border-radius: 6px; padding: 1.25rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.panel.primary { border-color: var(--blood-deep); box-shadow: 0 0 0 1px rgba(255, 32, 32, .12), 0 10px 40px rgba(120, 0, 0, .35); }
#lobby { display: grid; gap: 1.25rem; max-width: 880px; width: 100%; margin: 0 auto; }
h2 { margin: 0 0 .35rem; font: 700 1.5rem/1.2 var(--serif); letter-spacing: .04em; }
.lead { margin: 0 0 1rem; color: var(--muted); }
summary { cursor: pointer; font: 600 1.1rem var(--serif); letter-spacing: .03em; }
summary:hover { color: #fff; }
details[open] > summary { margin-bottom: 1rem; }

/* Mode switch (Online / Local) */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.mode {
  display: block; padding: 1rem 1.1rem; text-decoration: none; color: var(--bone); background: #0f0809;
  border: 1px solid var(--line); border-radius: 6px; transition: border-color .12s, background .12s;
}
.mode strong { display: block; font: 700 1.35rem/1.2 var(--serif); letter-spacing: .06em; text-transform: uppercase; }
.mode small { display: block; margin-top: .2rem; color: var(--muted); }
.mode:hover { color: #fff; background: #1a0e10; border-color: #5a2a2e; }
.mode[aria-current="page"] { background: #2a0d10; border-color: var(--blood); box-shadow: inset 0 0 0 1px var(--blood), 0 0 18px rgba(255, 32, 32, .18); }
.tests, .advanced { margin-top: 1rem; }
.tests summary, .advanced summary { font: 600 .9rem var(--sans); color: var(--muted); }
.advanced { display: grid; gap: .3rem; max-width: 26rem; }
.advanced label { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: .5rem; }

/* Choice cards (radio) */
fieldset { border: 0; padding: 0; margin: 0 0 1.1rem; min-width: 0; }
legend { padding: 0; margin-bottom: .5rem; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; }
.choices > legend { grid-column: 1 / -1; float: left; width: 100%; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice-body {
  display: block; height: 100%; padding: .7rem .85rem; background: #0f0809; border: 1px solid var(--line);
  border-left: 3px solid var(--line); border-radius: 4px; transition: border-color .12s, background .12s;
}
.choice.slayer .choice-body { border-left-color: #6b5a2a; }
.choice.vampire .choice-body { border-left-color: var(--blood-deep); }
.choice-body strong { display: block; font-family: var(--serif); font-size: 1.05rem; }
.choice-body small { display: block; margin-top: .15rem; color: var(--muted); line-height: 1.35; }
.choice:hover .choice-body { background: #1a0e10; border-color: #5a2a2e; }
.choice input:checked + .choice-body { background: #2a0d10; border-color: var(--blood); box-shadow: inset 0 0 0 1px var(--blood), 0 0 18px rgba(255, 32, 32, .18); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--bone); outline-offset: 2px; }
.choice input:disabled + .choice-body { opacity: .35; }
.choice input:disabled, .choice:has(input:disabled) { cursor: not-allowed; }

/* Online lobby: side (step 1), character of that side (step 2), name and Entrar. */
.lobby-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .4rem 1rem; }
.server-status {
  display: inline-flex; align-items: center; gap: .5rem; margin: 0; padding: .3rem .75rem; font-size: .85rem;
  color: var(--muted); background: #0f0809; border: 1px solid var(--line); border-radius: 999px;
}
.status-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--muted); flex: none; }
.server-status[data-state="online"] { color: var(--bone); }
.server-status[data-state="online"] .status-dot { background: var(--ok); box-shadow: 0 0 8px rgba(111, 207, 122, .7); }
.server-status[data-state="unavailable"] .status-dot { background: #6a5a52; }
.server-info { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.server-location { margin: 0 .75rem 0 0; font-size: .75rem; color: var(--muted); letter-spacing: .02em; }
.next-map { margin: .45rem 0 0; font-size: .85rem; letter-spacing: .03em; color: var(--slayer); }
.step {
  display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem; margin-right: .45rem; border-radius: 50%;
  font: 700 .8rem var(--sans); letter-spacing: 0; color: #fff; background: var(--blood-deep); vertical-align: middle;
}
.side-choices { grid-template-columns: 1fr 1fr; gap: .8rem; }
.side .choice-body {
  position: relative; overflow: hidden; padding: 1.2rem 1.25rem 1.1rem; border-left-width: 1px; border-radius: 6px;
  min-height: 9.5rem; display: flex; flex-direction: column; justify-content: flex-end;
}
.side.slayer .choice-body { background: linear-gradient(160deg, #241c0c 0%, #0f0809 65%); border-color: var(--slayer-deep); }
.side.vampire .choice-body { background: linear-gradient(160deg, #2c070a 0%, #0f0809 65%); border-color: var(--blood-deep); }
.side .choice-body strong { font: 700 1.9rem/1.1 var(--serif); letter-spacing: .08em; text-transform: uppercase; }
.side.slayer .choice-body strong { color: var(--slayer); }
.side.vampire .choice-body strong { color: #ff5a4f; }
.side-mark { position: absolute; top: .4rem; right: .9rem; font-size: 3.6rem; line-height: 1; opacity: .16; pointer-events: none; }
.side.slayer .side-mark { color: var(--slayer); }
.side.vampire .side-mark { color: var(--blood); }
.choice-body .side-count { margin-top: .55rem; color: var(--bone); font-size: .82rem; letter-spacing: .04em; min-height: 1.1em; }
.side.slayer input:checked + .choice-body {
  background: linear-gradient(160deg, #3a2d10 0%, #160e08 70%); border-color: var(--slayer);
  box-shadow: inset 0 0 0 1px var(--slayer), 0 0 22px rgba(224, 184, 90, .22);
}
.side.vampire input:checked + .choice-body {
  background: linear-gradient(160deg, #4a0b10 0%, #170809 70%); border-color: var(--blood);
  box-shadow: inset 0 0 0 1px var(--blood), 0 0 22px rgba(255, 32, 32, .25);
}
.side:hover .choice-body { filter: brightness(1.15); }
.class-choices { grid-template-columns: repeat(3, 1fr); }
.choice.slayer input:checked + .choice-body { border-color: var(--slayer); box-shadow: inset 0 0 0 1px var(--slayer), 0 0 14px rgba(224, 184, 90, .16); background: #221808; }
.lobby-foot { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .5rem 1.25rem; padding-top: .3rem; border-top: 1px solid var(--line); }
.lobby-foot .field { margin: .8rem 0 0; flex: 1 1 14rem; }
.lobby-foot .actions { flex-direction: column; align-items: stretch; gap: .35rem; margin-top: .8rem; }
.lobby-foot .actions p { text-align: center; min-height: 1.3em; }
.enter-btn { font-size: 1.25rem; padding: .9rem 3rem; letter-spacing: .14em; }

/* Fields */
.field { display: grid; gap: .3rem; margin-bottom: 1.1rem; max-width: 22rem; }
.field label { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field small { color: var(--muted); }
input[type="text"], select {
  font: inherit; color: var(--bone); background: #0f0809; border: 1px solid #5a2a2e; border-radius: 4px; padding: .6rem .7rem; width: 100%;
}
input[type="text"]:focus-visible, select:focus-visible { border-color: var(--blood); outline-offset: 0; }
input[aria-invalid="true"] { border-color: var(--blood); box-shadow: 0 0 0 1px var(--blood); }
input[type="range"] { accent-color: var(--blood); vertical-align: middle; }
input[type="checkbox"] { accent-color: var(--blood); width: 1.1rem; height: 1.1rem; margin-top: .2rem; flex: none; }
.check { display: flex; gap: .7rem; cursor: pointer; }
.check small { display: block; color: var(--muted); margin-top: .15rem; }
.options { padding: .9rem 1.25rem; }
.resolution { display: grid; gap: .3rem; max-width: 26rem; margin-top: 1rem; }
.resolution small { color: var(--muted); }
.gpu-warning { margin: .3rem 0 0; padding: .5rem .7rem; border: 1px solid var(--blood); border-radius: 4px; color: #ffb3ab; font-size: .85rem; }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.actions p { margin: 0; }
.btn {
  font: 600 .95rem var(--sans); color: var(--bone); background: #241517; border: 1px solid #5a2a2e; border-radius: 4px;
  padding: .7rem 1.1rem; cursor: pointer; min-height: 44px; transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: #351c1f; border-color: var(--blood); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn[hidden] { display: none; }
.primary-btn {
  background: linear-gradient(180deg, #d91a1a, #8d0f12); border-color: #ff5a4f; color: #fff;
  font-size: 1.05rem; letter-spacing: .08em; text-transform: uppercase; padding: .8rem 1.8rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
.primary-btn:hover:not(:disabled) { background: linear-gradient(180deg, #ff2a2a, #a81216); }

/* Stage: the canvas keeps 16:9 and always fits the viewport height. */
#stage { display: grid; gap: .6rem; justify-items: center; }
.screen {
  position: relative; width: min(100%, calc((100vh - 190px) * 16 / 9)); min-width: min(100%, 320px);
  aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--blood-deep); border-radius: 4px;
  box-shadow: 0 0 40px rgba(120, 0, 0, .35); overflow: hidden;
}
@supports (height: 100dvh) { .screen { width: min(100%, calc((100dvh - 190px) * 16 / 9)); } }
canvas { display: block; width: 100%; height: 100%; background: #000; outline: none; }
canvas:focus-visible { outline: 2px solid var(--blood); outline-offset: -2px; }
canvas:fullscreen { border: 0; }
.screen:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; border: 0; border-radius: 0; }
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  padding: 1rem; text-align: center; background: radial-gradient(ellipse at center, rgba(40, 6, 8, .92), rgba(0, 0, 0, .96)); overflow: auto;
}
.overlay[hidden] { display: none; }
.overlay p { margin: 0; }
.overlay-title { font: 700 1.4rem var(--serif); letter-spacing: .06em; }
.overlay.error .overlay-title { color: var(--blood); }
/* Online game menu (Esc): lobby look, the running match stays visible behind it. */
.overlay.game-menu { z-index: 3; justify-content: flex-start; background: rgba(5, 2, 3, .62); }
.game-menu-panel { margin: auto; width: min(26rem, 100%); padding: 1.1rem 1.25rem; text-align: left; }
.game-menu-panel .overlay-title { margin: 0; text-align: center; letter-spacing: .12em; text-transform: uppercase; }
.game-menu-panel > .muted { text-align: center; margin: .2rem 0 .9rem; }
.game-menu-panel .menu-map { margin: .2rem 0 0; text-align: center; font-size: .85rem; }
.game-menu-panel #menu-next-map { color: var(--slayer); }
.game-menu-actions { display: grid; gap: .55rem; }
.game-menu-actions .btn { width: 100%; }
.game-menu-actions .menu-note { margin: -.3rem 0 .15rem; font-size: .8rem; color: var(--muted); text-align: center; }
.menu-vote { margin: .1rem 0 .2rem; }
.menu-vote h3 { margin: 0 0 .45rem; font: 600 .78rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); text-align: center; }
.menu-vote-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: .4rem; }
.menu-vote-options .btn { width: 100%; padding: .45rem .5rem; font-size: .9rem; }
.menu-vote-options .btn[aria-pressed="true"] { border-color: var(--slayer); color: var(--slayer); }
.game-menu-actions .menu-vote .menu-note { margin: .4rem 0 0; }
.menu-slider {
  display: flex; align-items: center; gap: .8rem; padding: .35rem .2rem; font-size: .8rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.menu-slider input, .menu-slider select { flex: 1; }
.menu-slider select { letter-spacing: normal; text-transform: none; }
.perf-toast {
  position: absolute; top: .6rem; left: 50%; transform: translateX(-50%); z-index: 2; max-width: min(90%, 34rem); margin: 0;
  padding: .45rem .8rem; border: 1px solid var(--blood-deep); border-radius: 4px; background: rgba(0, 0, 0, .78);
  color: #f2e6e6; font-size: .85rem; text-align: center; pointer-events: none;
}
.leave-btn { border-color: var(--blood-deep); color: #ff9a92; }
.game-menu-side fieldset { margin-bottom: .8rem; }
.menu-sides, .menu-classes { grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: .45rem; }
.menu-sides .choice.vampire strong { color: #ff5a4f; }
.menu-sides .choice.slayer strong { color: var(--slayer); }
.game-menu-side > .muted { margin: 0 0 .8rem; }
.game-menu-side-actions { flex-direction: column; align-items: stretch; gap: .5rem; }
progress { width: min(420px, 80%); height: .7rem; accent-color: var(--blood); }
.overlay .loading-tip { max-width: 34rem; margin-top: 1.1rem; color: var(--bone); font-size: .95rem; line-height: 1.6; }
.tip-label { margin-right: .4rem; font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--slayer); }
progress { appearance: none; border: 1px solid var(--blood-deep); border-radius: 4px; background: #1a0a0b; overflow: hidden; }
progress::-webkit-progress-bar { background: #1a0a0b; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #8d0f12, var(--blood)); }
progress::-moz-progress-bar { background: var(--blood); }

.toolbar {
  width: min(100%, calc((100vh - 190px) * 16 / 9)); min-width: min(100%, 320px);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem 1.2rem;
}
@supports (height: 100dvh) { .toolbar { width: min(100%, calc((100dvh - 190px) * 16 / 9)); } }
#status { margin: 0; flex: 1 1 320px; color: var(--muted); font-size: .88rem; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; font-size: .88rem; }
.tools label { color: var(--muted); }
.tools .btn { min-height: 38px; padding: .45rem .9rem; }

/* Controls */
.keys { list-style: none; margin: 0 0 .8rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .5rem 1rem; }
kbd {
  display: inline-block; min-width: 1.6rem; padding: .05rem .4rem; margin-right: .15rem; text-align: center; font-size: .82rem;
  color: var(--bone); background: #0f0809; border: 1px solid #5a2a2e; border-bottom-width: 2px; border-radius: 4px;
}
#controls details p { color: var(--muted); font-size: .92rem; margin: .5rem 0 0; }
#controls summary { font: 600 .95rem var(--sans); }
#log-panel summary { font: 600 .9rem var(--sans); color: var(--muted); }
pre { white-space: pre-wrap; max-height: 220px; overflow: auto; font-size: .75rem; color: var(--muted); margin: 0; }

body.playing #controls { max-width: 1280px; margin: 0 auto; width: 100%; }

@media (max-width: 600px) {
  main { padding: .75rem; }
  .panel { padding: 1rem; }
  h1 { font-size: 1.25rem; letter-spacing: .08em; }
  .masthead { padding: .75rem; }
  .masthead { flex-wrap: nowrap; align-items: flex-start; }
  .brand { min-width: 0; }
  .server-info { align-items: flex-start; }
  .server-location { margin: 0 0 0 .75rem; }
  .choices { grid-template-columns: 1fr 1fr; }
  .class-choices { grid-template-columns: 1fr; }
  .side .choice-body { min-height: 7.5rem; padding: .9rem; }
  .side .choice-body strong { font-size: 1.35rem; }
  .side-mark { font-size: 2.6rem; }
  .lobby-foot .actions { width: 100%; }
  .mode strong { font-size: 1.1rem; }
  .primary-btn, .practice-actions .btn { width: 100%; }
  .overlay-title { font-size: 1.1rem; }
  .overlay { padding: .5rem; gap: .3rem; font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
