/* FISIKAH! - estilos ligeros y responsivos sin frameworks. */
:root {
  color-scheme: dark;
  --bg: #111111;
  --bg-2: #191719;
  --panel: rgba(32, 31, 35, 0.88);
  --panel-strong: rgba(44, 42, 48, 0.95);
  --text: #f7f4ed;
  --muted: #c9c3b7;
  --line: rgba(255, 255, 255, 0.12);
  --cyan: #24d6c7;
  --gold: #f4c542;
  --rose: #ff5f87;
  --green: #61e294;
  --violet: #a78bfa;
  --danger: #ff6b6b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(circle at 15% 10%, rgba(36, 214, 199, 0.16), transparent 28rem),
    radial-gradient(circle at 85% 5%, rgba(244, 197, 66, 0.14), transparent 26rem),
    linear-gradient(135deg, #111111 0%, #20181d 48%, #151515 100%);
  animation: pageEnter 520ms cubic-bezier(.2,.8,.2,1) both;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(115deg, transparent 0 28%, rgba(36, 214, 199, 0.08) 42%, transparent 58%),
    linear-gradient(245deg, transparent 0 30%, rgba(255, 95, 135, 0.08) 46%, transparent 62%);
  background-size: 180% 180%;
  opacity: 0.9;
  animation: ambientSweep 12s ease-in-out infinite alternate;
}

@keyframes ambientSweep {
  from { background-position: 0% 35%, 100% 60%; }
  to { background-position: 100% 70%, 0% 30%; }
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(14px) scale(0.985); filter: blur(10px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

body.is-leaving {
  pointer-events: none;
  animation: pageExit 360ms cubic-bezier(.55,.05,.35,1) both;
}

body.is-leaving::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  background: linear-gradient(100deg, transparent, rgba(36, 214, 199, 0.24), rgba(97, 226, 148, 0.18), transparent);
  transform: translateX(-120%);
  animation: transitionWipe 360ms cubic-bezier(.55,.05,.35,1) both;
}

@keyframes pageExit {
  to { opacity: 0; transform: translateY(-10px) scale(1.012); filter: blur(8px); }
}

@keyframes transitionWipe {
  to { transform: translateX(120%); }
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.home-shell, .center-shell, .leaderboard-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.home-shell {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 22px;
  padding: 42px 0;
}

.center-shell, .leaderboard-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.hero-panel, .glass-panel, .info-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.page-host .glass-panel.narrow {
  position: relative;
  width: min(760px, 100%);
  overflow: hidden;
  border-color: rgba(36, 214, 199, 0.22);
}

.page-host .glass-panel.narrow::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 24%, rgba(36, 214, 199, 0.12), transparent 16rem),
    radial-gradient(circle at 90% 80%, rgba(97, 226, 148, 0.09), transparent 18rem);
  pointer-events: none;
}

.page-host .glass-panel.narrow > * {
  position: relative;
  z-index: 1;
}

.hero-panel {
  min-height: 450px;
  display: grid;
  align-content: center;
  padding: clamp(28px, 6vw, 72px);
  position: relative;
  overflow: hidden;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -10% -35% 35%;
  height: 280px;
  background: linear-gradient(90deg, rgba(36, 214, 199, 0.22), rgba(255, 95, 135, 0.18), rgba(244, 197, 66, 0.16));
  filter: blur(38px);
  transform: rotate(-8deg);
  pointer-events: none;
}

.brand-mark {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  color: #101010;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 0 34px rgba(36, 214, 199, 0.28);
}

.official-logo {
  display: block;
  width: 96px;
  height: 96px;
  max-width: 28vw;
  margin: 0 0 18px;
  object-fit: contain;
  object-position: left center;
}

.home-logo {
  width: 120px;
  height: 120px;
  max-width: 32vw;
  margin-bottom: 18px;
}

.lobby-main .official-logo,
.leaderboard-main .official-logo {
  margin-left: auto;
  margin-right: auto;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 14px;
  font-size: clamp(2.4rem, 8vw, 6rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.glass-panel h1 { font-size: clamp(2rem, 4.6vw, 3.35rem); line-height: 1.02; }
h2 { margin-bottom: 12px; font-size: 1.12rem; letter-spacing: 0; }
.lead { max-width: 680px; color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.32rem); line-height: 1.55; }
.lead.small { font-size: 1rem; }

.hero-actions, .host-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(1px); }
.button.primary { background: linear-gradient(135deg, var(--cyan), var(--green)); color: #0c1110; box-shadow: 0 10px 28px rgba(36, 214, 199, 0.22); }
.button.secondary { background: rgba(255,255,255,0.09); border: 1px solid var(--line); }
.button.practice { background: linear-gradient(135deg, var(--gold), #ff8a5c); color: #15100a; box-shadow: 0 10px 28px rgba(244, 197, 66, 0.18); }
.button.wide { width: 100%; }

.share-actions {
  align-items: stretch;
  gap: 12px;
}

.share-actions .button {
  flex: 1 1 180px;
}

.site-footer {
  position: fixed;
  left: 50%;
  bottom: 6px;
  z-index: 10;
  transform: translateX(-50%);
  width: min(100% - 24px, 760px);
  text-align: center;
  pointer-events: none;
}

.site-footer a {
  display: inline-block;
  max-width: 100%;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 2px 10px rgba(0,0,0,0.45);
  overflow-wrap: anywhere;
  pointer-events: auto;
  transition: color 160ms ease;
}

.site-footer a:hover {
  color: var(--cyan);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.info-card { padding: 20px; }
.card-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 50%;
  background: rgba(244, 197, 66, 0.18);
  color: var(--gold);
  font-weight: 900;
}
.info-card p { margin: 0; color: var(--muted); line-height: 1.5; }

.fisikah-hero {
  min-height: 720px;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.98fr);
  align-items: center;
  gap: 48px;
  padding: clamp(30px, 5vw, 64px);
  isolation: isolate;
  border-color: rgba(36, 214, 199, 0.2);
  background:
    radial-gradient(circle at 76% 14%, rgba(124, 92, 255, 0.24), transparent 30%),
    radial-gradient(circle at 88% 72%, rgba(255, 138, 92, 0.22), transparent 32%),
    radial-gradient(circle at 12% 18%, rgba(36, 214, 199, 0.2), transparent 28%),
    linear-gradient(135deg, rgba(12, 18, 25, 0.97), rgba(30, 24, 35, 0.96) 55%, rgba(19, 18, 28, 0.98));
}

.fisikah-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle, rgba(255,255,255,0.32) 0 1px, transparent 1.5px) 0 0 / 44px 44px,
    radial-gradient(circle, rgba(36,214,199,0.34) 0 1px, transparent 1.5px) 20px 28px / 72px 72px;
  opacity: 0.28;
  pointer-events: none;
  animation: heroParticleDrift 16s linear infinite;
}

.fisikah-hero::after {
  inset: auto -8% -18% 28%;
  height: 340px;
  z-index: 0;
  background: linear-gradient(90deg, rgba(36, 214, 199, 0.3), rgba(124, 92, 255, 0.25), rgba(255, 138, 92, 0.2));
  filter: blur(48px);
  opacity: 0.95;
}

.fisikah-hero > * {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 650px;
}

.fisikah-hero .home-logo {
  width: 92px;
  height: 92px;
  margin-bottom: 22px;
  filter: drop-shadow(0 14px 24px rgba(0,0,0,0.35));
}

.hero-kicker {
  margin-bottom: 10px;
  letter-spacing: 0.18em;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(36, 214, 199, 0.38);
}

.brand-title {
  margin: 0;
  font-size: 7.2rem;
  line-height: 0.84;
  letter-spacing: 0;
  text-transform: uppercase;
  background: linear-gradient(112deg, #fff6d6 0%, #28f5df 28%, #4f8bff 52%, #a78bfa 70%, #ff9b4a 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 20px 28px rgba(0,0,0,0.42));
  text-shadow: 0 0 26px rgba(36, 214, 199, 0.2);
}

.brand-title span {
  color: var(--gold);
  -webkit-text-fill-color: var(--gold);
  text-shadow: 0 0 24px rgba(244, 197, 66, 0.58);
}

.hero-main {
  max-width: 680px;
  margin: 22px 0 0;
  color: #fffaf2;
  font-size: 2.25rem;
  font-weight: 950;
  line-height: 1.08;
}

.hero-lead {
  max-width: 620px;
  margin-top: 14px;
  font-size: 1.16rem;
}

.mode-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 30px;
}

.mode-button {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 5px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  padding: 16px 18px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.05));
  box-shadow: 0 16px 34px rgba(0,0,0,0.28);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.mode-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0 26%, rgba(255,255,255,0.22) 44%, transparent 62%);
  transform: translateX(-110%);
  transition: transform 360ms ease;
}

.mode-button:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.32);
}

.mode-button:hover::before {
  transform: translateX(110%);
}

.mode-button strong,
.mode-button span {
  position: relative;
  z-index: 1;
}

.mode-button strong {
  font-size: 1rem;
  font-weight: 950;
}

.mode-button span {
  color: rgba(255,255,255,0.76);
  font-size: 0.84rem;
  font-weight: 850;
}

.mode-button.primary {
  color: #071312;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  box-shadow: 0 18px 36px rgba(36, 214, 199, 0.26);
}

.mode-button.primary span {
  color: rgba(5, 23, 20, 0.76);
}

.mode-button.secondary {
  background: linear-gradient(135deg, rgba(79, 139, 255, 0.28), rgba(167, 139, 250, 0.18));
}

.mode-button.practice {
  color: #1b1304;
  background: linear-gradient(135deg, var(--gold), #ff8a5c);
  box-shadow: 0 18px 36px rgba(244, 197, 66, 0.2);
}

.mode-button.practice span {
  color: rgba(27, 19, 4, 0.72);
}

.hero-stage {
  min-height: 520px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 78%, rgba(36, 214, 199, 0.24), transparent 28%),
    radial-gradient(circle at 78% 28%, rgba(124, 92, 255, 0.25), transparent 28%),
    linear-gradient(180deg, rgba(13, 24, 34, 0.92), rgba(33, 25, 39, 0.95));
  box-shadow: inset 0 0 80px rgba(36, 214, 199, 0.08), 0 28px 60px rgba(0,0,0,0.34);
}

.arena-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.2), #000 30%, #000 76%, rgba(0,0,0,0.25));
  opacity: 0.42;
}

.falling-chip {
  min-width: 112px;
  min-height: 46px;
  display: grid;
  place-items: center;
  position: absolute;
  top: -80px;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 999px;
  color: #071312;
  font-size: 0.96rem;
  font-weight: 1000;
  box-shadow: 0 16px 30px rgba(0,0,0,0.34), 0 0 24px rgba(36, 214, 199, 0.24);
  animation: chipFall 5.6s linear infinite;
}

.chip-newton {
  left: 10%;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  animation-delay: -1.1s;
}

.chip-voltio {
  left: 58%;
  background: linear-gradient(135deg, #4f8bff, var(--violet));
  color: #f8fbff;
  animation-delay: -3.6s;
}

.chip-pascal {
  left: 28%;
  background: linear-gradient(135deg, var(--gold), #ff8a5c);
  animation-delay: -4.5s;
}

.chip-watt {
  left: 70%;
  background: linear-gradient(135deg, #ff5f87, #ff8a5c);
  color: #fff7f1;
  animation-delay: -0.4s;
}

.game-avatar {
  width: 152px;
  height: 152px;
  position: absolute;
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%);
  border: 1px solid rgba(255,255,255,0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.28), transparent 36%),
    linear-gradient(135deg, var(--cyan), var(--green));
  box-shadow: 0 26px 42px rgba(0,0,0,0.42), 0 0 38px rgba(36, 214, 199, 0.42);
  animation: avatarBounce 2.4s ease-in-out infinite;
}

.game-avatar::before {
  content: "";
  position: absolute;
  inset: -26px;
  z-index: -1;
  border: 1px solid rgba(244, 197, 66, 0.32);
  border-radius: 14px;
  transform: rotate(18deg);
  animation: avatarAura 5s linear infinite;
}

.avatar-eye {
  width: 22px;
  height: 22px;
  position: absolute;
  top: 52px;
  border-radius: 50%;
  background: #071312;
  box-shadow: inset 5px 5px 0 rgba(255,255,255,0.2);
}

.avatar-eye.left { left: 42px; }
.avatar-eye.right { right: 42px; }

.avatar-smile {
  width: 52px;
  height: 24px;
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  border-bottom: 7px solid #071312;
  border-radius: 0 0 999px 999px;
}

.avatar-spark {
  width: 26px;
  height: 26px;
  position: absolute;
  top: -12px;
  right: -12px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 22px rgba(244, 197, 66, 0.8);
  animation: sparkPulse 1.4s ease-in-out infinite;
}

.combo-burst,
.score-pop {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 1000;
  box-shadow: 0 16px 30px rgba(0,0,0,0.34);
  animation: popFloat 2.2s ease-in-out infinite;
}

.combo-burst {
  left: 28px;
  bottom: 34px;
  min-width: 128px;
  min-height: 48px;
  color: #1b1304;
  background: linear-gradient(135deg, var(--gold), #ff8a5c);
}

.score-pop {
  right: 32px;
  bottom: 120px;
  min-width: 82px;
  min-height: 82px;
  color: #071312;
  background: linear-gradient(135deg, var(--cyan), #f8ff80);
  animation-delay: -0.9s;
}

.live-rank-card {
  width: min(260px, calc(100% - 36px));
  position: absolute;
  top: 18px;
  right: 18px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  padding: 16px;
  background: rgba(12, 14, 22, 0.76);
  box-shadow: 0 18px 40px rgba(0,0,0,0.28);
  backdrop-filter: blur(14px);
}

.live-rank-card > span {
  display: inline-block;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.live-rank-card ol {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.live-rank-card li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.84);
  font-size: 0.82rem;
  font-weight: 850;
}

.live-rank-card b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #1b1304;
  background: var(--gold);
}

.live-rank-card strong {
  color: var(--gold);
}

.fisikah-info .info-card {
  position: relative;
  overflow: hidden;
  min-height: 186px;
  border-color: rgba(255,255,255,0.14);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.045)),
    radial-gradient(circle at 88% 16%, rgba(36, 214, 199, 0.12), transparent 34%);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.fisikah-info .info-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--gold), #ff8a5c, var(--violet));
}

.fisikah-info .info-card:hover {
  transform: translateY(-3px);
  border-color: rgba(36, 214, 199, 0.34);
  box-shadow: 0 20px 44px rgba(0,0,0,0.32), 0 0 28px rgba(36, 214, 199, 0.12);
}

.fisikah-info .card-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(36, 214, 199, 0.2), rgba(244, 197, 66, 0.22));
}

.hero-info {
  grid-column: 1 / -1;
  align-self: start;
  width: 100%;
}

.hero-info .info-card {
  min-height: 124px;
  padding: 14px 16px;
}

.hero-info .card-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  font-size: 0.78rem;
}

.hero-info h2 {
  margin-bottom: 7px;
  font-size: 1rem;
}

.hero-info .info-card p {
  font-size: 0.86rem;
  line-height: 1.38;
}

@keyframes heroParticleDrift {
  to { background-position: 220px 180px, 160px 240px; }
}

@keyframes chipFall {
  0% { transform: translateY(-90px) rotate(-8deg); opacity: 0; }
  12%, 84% { opacity: 1; }
  100% { transform: translateY(660px) rotate(10deg); opacity: 0; }
}

@keyframes avatarBounce {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(-2deg); }
  50% { transform: translateX(-50%) translateY(-14px) rotate(2deg); }
}

@keyframes avatarAura {
  to { transform: rotate(378deg); }
}

@keyframes sparkPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; }
}

@keyframes popFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.04); }
}

.glass-panel { padding: clamp(20px, 4vw, 34px); }
.glass-panel.narrow { width: min(520px, 100%); }
.glass-panel.compact { padding: 18px; }
.top-link { display: inline-flex; margin-bottom: 22px; color: var(--muted); font-weight: 700; }
.status-line { min-height: 24px; margin: 16px 0 0; color: var(--muted); }
.status-line.error { color: var(--danger); }
.status-line.ok { color: var(--green); }

.stacked-form { display: grid; gap: 12px; }
.stacked-form label { color: var(--muted); font-size: 0.9rem; font-weight: 800; }
.stacked-form input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  color: var(--text);
  background: rgba(255,255,255,0.07);
  outline: 0;
}
.stacked-form input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(36, 214, 199, 0.16); }

.choice-section {
  display: grid;
  gap: 12px;
  margin: 24px 0;
  color: var(--muted);
  font-weight: 800;
}

.choice-section > span {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 0.94rem;
}

.choice-section > span::before {
  content: none;
}

.section-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(36, 214, 199, 0.3);
  border-radius: 9px;
  color: var(--cyan);
  background: rgba(36, 214, 199, 0.1);
  box-shadow: 0 0 18px rgba(36, 214, 199, 0.16);
  font-size: 0.95rem;
  line-height: 1;
}

.option-icon {
  display: inline-block;
  color: var(--cyan);
  font-size: 0.62rem;
  line-height: 1;
}

.choice-card.is-selected .option-icon,
.choice-card:has(input:checked) .option-icon {
  color: rgba(5, 16, 14, 0.82);
}

.section-toggle {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.045));
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.section-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(36, 214, 199, 0.5);
}

.section-toggle > span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.section-toggle strong {
  color: var(--gold);
  font-size: 0.82rem;
  white-space: nowrap;
}

.section-toggle::after {
  content: "+";
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #111;
  background: var(--gold);
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
  transition: transform 180ms ease;
}

.section-toggle[aria-expanded="true"]::after {
  content: "−";
  transform: none;
}

.chapter-panel {
  display: grid;
  gap: 10px;
  animation: panelReveal 180ms ease both;
}

.chapter-panel.is-collapsed {
  display: none;
}

@keyframes panelReveal {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.time-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.difficulty-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chapter-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.choice-card {
  position: relative;
  min-height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  padding: 0 16px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.1), rgba(255,255,255,0.055));
  cursor: pointer;
  font-weight: 900;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 18px rgba(0,0,0,0.16);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.choice-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-card:has(input:checked),
.choice-card.is-selected {
  color: #101010;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  border-color: rgba(97, 226, 148, 0.85);
  box-shadow: 0 13px 28px rgba(36, 214, 199, 0.22), 0 0 0 3px rgba(36, 214, 199, 0.12);
  animation: selectedPop 220ms cubic-bezier(.2,.8,.2,1);
}

.choice-card.is-selected small,
.choice-card:has(input:checked) small {
  color: rgba(5, 16, 14, 0.86);
}

.choice-card:hover {
  transform: translateY(-1px);
  border-color: rgba(36, 214, 199, 0.62);
}

@keyframes selectedPop {
  0% { transform: scale(0.97); }
  70% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

.difficulty-card {
  min-height: 86px;
  place-items: start;
  align-content: center;
  border-radius: var(--radius);
  gap: 4px;
  text-align: left;
}

.book-card {
  min-height: 78px;
  border-radius: var(--radius);
  gap: 2px;
}

.book-card span {
  font-size: 1.35rem;
}

.book-card small,
.chapter-card small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.book-card.is-selected small,
.book-card:has(input:checked) small {
  font-weight: 900;
}

.chapter-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(255,255,255,0.07);
  cursor: pointer;
  font-weight: 900;
}

.mini-button.is-active {
  color: #101010;
  background: var(--gold);
  border-color: rgba(244, 197, 66, 0.8);
}

.chapter-card {
  min-height: 58px;
  justify-items: start;
  border-radius: var(--radius);
  padding: 12px 14px;
  text-align: left;
}

.chapter-card span {
  display: block;
  line-height: 1.25;
}

.difficulty-card > span {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-size: 0.96rem;
}

.level-stars {
  width: auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  border-radius: 999px;
  padding: 2px 6px;
  color: var(--cyan);
  background: rgba(36, 214, 199, 0.12);
  font-size: 0.68rem;
  letter-spacing: 0;
  line-height: 1;
}

.choice-card.is-selected .level-stars,
.choice-card:has(input:checked) .level-stars {
  color: #111;
  background: rgba(5, 16, 14, 0.14);
}

.difficulty-card small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
}

.difficulty-card:has(input:checked) small,
.difficulty-card.is-selected small {
  color: rgba(16, 16, 16, 0.72);
}

.lobby-layout, .play-layout {
  width: min(1240px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  gap: 18px;
  padding: 24px 0;
}
.lobby-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: center; }
.lobby-main { text-align: center; }
.qr-wrap {
  width: min(300px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 20px auto 14px;
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
}
.qr-image { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.join-url { max-width: 560px; margin: 0 auto; color: var(--muted); overflow-wrap: anywhere; }
.join-url a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
.room-setting { margin: -4px 0 0; color: var(--muted); font-weight: 800; }
.room-setting strong { color: var(--gold); }
.players-panel { min-height: 420px; }
.metric { font-size: 3.4rem; font-weight: 900; color: var(--gold); }
.player-list, .achievement-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.player-list li, .achievement-list li {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.07);
  color: var(--text);
}

.play-body { overflow-x: hidden; }
.play-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: stretch; }
.game-column { min-width: 0; display: grid; grid-template-rows: auto minmax(420px, 1fr) auto; gap: 14px; }
.game-hud {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.game-hud h1 { margin: 0; font-size: clamp(1.35rem, 4vw, 2.4rem); line-height: 1.12; }
.hud-stats { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(255,255,255,0.09);
  border: 1px solid var(--line);
  font-weight: 900;
  white-space: nowrap;
}

.game-arena {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(36, 214, 199, 0.12), rgba(255, 95, 135, 0.08) 55%, rgba(244, 197, 66, 0.1));
  background-size: 44px 44px, 44px 44px, auto;
  box-shadow: inset 0 0 80px rgba(0,0,0,0.35), var(--shadow);
  touch-action: none;
}

.answer-arena {
  display: grid;
  align-items: center;
  padding: clamp(14px, 3vw, 26px);
}
.arena-stars::before, .arena-stars::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.35) 1px, transparent 1.5px);
  background-size: 46px 46px;
  opacity: 0.28;
  animation: drift 12s linear infinite;
}
.arena-stars::after { background-size: 80px 80px; animation-duration: 18s; opacity: 0.18; }
@keyframes drift { from { transform: translateY(-40px); } to { transform: translateY(40px); } }

.catcher {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: clamp(82px, 18vw, 132px);
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  box-shadow: 0 0 28px rgba(36, 214, 199, 0.34);
  transform: translateX(-50%);
}
.catcher::after {
  content: "";
  position: absolute;
  inset: 8px 16px;
  border-radius: 999px;
  background: rgba(16,16,16,0.28);
}

.falling-option {
  position: absolute;
  min-width: 104px;
  max-width: min(220px, 46vw);
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  color: #111;
  background: var(--gold);
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  font-weight: 900;
  text-align: center;
  line-height: 1.1;
  will-change: transform;
}
.falling-option:nth-child(4n+1) { background: var(--cyan); }
.falling-option:nth-child(4n+2) { background: var(--rose); color: #fff; }
.falling-option:nth-child(4n+3) { background: var(--green); }

.answer-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2.4vw, 20px);
  width: min(920px, 100%);
  margin: 0 auto;
}

.answer-option {
  min-height: clamp(86px, 18vh, 150px);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(14px, 2.4vw, 22px);
  color: var(--text);
  background: rgba(255,255,255,0.1);
  box-shadow: 0 12px 32px rgba(0,0,0,0.2);
  cursor: pointer;
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 900;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.answer-option:hover,
.answer-option:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(36, 214, 199, 0.75);
  outline: none;
}

.answer-option:disabled {
  cursor: default;
  opacity: 0.82;
}

.answer-option.is-correct {
  border-color: rgba(97, 226, 148, 0.9);
  background: rgba(97, 226, 148, 0.22);
}

.answer-option.is-wrong {
  border-color: rgba(255, 107, 107, 0.9);
  background: rgba(255, 107, 107, 0.2);
}

.answer-key {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #101010;
  background: var(--gold);
  font-weight: 950;
}

.waiting-card {
  grid-column: 1 / -1;
  padding: 26px;
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255,255,255,0.08);
  text-align: center;
  font-weight: 800;
}

.feedback-burst {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: clamp(1.6rem, 8vw, 4.5rem);
  font-weight: 950;
  text-align: center;
  text-shadow: 0 8px 30px rgba(0,0,0,0.35);
  opacity: 0;
  transform: scale(0.92);
}
.feedback-burst.show { animation: popFeedback 900ms ease; }
@keyframes popFeedback {
  0% { opacity: 0; transform: scale(0.82); }
  18%, 70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.08); }
}

.touch-controls { display: none; grid-template-columns: 1fr 1fr; gap: 12px; }
.control-btn {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.1);
  color: var(--text);
  font-size: 2rem;
  font-weight: 900;
}

.side-panel { display: grid; align-content: start; gap: 14px; }
.ranking-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; counter-reset: rank; }
.ranking-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.07);
  border: 1px solid transparent;
}
.ranking-list li:first-child { border-color: rgba(244,197,66,0.5); background: rgba(244,197,66,0.13); }
.rank-badge { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,0.11); font-weight: 900; }
.score { color: var(--gold); font-weight: 900; white-space: nowrap; }
.ranking-list.large li, .ranking-list.podium li { min-height: 58px; font-size: 1.1rem; }
.leaderboard-main { width: min(820px, 100%); }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0,0,0,0.64);
}
.overlay.hidden { display: none; }
.end-card { width: min(520px, 100%); }

.practice-shell {
  width: min(760px, calc(100% - 32px));
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 18px;
  margin: 0 auto;
  padding: 24px 0;
}

.practice-hero {
  display: grid;
}

.practice-shell:has(.practice-game:not(.hidden)) {
  width: min(1120px, calc(100% - 28px));
}

.practice-game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: stretch;
}

.practice-hud {
  grid-column: 1 / -1;
}

.practice-hud h2 {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 2.4rem);
  line-height: 1.12;
}

.practice-arena {
  min-height: 470px;
}

.practice-side {
  display: grid;
  align-content: start;
  gap: 16px;
}

.streak-forge {
  display: grid;
  gap: 14px;
  overflow: hidden;
  justify-items: center;
  text-align: center;
}

.forge-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.forge-kicker {
  color: var(--cyan);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.forge-head strong {
  max-width: 132px;
  color: var(--gold);
  font-size: 0.9rem;
  line-height: 1.2;
  text-align: right;
}

.streak-forge .forge-head {
  align-items: center;
  display: grid;
  justify-content: center;
  justify-items: center;
  gap: 4px;
}

.streak-forge .forge-kicker,
.streak-forge .forge-head strong {
  text-align: center;
}

.forge-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.forge-pill {
  min-width: 104px;
  justify-content: center;
  border-color: rgba(36, 214, 199, 0.32);
  background: rgba(36, 214, 199, 0.12);
}

.forge-pill:last-child {
  border-color: rgba(244, 197, 66, 0.32);
  background: rgba(244, 197, 66, 0.12);
}

.armor-avatar {
  width: 188px;
  height: 210px;
  position: relative;
  margin: 0 auto;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 30%, rgba(36, 214, 199, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(0,0,0,0.1));
}

.armor-avatar.is-upgrading {
  animation: armorBounce 420ms cubic-bezier(.2,.8,.2,1);
}

.avatar-head {
  position: absolute;
  left: 50%;
  top: 34px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f4c542, #f08f4f);
  box-shadow: inset 0 -6px 0 rgba(0,0,0,0.12);
  transform: translateX(-50%);
}

.avatar-head::before,
.avatar-head::after {
  content: "";
  position: absolute;
  top: 20px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1a1716;
}

.avatar-head::before { left: 12px; }
.avatar-head::after { right: 12px; }

.avatar-body {
  position: absolute;
  left: 50%;
  top: 86px;
  width: 78px;
  height: 86px;
  border-radius: 22px 22px 18px 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
  border: 1px solid rgba(255,255,255,0.18);
  transform: translateX(-50%);
}

.armor-piece {
  position: absolute;
  opacity: 0.16;
  filter: saturate(0.4);
  transform: scale(0.92);
  transition: opacity 180ms ease, filter 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.armor-piece.is-equipped {
  opacity: 1;
  filter: saturate(1.1);
  transform: scale(1);
  box-shadow: 0 0 18px rgba(36, 214, 199, 0.28);
}

.armor-boots {
  left: 63px;
  bottom: 22px;
  width: 62px;
  height: 15px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
}

.armor-gauntlet {
  top: 112px;
  width: 26px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(180deg, var(--cyan), #4a9fb4);
}

.armor-gauntlet.left { left: 39px; transform: rotate(10deg) scale(0.92); }
.armor-gauntlet.right { right: 39px; transform: rotate(-10deg) scale(0.92); }
.armor-gauntlet.left.is-equipped { transform: rotate(10deg) scale(1); }
.armor-gauntlet.right.is-equipped { transform: rotate(-10deg) scale(1); }

.armor-chest {
  left: 50%;
  top: 92px;
  width: 88px;
  height: 78px;
  border-radius: 20px 20px 18px 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.42), rgba(255,255,255,0) 38%),
    linear-gradient(180deg, #28d4c4, #57df8d);
  transform: translateX(-50%) scale(0.92);
}

.armor-chest.is-equipped { transform: translateX(-50%) scale(1); }

.armor-helmet {
  left: 50%;
  top: 24px;
  width: 58px;
  height: 42px;
  border-radius: 28px 28px 14px 14px;
  background: linear-gradient(180deg, #dbe9ef, #61cfe0);
  transform: translateX(-50%) scale(0.92);
}

.armor-helmet::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(18, 30, 34, 0.72);
}

.armor-helmet.is-equipped { transform: translateX(-50%) scale(1); }

.armor-shield {
  right: 21px;
  top: 108px;
  width: 44px;
  height: 58px;
  border-radius: 20px 20px 26px 26px;
  background: linear-gradient(180deg, #f4c542, #ff8a5c);
}

.armor-cape {
  left: 50%;
  top: 78px;
  width: 104px;
  height: 104px;
  border-radius: 34px 34px 48px 48px;
  background: linear-gradient(180deg, rgba(255,95,135,0.9), rgba(244,197,66,0.72));
  transform: translateX(-50%) scale(0.92);
}

.armor-cape.is-equipped { transform: translateX(-50%) scale(1); }

.armor-core {
  left: 50%;
  top: 119px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  transform: translateX(-50%) scale(0.92);
}

.armor-core.is-equipped {
  transform: translateX(-50%) scale(1);
  animation: corePulse 900ms ease-in-out infinite;
}

.armor-wings {
  left: 50%;
  top: 82px;
  width: 152px;
  height: 82px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 18% 50%, rgba(36,214,199,0.65) 0 28%, transparent 30%),
    radial-gradient(ellipse at 82% 50%, rgba(36,214,199,0.65) 0 28%, transparent 30%);
  transform: translateX(-50%) scale(0.92);
}

.armor-wings.is-equipped { transform: translateX(-50%) scale(1); }

.armor-crown {
  left: 50%;
  top: 8px;
  width: 48px;
  height: 24px;
  background: linear-gradient(180deg, #ffe28a, var(--gold));
  clip-path: polygon(0 100%, 12% 35%, 30% 100%, 50% 18%, 70% 100%, 88% 35%, 100% 100%);
  transform: translateX(-50%) scale(0.92);
}

.armor-crown.is-equipped { transform: translateX(-50%) scale(1); }

.armor-aura {
  inset: 18px;
  border-radius: 26px;
  border: 2px solid rgba(36,214,199,0.55);
  background: radial-gradient(circle, rgba(36,214,199,0.18), transparent 65%);
  animation: auraSpin 2.8s linear infinite;
}

.armor-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.09);
}

.armor-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green), var(--gold));
  transition: width 220ms ease;
}

.streak-forge p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

@keyframes armorBounce {
  0% { transform: scale(1); }
  45% { transform: scale(1.045); }
  100% { transform: scale(1); }
}

@keyframes corePulse {
  0%, 100% { box-shadow: 0 0 12px rgba(244,197,66,0.34); }
  50% { box-shadow: 0 0 24px rgba(244,197,66,0.82); }
}

@keyframes auraSpin {
  to { transform: rotate(360deg); }
}

@keyframes resultArmorReveal {
  0% { transform: translateY(10px) scale(0.92); filter: brightness(0.82); }
  45% { transform: translateY(-8px) scale(1.05); filter: brightness(1.25); }
  70% { transform: translateY(2px) scale(0.98); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes armorPiecePop {
  0% { opacity: 0; filter: brightness(0.7) saturate(0.8); }
  55% { opacity: 1; filter: brightness(1.55) saturate(1.25); }
  100% { opacity: 1; filter: brightness(1) saturate(1); }
}

@keyframes resultEnergyRing {
  0% { opacity: 0; transform: scale(0.78); box-shadow: 0 0 0 0 rgba(244,197,66,0); }
  35% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 10px rgba(244,197,66,0.16); }
  100% { opacity: 0; transform: scale(1.18); box-shadow: 0 0 0 24px rgba(244,197,66,0); }
}

@keyframes resultSparks {
  0% { opacity: 0; transform: scale(0.8) rotate(0deg); filter: blur(1px); }
  30% { opacity: 1; transform: scale(1.05) rotate(8deg); filter: blur(0); }
  100% { opacity: 0; transform: scale(1.32) rotate(18deg); filter: blur(1px); }
}

.practice-feedback {
  align-self: stretch;
  display: grid;
  align-content: center;
  gap: 12px;
}

.practice-feedback strong {
  color: var(--green);
  font-size: 1.6rem;
}

.practice-feedback p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.practice-summary {
  width: min(760px, 100%);
  justify-self: center;
}

.summary-showcase {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: stretch;
  gap: 16px;
  margin: 22px 0;
}

.summary-forge {
  position: relative;
  display: grid;
  gap: 12px;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 206, 66, 0.18), transparent 32%),
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.035));
}

.summary-forge::after {
  content: "";
  position: absolute;
  inset: auto 14% 18px;
  height: 34px;
  border-radius: 999px;
  background: radial-gradient(ellipse, rgba(36, 214, 199, 0.26), transparent 65%);
  filter: blur(4px);
  opacity: 0.9;
  pointer-events: none;
}

.summary-forge .forge-head,
.summary-forge .armor-track,
.summary-forge p {
  position: relative;
  z-index: 2;
}

.summary-forge p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.result-avatar {
  width: 168px;
  height: 188px;
  z-index: 1;
}

.result-avatar::before,
.result-avatar::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 26px;
  pointer-events: none;
  opacity: 0;
}

.result-avatar::before {
  border: 1px solid rgba(244, 197, 66, 0.42);
  box-shadow: 0 0 0 0 rgba(244, 197, 66, 0), inset 0 0 22px rgba(36, 214, 199, 0.16);
}

.result-avatar::after {
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.9) 0 3px, transparent 4px),
    radial-gradient(circle at 70% 18%, rgba(244, 197, 66, 0.95) 0 3px, transparent 4px),
    radial-gradient(circle at 78% 64%, rgba(36, 214, 199, 0.9) 0 3px, transparent 4px),
    radial-gradient(circle at 20% 72%, rgba(255, 138, 92, 0.9) 0 3px, transparent 4px);
}

.result-avatar.is-celebrating {
  animation: resultArmorReveal 980ms cubic-bezier(.18,.9,.22,1.1);
}

.result-avatar.is-celebrating::before {
  animation: resultEnergyRing 980ms ease-out both;
}

.result-avatar.is-celebrating::after {
  animation: resultSparks 980ms ease-out both;
}

.result-avatar.is-celebrating .armor-piece.is-equipped {
  animation: armorPiecePop 620ms cubic-bezier(.2,.9,.2,1.15) both;
}

.result-avatar.is-celebrating .armor-piece.is-equipped:nth-child(1) { animation-delay: 360ms; }
.result-avatar.is-celebrating .armor-piece.is-equipped:nth-child(2) { animation-delay: 280ms; }
.result-avatar.is-celebrating .armor-piece.is-equipped:nth-child(3) { animation-delay: 220ms; }
.result-avatar.is-celebrating .armor-piece.is-equipped:nth-child(6) { animation-delay: 40ms; }
.result-avatar.is-celebrating .armor-piece.is-equipped:nth-child(7),
.result-avatar.is-celebrating .armor-piece.is-equipped:nth-child(8) { animation-delay: 90ms; }
.result-avatar.is-celebrating .armor-piece.is-equipped:nth-child(9) { animation-delay: 140ms; }
.result-avatar.is-celebrating .armor-piece.is-equipped:nth-child(10) { animation-delay: 190ms; }
.result-avatar.is-celebrating .armor-piece.is-equipped:nth-child(11) { animation-delay: 240ms; }
.result-avatar.is-celebrating .armor-piece.is-equipped:nth-child(12) { animation-delay: 300ms; }
.result-avatar.is-celebrating .armor-piece.is-equipped:nth-child(13) { animation-delay: 340ms; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.summary-grid div {
  min-height: 108px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
}

.summary-grid strong {
  color: var(--gold);
  font-size: 2.2rem;
  line-height: 1;
}

.summary-grid span {
  color: var(--muted);
  font-weight: 800;
}

.setup-panel,
.lobby-main,
.players-panel,
.leaderboard-main,
.game-hud,
.side-panel .glass-panel,
.practice-side .glass-panel,
.practice-summary,
.end-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(36, 214, 199, 0.2);
  background:
    radial-gradient(circle at 18% 18%, rgba(36, 214, 199, 0.13), transparent 24rem),
    radial-gradient(circle at 92% 12%, rgba(124, 92, 255, 0.12), transparent 22rem),
    radial-gradient(circle at 82% 92%, rgba(255, 138, 92, 0.1), transparent 22rem),
    linear-gradient(135deg, rgba(20, 25, 31, 0.94), rgba(31, 26, 36, 0.94));
}

.setup-panel::after,
.lobby-main::after,
.players-panel::after,
.leaderboard-main::after,
.game-hud::after,
.side-panel .glass-panel::after,
.practice-side .glass-panel::after,
.practice-summary::after,
.end-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(115deg, transparent 0 28%, rgba(36, 214, 199, 0.08) 46%, transparent 64%),
    radial-gradient(circle, rgba(255,255,255,0.22) 0 1px, transparent 1.5px) 0 0 / 54px 54px;
  opacity: 0.38;
  pointer-events: none;
}

.setup-panel > *,
.lobby-main > *,
.players-panel > *,
.leaderboard-main > *,
.game-hud > *,
.side-panel .glass-panel > *,
.practice-side .glass-panel > *,
.practice-summary > *,
.end-card > * {
  position: relative;
  z-index: 1;
}

.page-host .center-shell,
.page-join .center-shell {
  width: min(820px, calc(100% - 32px));
}

.setup-panel {
  padding: clamp(26px, 5vw, 48px);
  box-shadow: 0 28px 70px rgba(0,0,0,0.38), inset 0 0 70px rgba(36, 214, 199, 0.04);
}

.setup-panel .official-logo,
.lobby-main .official-logo,
.leaderboard-main .official-logo,
.practice-hero .official-logo {
  width: 82px;
  height: 82px;
  margin-bottom: 18px;
  filter: drop-shadow(0 14px 24px rgba(0,0,0,0.38));
}

.page-brand-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0 0 16px;
  border: 1px solid rgba(36, 214, 199, 0.32);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--cyan);
  background: rgba(36, 214, 199, 0.09);
  box-shadow: 0 0 24px rgba(36, 214, 199, 0.14);
  font-size: 0.78rem;
  font-weight: 1000;
  letter-spacing: 0.1em;
}

.setup-panel h1,
.leaderboard-main h1,
.lobby-main h1 {
  max-width: 760px;
  margin-bottom: 16px;
  color: #fffaf2;
  font-size: 4.1rem;
  line-height: 0.95;
  text-shadow: 0 18px 34px rgba(0,0,0,0.34);
}

.setup-panel .lead,
.join-panel .lead {
  max-width: 640px;
}

.top-link {
  transition: color 160ms ease, transform 160ms ease;
}

.top-link:hover {
  color: var(--cyan);
  transform: translateX(-2px);
}

.stacked-form {
  margin-top: 22px;
}

.stacked-form label {
  color: rgba(255,255,255,0.86);
}

.stacked-form input {
  min-height: 56px;
  border-color: rgba(255,255,255,0.16);
  border-radius: 8px;
  background: rgba(255,255,255,0.075);
  box-shadow: inset 0 0 24px rgba(0,0,0,0.18);
}

.choice-section {
  margin: 22px 0;
}

.choice-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.045));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.book-card,
.difficulty-card {
  border-radius: 8px;
}

.choice-card:has(input:checked),
.choice-card.is-selected {
  box-shadow: 0 16px 34px rgba(36, 214, 199, 0.24), 0 0 0 3px rgba(36, 214, 199, 0.12);
}

.time-grid .choice-card {
  min-height: 56px;
}

.section-toggle {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.button.primary,
.button.practice {
  box-shadow: 0 16px 34px rgba(36, 214, 199, 0.24);
}

.button.secondary {
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.055));
}

.fisikah-lobby {
  width: min(1180px, calc(100% - 32px));
}

.lobby-main {
  min-height: 650px;
  display: grid;
  align-content: center;
  padding: clamp(24px, 4vw, 42px);
}

.lobby-main .page-brand-chip,
.leaderboard-main .page-brand-chip {
  margin-left: auto;
  margin-right: auto;
}

.lobby-main .room-setting {
  display: inline-block;
  margin: 0 auto 8px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
}

.qr-wrap {
  box-shadow: 0 22px 42px rgba(0,0,0,0.34), 0 0 0 6px rgba(36, 214, 199, 0.1);
}

.players-panel {
  padding: 24px;
}

.players-panel h2,
.side-panel h2 {
  color: #fffaf2;
}

.players-panel .metric {
  color: var(--gold);
  text-shadow: 0 0 22px rgba(244, 197, 66, 0.32);
}

.game-hud {
  box-shadow: 0 18px 40px rgba(0,0,0,0.28);
}

.game-hud h1 {
  font-size: 2.2rem;
}

.pill {
  border-color: rgba(36, 214, 199, 0.22);
  background: rgba(36, 214, 199, 0.09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.answer-arena {
  border-color: rgba(36, 214, 199, 0.18);
  box-shadow: inset 0 0 70px rgba(36, 214, 199, 0.06), 0 24px 55px rgba(0,0,0,0.3);
}

.side-panel .glass-panel,
.practice-side .glass-panel {
  box-shadow: 0 16px 38px rgba(0,0,0,0.28);
}

.ranking-list li {
  border-color: rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.075);
}

.ranking-list li:first-child {
  box-shadow: 0 0 28px rgba(244, 197, 66, 0.12);
}

.leaderboard-main {
  padding: clamp(24px, 5vw, 42px);
  text-align: center;
}

.leaderboard-main .ranking-list {
  text-align: left;
}

.overlay {
  backdrop-filter: blur(12px);
}

.end-card {
  padding: 28px;
  text-align: center;
}

.practice-shell {
  width: min(820px, calc(100% - 32px));
}

.practice-shell:has(.practice-game:not(.hidden)) {
  width: min(1180px, calc(100% - 28px));
}

.practice-hero {
  min-height: 560px;
  align-content: center;
}

.practice-hero:has(.practice-setup:not(.hidden)) {
  min-height: auto;
}

.practice-shell:has(.practice-game:not(.hidden)) .practice-hero,
.practice-shell:has(.practice-summary:not(.hidden)) .practice-hero {
  min-height: 0;
  padding-block: clamp(18px, 3vw, 28px);
}

.practice-shell:has(.practice-game:not(.hidden)) .practice-hero {
  grid-template-columns: auto 1fr;
  column-gap: 14px;
  row-gap: 4px;
  align-items: center;
  padding: 14px 20px;
}

.practice-shell:has(.practice-game:not(.hidden)) .practice-hero .top-link {
  grid-column: 1;
  grid-row: 1 / span 3;
  margin: 0;
}

.practice-shell:has(.practice-game:not(.hidden)) .practice-hero .official-logo {
  display: none;
}

.practice-shell:has(.practice-game:not(.hidden)) .practice-hero .page-brand-chip {
  grid-column: 2;
  margin: 0;
  min-height: 24px;
  padding-inline: 10px;
  font-size: 0.66rem;
}

.practice-shell:has(.practice-game:not(.hidden)) .practice-hero .eyebrow {
  grid-column: 2;
  margin: 0;
  font-size: 0.68rem;
}

.practice-shell:has(.practice-game:not(.hidden)) .practice-hero h1,
.practice-shell:has(.practice-summary:not(.hidden)) .practice-hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.practice-shell:has(.practice-game:not(.hidden)) .practice-hero h1 {
  grid-column: 2;
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  line-height: 0.95;
}

.practice-shell:has(.practice-game:not(.hidden)) .practice-hero .lead {
  display: none;
}

.practice-summary {
  padding: clamp(22px, 4vw, 34px);
}

.hidden { display: none !important; }

@media (max-width: 900px) {
  .info-grid, .lobby-layout, .play-layout { grid-template-columns: 1fr; }
  .fisikah-hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .brand-title { font-size: 5.8rem; }
  .hero-main { font-size: 1.85rem; }
  .mode-actions { grid-template-columns: 1fr; }
  .hero-stage { min-height: 430px; }
  .players-panel { min-height: auto; }
  .game-column { grid-template-rows: auto minmax(440px, 58vh) auto; }
  .side-panel { grid-template-columns: 1fr 1fr; }
  .practice-game { grid-template-columns: 1fr; }
  .practice-side { grid-template-columns: 1fr 1fr; }
  .practice-feedback { align-content: start; }
  .summary-showcase { grid-template-columns: 1fr; }
  .summary-forge { justify-items: center; }
  .setup-panel h1,
  .leaderboard-main h1,
  .lobby-main h1 { font-size: 3.2rem; }
  .lobby-main { min-height: auto; }
}

@media (max-width: 640px) {
  .home-shell, .center-shell, .leaderboard-shell, .lobby-layout, .play-layout { width: min(100% - 20px, 1120px); padding: 12px 0; }
  .hero-panel { min-height: 520px; }
  .fisikah-hero {
    min-height: auto;
    padding: 22px;
  }
  .fisikah-hero .home-logo {
    width: 74px;
    height: 74px;
    margin-bottom: 18px;
  }
  .hero-kicker {
    font-size: 0.7rem;
    letter-spacing: 0.13em;
  }
  .brand-title {
    font-size: 3.7rem;
    line-height: 0.9;
  }
  .hero-main {
    margin-top: 16px;
    font-size: 1.38rem;
  }
  .hero-lead {
    font-size: 1rem;
  }
  .mode-button {
    min-height: 72px;
    padding: 14px 16px;
  }
  .hero-stage {
    min-height: 380px;
  }
  .live-rank-card {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    padding: 12px;
  }
  .live-rank-card li {
    font-size: 0.76rem;
  }
  .game-avatar {
    width: 116px;
    height: 116px;
    bottom: 44px;
  }
  .avatar-eye {
    width: 17px;
    height: 17px;
    top: 40px;
  }
  .avatar-eye.left { left: 31px; }
  .avatar-eye.right { right: 31px; }
  .avatar-smile {
    width: 42px;
    bottom: 30px;
  }
  .falling-chip {
    min-width: 90px;
    min-height: 38px;
    font-size: 0.82rem;
  }
  .combo-burst {
    left: 14px;
    bottom: 18px;
    min-width: 104px;
    min-height: 40px;
    font-size: 0.82rem;
  }
  .score-pop {
    right: 16px;
    bottom: 88px;
    min-width: 62px;
    min-height: 62px;
    font-size: 0.9rem;
  }
  .official-logo { width: 82px; height: 82px; max-width: 34vw; }
  .home-logo { width: 96px; height: 96px; max-width: 38vw; }
  .time-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chapter-grid { grid-template-columns: 1fr; }
  .difficulty-grid { grid-template-columns: 1fr; }
  .hero-actions, .host-actions { flex-direction: column; }
  .button { width: 100%; }
  .game-hud { align-items: stretch; flex-direction: column; }
  .hud-stats { justify-content: start; }
  .side-panel { grid-template-columns: 1fr; }
  .practice-side { grid-template-columns: 1fr; }
  .touch-controls { display: grid; }
  .answer-grid { grid-template-columns: 1fr; }
  .answer-option { min-height: 74px; }
  .game-column { grid-template-rows: auto minmax(390px, 55vh) auto; }
  .falling-option { min-width: 92px; font-size: 0.9rem; }
  .summary-grid { grid-template-columns: 1fr; }
  .practice-arena { min-height: 390px; }
  .section-toggle {
    position: relative;
    align-items: flex-start;
    flex-direction: column;
    padding-right: 54px;
  }
  .section-toggle strong { white-space: normal; }
  .section-toggle::after {
    position: absolute;
    top: 14px;
    right: 14px;
  }
  .page-host .center-shell,
  .page-join .center-shell,
  .practice-shell {
    width: min(100% - 20px, 820px);
  }
  .setup-panel {
    padding: 22px;
  }
  .setup-panel h1,
  .leaderboard-main h1,
  .lobby-main h1 {
    font-size: 2.45rem;
  }
  .setup-panel .official-logo,
  .lobby-main .official-logo,
  .leaderboard-main .official-logo,
  .practice-hero .official-logo {
    width: 70px;
    height: 70px;
  }
  .game-hud h1 {
    font-size: 1.45rem;
  }
  .lobby-main .host-actions,
  .leaderboard-main .host-actions,
  .end-card .host-actions {
    display: grid;
  }
}

/* Ajustes finales para que las pantallas quepan en el viewport sin desbordes. */
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100svh;
}

.home-shell,
.center-shell,
.leaderboard-shell,
.lobby-layout,
.play-layout,
.practice-shell {
  height: 100svh;
  min-height: 0;
  overflow: hidden;
}

.home-shell {
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 10px;
  padding: 12px 0;
}

.fisikah-hero {
  min-height: 0;
  height: 100%;
  gap: 34px;
  padding: clamp(22px, 4vw, 44px);
}

.fisikah-hero .home-logo {
  width: 74px;
  height: 74px;
  margin-bottom: 14px;
}

.brand-title {
  font-size: 6.1rem;
}

.hero-main {
  margin-top: 16px;
  font-size: 1.85rem;
}

.hero-lead {
  margin-top: 10px;
  font-size: 1.02rem;
}

.mode-actions {
  margin-top: 20px;
}

.mode-button {
  min-height: 72px;
}

.hero-stage {
  min-height: 0;
  height: 100%;
}

.fisikah-info .info-card {
  min-height: 116px;
  padding: 14px 16px;
}

.fisikah-info .card-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  font-size: 0.82rem;
}

.fisikah-info h2 {
  margin-bottom: 8px;
}

.fisikah-info .info-card p {
  font-size: 0.92rem;
  line-height: 1.38;
}

.center-shell,
.leaderboard-shell {
  padding: 10px 0;
}

.setup-panel {
  max-height: calc(100svh - 20px);
  padding: clamp(18px, 3vw, 30px);
}

.setup-panel .official-logo,
.lobby-main .official-logo,
.leaderboard-main .official-logo,
.practice-hero .official-logo {
  width: 58px;
  height: 58px;
  margin-bottom: 10px;
}

.page-brand-chip {
  min-height: 24px;
  margin-bottom: 10px;
  padding: 0 10px;
  font-size: 0.68rem;
}

.setup-panel h1,
.leaderboard-main h1,
.lobby-main h1 {
  margin-bottom: 10px;
  font-size: 3.15rem;
}

.setup-panel .lead,
.join-panel .lead {
  margin-bottom: 0;
  font-size: 0.95rem;
  line-height: 1.42;
}

.choice-section {
  gap: 8px;
  margin: 12px 0;
}

.choice-section > span {
  font-size: 0.88rem;
}

.section-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: 0.82rem;
}

.choice-grid {
  gap: 8px;
}

.choice-card {
  min-height: 42px;
  padding: 0 12px;
}

.book-card {
  min-height: 64px;
}

.difficulty-card {
  min-height: 66px;
  gap: 2px;
  padding: 10px 14px;
}

.time-grid .choice-card {
  min-height: 46px;
}

.section-toggle {
  min-height: 46px;
}

.chapter-panel:not(.is-collapsed) {
  max-height: 30svh;
  overflow: auto;
  scrollbar-width: thin;
}

.stacked-form {
  gap: 9px;
  margin-top: 14px;
}

.stacked-form input {
  min-height: 46px;
}

.lobby-layout,
.play-layout {
  padding: 10px 0;
}

.lobby-main {
  min-height: 0;
  align-content: center;
  padding: clamp(18px, 3vw, 30px);
}

.lobby-main .room-setting {
  margin-bottom: 4px;
  font-size: 0.88rem;
  line-height: 1.35;
}

.qr-wrap {
  width: min(230px, 42svh, 100%);
  margin: 12px auto 10px;
}

.join-url {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
}

.players-panel {
  max-height: calc(100svh - 20px);
  padding: 18px;
}

.player-list,
.ranking-list,
.achievement-list {
  min-width: 0;
}

.player-list {
  max-height: 56svh;
  overflow: auto;
  scrollbar-width: thin;
}

.play-layout {
  grid-template-rows: minmax(0, 1fr);
}

.game-column {
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.game-hud {
  padding: 14px;
}

.game-hud h1 {
  font-size: 1.72rem;
}

.game-arena {
  min-height: 0;
}

.answer-grid {
  gap: 12px;
  padding: clamp(12px, 2vw, 20px);
}

.answer-option {
  min-height: 88px;
  padding: 14px;
}

.side-panel {
  min-height: 0;
}

.side-panel .glass-panel,
.practice-side .glass-panel {
  min-height: 0;
}

.side-panel .ranking-list,
.achievement-list {
  max-height: 36svh;
  overflow: auto;
  scrollbar-width: thin;
}

.practice-shell {
  align-content: stretch;
  padding: 10px 0;
}

.practice-hero {
  min-height: 0;
}

.practice-game {
  min-height: 0;
}

.practice-side {
  min-height: 0;
}

.practice-arena {
  min-height: 0;
}

.summary-showcase {
  margin: 14px 0;
}

.summary-grid div {
  min-height: 86px;
}

@media (max-height: 760px) {
  .brand-title { font-size: 5.1rem; }
  .hero-main { font-size: 1.5rem; }
  .hero-lead { font-size: 0.92rem; }
  .mode-button { min-height: 60px; padding: 10px 12px; }
  .hero-stage { min-height: 0; }
  .game-avatar { width: 124px; height: 124px; bottom: 42px; }
  .live-rank-card { padding: 12px; }
  .fisikah-info .info-card { min-height: 96px; }
  .fisikah-info .info-card p { font-size: 0.82rem; }
  .setup-panel h1,
  .leaderboard-main h1,
  .lobby-main h1 { font-size: 2.55rem; }
  .setup-panel .lead,
  .join-panel .lead { font-size: 0.86rem; }
  .choice-section { margin: 8px 0; }
  .book-card { min-height: 56px; }
  .difficulty-card { min-height: 58px; }
  .qr-wrap { width: min(200px, 38svh, 100%); }
  .game-hud h1 { font-size: 1.35rem; }
  .answer-option { min-height: 72px; }
  .ranking-list li { padding: 9px 10px; }
}

@media (max-width: 900px) {
  .home-shell {
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .fisikah-hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-stage {
    display: none;
  }
  .mode-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .mode-button strong {
    font-size: 0.88rem;
  }
  .mode-button span {
    font-size: 0.74rem;
  }
  .fisikah-info {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .fisikah-info .info-card p {
    display: none;
  }
  .lobby-layout,
  .play-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .players-panel {
    max-height: 22svh;
  }
  .player-list {
    max-height: 12svh;
  }
  .side-panel {
    grid-template-columns: 1fr 1fr;
  }
  .side-panel .ranking-list,
  .achievement-list {
    max-height: 13svh;
  }
}

@media (max-width: 640px) {
  .brand-title { font-size: 3.25rem; }
  .hero-main { font-size: 1.12rem; }
  .hero-lead { font-size: 0.86rem; }
  .fisikah-hero .home-logo { width: 52px; height: 52px; }
  .mode-actions { gap: 7px; }
  .mode-button {
    min-height: 56px;
    padding: 8px;
  }
  .fisikah-info {
    gap: 7px;
  }
  .fisikah-info .info-card {
    min-height: 76px;
    padding: 10px 8px;
  }
  .fisikah-info .card-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 6px;
  }
  .fisikah-info h2 {
    font-size: 0.8rem;
    line-height: 1.15;
  }
  .setup-panel h1,
  .leaderboard-main h1,
  .lobby-main h1 {
    font-size: 2rem;
  }
  .setup-panel .official-logo,
  .lobby-main .official-logo,
  .leaderboard-main .official-logo,
  .practice-hero .official-logo {
    width: 46px;
    height: 46px;
  }
  .choice-card,
  .section-toggle {
    min-height: 40px;
  }
  .book-card,
  .difficulty-card {
    min-height: 52px;
  }
  .difficulty-card > span {
    font-size: 0.82rem;
  }
  .difficulty-card small {
    font-size: 0.68rem;
  }
  .answer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .answer-option {
    min-height: 64px;
    font-size: 0.86rem;
  }
  .side-panel,
  .practice-side {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px), (max-height: 620px) {
  .lead,
  .hero-lead,
  .setup-panel .lead {
    display: none;
  }
  .hero-kicker {
    margin-bottom: 6px;
  }
  .page-brand-chip {
    display: none;
  }
  .choice-section > span {
    font-size: 0.78rem;
  }
  .chapter-panel:not(.is-collapsed) {
    max-height: 24svh;
  }
}

/* Reserva inferior para que el footer fijo no tape tarjetas ni paneles. */
:root {
  --footer-space: 34px;
}

.home-shell,
.center-shell,
.leaderboard-shell,
.lobby-layout,
.play-layout,
.practice-shell {
  padding-block-end: var(--footer-space);
}

.setup-panel,
.players-panel {
  max-height: calc(100svh - var(--footer-space) - 20px);
}

.home-shell {
  gap: 8px;
}

.fisikah-info .info-card {
  min-height: 106px;
}

@media (max-width: 640px), (max-height: 760px) {
  :root {
    --footer-space: 30px;
  }

  .site-footer a {
    font-size: 0.62rem;
  }

  .fisikah-info .info-card {
    min-height: 84px;
  }
}

/* Reordenamiento del modo práctica: pregunta y forja arriba; respuestas abajo. */
.practice-game {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  grid-template-rows: auto;
  column-gap: 18px;
  align-items: stretch;
}

.practice-composite-panel {
  overflow: hidden;
  padding: clamp(16px, 2.5vw, 24px);
  border-color: rgba(36, 214, 199, 0.24);
  background:
    radial-gradient(circle at 16% 14%, rgba(36, 214, 199, 0.14), transparent 24rem),
    radial-gradient(circle at 88% 12%, rgba(124, 92, 255, 0.16), transparent 22rem),
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(17, 24, 39, 0.95), rgba(42, 28, 39, 0.95) 58%, rgba(47, 39, 23, 0.9));
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
  box-shadow: inset 0 0 80px rgba(0,0,0,0.34), var(--shadow);
}

.practice-question-panel {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 10px;
  min-height: 0;
}

.practice-question-panel .practice-hud,
.practice-question-panel .practice-arena,
.practice-question-panel .practice-feedback {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.practice-question-panel .practice-hud::after {
  display: none;
}

.practice-hud {
  min-height: 0;
  align-content: center;
  padding: 0;
}

.practice-game .practice-side {
  display: contents;
}

.practice-game .streak-forge {
  grid-column: 2;
  grid-row: 1;
  height: 100%;
  min-height: 0;
  align-content: center;
  border-left: 1px solid rgba(255,255,255,0.1);
  border-radius: 0;
  padding-left: clamp(16px, 2vw, 24px);
  background: transparent;
  box-shadow: none;
}

.practice-game .practice-arena {
  min-height: 0;
  padding: 0;
  align-items: start;
}

.practice-game .practice-feedback {
  padding: 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 10px;
  gap: 8px;
}

.practice-game .answer-grid {
  width: min(1040px, 100%);
  gap: 10px;
}

.practice-game .answer-option {
  min-height: 76px;
  padding: 12px 16px;
}

@media (max-width: 1180px), (max-height: 760px) {
  .practice-shell:has(.practice-game:not(.hidden)) {
    gap: 8px;
    width: min(1120px, calc(100% - 20px));
    padding-block: 8px;
  }

  .practice-shell:has(.practice-game:not(.hidden)) .practice-hero {
    padding: 10px 16px;
  }

  .practice-game {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 8px 12px;
  }

  .practice-question-panel {
    grid-template-rows: auto auto auto;
  }

  .practice-hud {
    padding: 0;
  }

  .practice-hud h2 {
    font-size: clamp(1.45rem, 3vw, 2.15rem);
  }

  .practice-game .streak-forge {
    padding: 0 0 0 16px;
  }

  .practice-game .practice-arena {
    padding: 0;
  }

  .practice-game .answer-grid {
    gap: 10px;
  }

  .practice-game .answer-option {
    min-height: 70px;
    padding: 12px 14px;
    font-size: clamp(1rem, 2.1vw, 1.35rem);
  }

  .practice-game .armor-avatar {
    width: 164px;
    height: 184px;
    transform: scale(0.9);
    transform-origin: center;
  }
}

@media (max-width: 900px) {
  .practice-game {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    row-gap: 10px;
  }

  .practice-question-panel {
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    grid-template-rows: auto auto auto;
  }

  .practice-game .streak-forge {
    grid-column: 1;
    grid-row: 2;
    min-height: 240px;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-left: 0;
    padding: 14px 0 0;
  }
}

/* Mini escenario del hero para tablets y vistas angostas. */
@media (max-width: 900px) {
  .fisikah-hero {
    align-content: center;
    gap: 16px;
  }

  .hero-copy {
    max-width: 100%;
  }

  .hero-stage {
    display: block;
    width: min(560px, 100%);
    height: 300px;
    min-height: 0;
    justify-self: center;
    margin: 8px auto 0;
  }

  .live-rank-card {
    width: min(220px, calc(100% - 24px));
    top: 12px;
    right: 12px;
    left: auto;
    padding: 10px;
  }

  .live-rank-card > span {
    font-size: 0.66rem;
  }

  .live-rank-card ol {
    gap: 6px;
    margin-top: 8px;
  }

  .live-rank-card li {
    min-height: 28px;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 6px;
    padding: 4px 6px;
    font-size: 0.72rem;
  }

  .live-rank-card b {
    width: 20px;
    height: 20px;
  }

  .game-avatar {
    width: 112px;
    height: 112px;
    bottom: 46px;
  }

  .avatar-eye {
    width: 16px;
    height: 16px;
    top: 40px;
  }

  .avatar-eye.left { left: 32px; }
  .avatar-eye.right { right: 32px; }

  .avatar-smile {
    width: 40px;
    bottom: 28px;
  }

  .falling-chip {
    min-width: 82px;
    min-height: 34px;
    font-size: 0.78rem;
  }

  .combo-burst {
    left: 16px;
    bottom: 24px;
    min-width: 98px;
    min-height: 38px;
    font-size: 0.8rem;
  }

  .score-pop {
    right: 22px;
    bottom: 72px;
    min-width: 56px;
    min-height: 56px;
    font-size: 0.82rem;
  }
}

@media (max-width: 640px) {
  .fisikah-hero {
    gap: 12px;
  }

  .hero-stage {
    height: 240px;
  }

  .live-rank-card {
    width: 190px;
    top: 9px;
    right: 9px;
    padding: 8px;
  }

  .live-rank-card li {
    font-size: 0.66rem;
  }

  .game-avatar {
    width: 88px;
    height: 88px;
    bottom: 40px;
  }

  .avatar-eye {
    width: 12px;
    height: 12px;
    top: 32px;
  }

  .avatar-eye.left { left: 25px; }
  .avatar-eye.right { right: 25px; }

  .avatar-smile {
    width: 32px;
    bottom: 22px;
    border-bottom-width: 5px;
  }

  .falling-chip {
    min-width: 70px;
    min-height: 30px;
    font-size: 0.7rem;
  }

  .combo-burst {
    left: 10px;
    min-width: 84px;
    min-height: 32px;
    font-size: 0.7rem;
  }

  .score-pop {
    right: 12px;
    bottom: 62px;
    min-width: 46px;
    min-height: 46px;
    font-size: 0.72rem;
  }
}

/* Restauración global de scroll: las páginas pueden crecer y desplazarse verticalmente. */
html,
body {
  width: 100%;
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  min-height: 100svh;
}

.home-shell,
.center-shell,
.leaderboard-shell,
.lobby-layout,
.play-layout,
.practice-shell {
  height: auto;
  min-height: 100svh;
  overflow: visible;
  padding-block-end: calc(var(--footer-space, 34px) + 18px);
}

.setup-panel,
.players-panel,
.leaderboard-main,
.lobby-main,
.practice-summary,
.end-card {
  max-height: none;
}

.site-footer {
  position: static;
  margin: -28px auto 10px;
  padding: 0 12px;
}

.play-body {
  overflow-x: hidden;
  overflow-y: auto;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* FISIKAH responsive audit hardening - 2026-05-22 */
html {
  min-width: 320px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
}

*, *::before, *::after {
  min-width: 0;
}

button,
input,
a,
.choice-card,
.section-toggle {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
a:focus-visible,
.choice-card:focus-within,
.section-toggle:focus-visible {
  outline: 3px solid rgba(36, 214, 199, .32);
  outline-offset: 3px;
}

input {
  font-size: 16px;
}

img,
svg,
canvas {
  max-width: 100%;
}

.home-shell,
.center-shell,
.leaderboard-shell,
.lobby-layout,
.play-layout,
.practice-shell,
.fisikah-hero,
.hero-copy,
.setup-panel,
.lobby-main,
.players-panel,
.game-column,
.game-hud,
.game-arena,
.side-panel,
.practice-game,
.practice-composite-panel,
.practice-question-panel,
.practice-side,
.practice-summary,
.summary-showcase,
.overlay,
.end-card {
  min-width: 0;
}

.button,
.mini-button,
.choice-card,
.section-toggle,
.control-btn,
.answer-option,
.stacked-form input {
  min-height: 44px;
}

.button {
  text-align: center;
}

.glass-panel,
.hero-panel,
.setup-panel,
.lobby-main,
.players-panel,
.game-hud,
.side-panel .glass-panel,
.practice-composite-panel,
.practice-summary,
.end-card {
  overflow: hidden;
}

.ranking-list,
.player-list,
.achievement-list,
.chapter-panel:not(.is-collapsed) {
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

.brand-title,
.hero-main,
.game-hud h1,
.practice-hud h2,
.setup-panel h1,
.leaderboard-main h1,
.lobby-main h1,
.answer-option,
.choice-card,
.join-url,
.ranking-list li {
  overflow-wrap: anywhere;
}

.mode-button,
.answer-option,
.choice-card {
  -webkit-tap-highlight-color: transparent;
}

.site-footer {
  width: min(100% - 20px, 880px);
}

@media (min-width: 1600px) {
  .home-shell,
  .lobby-layout,
  .play-layout,
  .practice-shell {
    width: min(1440px, calc(100% - 64px));
  }

  .fisikah-hero {
    min-height: 760px;
  }
}

@media (max-width: 1100px) {
  .mode-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .home-shell,
  .center-shell,
  .leaderboard-shell,
  .lobby-layout,
  .play-layout,
  .practice-shell {
    width: min(100% - 24px, 1120px);
  }

  .side-panel,
  .practice-side {
    grid-template-columns: 1fr;
  }

  .players-panel,
  .side-panel .glass-panel {
    max-height: none;
  }

  .game-column {
    grid-template-rows: auto minmax(360px, auto);
  }

  .game-arena {
    min-height: clamp(360px, 58svh, 620px);
  }
}

@media (max-width: 640px) {
  .home-shell,
  .center-shell,
  .leaderboard-shell,
  .lobby-layout,
  .play-layout,
  .practice-shell {
    width: min(100% - 18px, 1120px);
  }

  .hero-panel,
  .glass-panel,
  .setup-panel,
  .lobby-main,
  .players-panel,
  .leaderboard-main,
  .practice-summary,
  .end-card {
    padding: 18px;
  }

  .fisikah-hero {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .brand-title {
    font-size: clamp(2.65rem, 17vw, 3.45rem);
  }

  .mode-actions {
    grid-template-columns: 1fr;
  }

  .mode-button {
    min-height: 58px;
  }

  .time-grid,
  .book-grid,
  .difficulty-grid,
  .chapter-grid {
    grid-template-columns: 1fr;
  }

  .choice-card {
    border-radius: 8px;
  }

  .section-toggle {
    min-height: 52px;
  }

  .lobby-layout,
  .play-layout {
    gap: 12px;
  }

  .game-hud {
    padding: 14px;
  }

  .hud-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .pill {
    justify-content: center;
    padding-inline: 8px;
    font-size: .78rem;
  }

  .answer-grid,
  .practice-game .answer-grid {
    grid-template-columns: 1fr;
  }

  .answer-option,
  .practice-game .answer-option {
    min-height: 68px;
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .answer-key {
    width: 32px;
    height: 32px;
  }

  .game-arena {
    min-height: 430px;
  }

  .side-panel,
  .practice-side {
    grid-template-columns: 1fr;
  }

  .overlay {
    padding: 12px;
  }

  .end-card {
    max-height: calc(100dvh - 24px);
    overflow: auto;
  }
}

@media (max-width: 390px) {
  .hero-panel,
  .glass-panel,
  .setup-panel,
  .lobby-main,
  .players-panel,
  .leaderboard-main,
  .practice-summary,
  .end-card {
    padding: 14px;
  }

  .brand-title {
    font-size: 2.5rem;
  }

  .setup-panel h1,
  .leaderboard-main h1,
  .lobby-main h1 {
    font-size: 1.8rem;
  }

  .hud-stats {
    grid-template-columns: 1fr;
  }

  .answer-option {
    font-size: .9rem;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .home-shell,
  .center-shell,
  .leaderboard-shell,
  .lobby-layout,
  .play-layout,
  .practice-shell {
    min-height: auto;
  }

  .hero-stage {
    display: none;
  }

  .fisikah-hero {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .game-arena {
    min-height: 78svh;
  }

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.fisikah-hero.hero-panel {
  height: auto;
  min-height: clamp(560px, 82svh, 760px);
  overflow: visible;
}

@media (max-width: 900px), (orientation: landscape) and (max-height: 560px) {
  .fisikah-hero.hero-panel {
    min-height: auto;
  }
}
