:root {
  color-scheme: dark;
  --ink: #f5f8ff;
  --muted: #9bacbf;
  --deep: #0a2340;
  --navy: #10385e;
  --panel: #154568;
  --panel-2: #1b527a;
  --line: rgba(198, 225, 247, 0.22);
  --teal: #2dd4bf;
  --teal-soft: rgba(45, 212, 191, 0.15);
  --gold: #f8c85a;
  --green: #42d392;
  --red: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--deep); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 14%, rgba(45, 212, 191, 0.20), transparent 27%),
    radial-gradient(circle at 88% 10%, rgba(93, 167, 224, 0.35), transparent 32%),
    radial-gradient(circle at 52% 92%, rgba(100, 72, 170, 0.20), transparent 30%),
    linear-gradient(145deg, #123b60 0%, var(--deep) 52%, #0d3153 100%);
  background-attachment: fixed;
}

button { font: inherit; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.app-shell {
  width: min(1160px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 28px max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  border: 0;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 13px;
  padding: 0;
  cursor: pointer;
}

.brand-logo { width: 66px; height: 66px; display: block; flex: 0 0 auto; border-radius: 16px; box-shadow: 0 10px 28px rgba(0,0,0,.4); }

.brand-name { font-weight: 750; letter-spacing: -0.02em; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.score-button,
.install-button,
.reset-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(12, 32, 57, 0.72);
  padding: 11px 17px;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
}
.install-button { color: var(--teal); }
.install-button span:first-child { font-size: 1.12rem; font-weight: 900; }
.score-button span:first-child { color: var(--gold); }
.reset-button span:first-child { color: var(--red); font-size: 1.08rem; font-weight: 900; }
.score-button:hover,
.install-button:hover,
.reset-button:hover { border-color: var(--teal); transform: translateY(-2px); }
.install-button.installed { display: none; }

.wqc-balance {
  min-height: 43px;
  border: 1px solid rgba(248, 200, 90, .36);
  border-radius: 999px;
  background: rgba(248, 200, 90, .08);
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
}
.wqc-balance strong { font-size: 1.05rem; }
.wqc-balance small { color: var(--muted); font-size: .7rem; font-weight: 850; letter-spacing: .06em; }

main { flex: 1; display: flex; }
.screen { width: 100%; flex: 1; }
.hidden { display: none !important; }

.home-screen {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(520px, 1.14fr);
  grid-template-rows: 1fr auto;
  gap: 48px 64px;
  align-items: center;
  padding: 5vh 0 18px;
  position: relative;
}

.continent-progress-heading h1,
.section-heading h2,
.result-card h2,
.dialog-head h2 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 5rem);
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.continent-progress-card { align-self: stretch; display: grid; align-content: center; padding: clamp(24px, 4vw, 42px); border: 1px solid var(--line); border-radius: 4px 32px 4px 32px; background: linear-gradient(150deg, rgba(21,69,104,.94), rgba(7,25,45,.96)); box-shadow: var(--shadow); }
.home-intro { margin: 0 0 30px; color: var(--ink); font-size: clamp(1.02rem, 2vw, 1.25rem); line-height: 1.55; }
.continent-progress-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.continent-progress-heading h1 { font-size: clamp(2rem, 4vw, 3.4rem); }
.continent-progress-heading .eyebrow { margin-bottom: 8px; }
.continent-progress-heading > strong { color: var(--gold); font-size: clamp(2.2rem, 5vw, 3.8rem); line-height: 1; letter-spacing: -.06em; }
.continent-progress-chart { display: grid; gap: 16px; }
.continent-progress-row { display: grid; grid-template-columns: minmax(82px, 110px) 1fr 45px; align-items: center; gap: 12px; }
.continent-progress-label { display: grid; gap: 2px; }
.continent-progress-label strong { font-size: .92rem; }
.continent-progress-label span { color: var(--muted); font-size: .72rem; }
.continent-progress-track { height: 13px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.09); box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
.continent-progress-track span { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--continent-color); box-shadow: 0 0 18px color-mix(in srgb, var(--continent-color) 45%, transparent); transition: width 420ms ease; }
.continent-progress-percent { color: var(--continent-color); text-align: right; font-size: .9rem; }

.eyebrow {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  display: inline-block;
  margin-bottom: 14px;
}

.mode-grid { display: grid; gap: 16px; }

.mode-card {
  width: 100%;
  min-height: 152px;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 4px 28px 4px 28px;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(16, 42, 72, 0.96), rgba(9, 27, 50, 0.96));
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: transform 180ms ease, border-color 180ms ease;
}
.mode-card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -96px;
  top: -90px;
  border: 28px solid rgba(45, 212, 191, 0.07);
  border-radius: 50%;
}
.mode-card:hover { transform: translateY(-4px); border-color: rgba(45, 212, 191, 0.58); }
.mode-number { color: var(--teal); font-size: 0.8rem; font-weight: 900; letter-spacing: 0.14em; align-self: start; }
.mode-content { display: grid; gap: 10px; }
.mode-content strong { font-size: clamp(1.6rem, 3vw, 2.25rem); letter-spacing: -0.04em; }
.mode-content small { color: var(--muted); font-size: 0.92rem; line-height: 1.4; }
.mode-arrow { font-size: 2rem; color: var(--teal); z-index: 1; }

.training-card { background: linear-gradient(135deg, rgba(20, 64, 78, 0.96), rgba(9, 31, 48, 0.96)); }
.challenge-card { background: linear-gradient(135deg, rgba(73, 48, 100, .96), rgba(18, 27, 54, .96)); }
.duel-card { background: linear-gradient(135deg, rgba(20, 94, 91, .94), rgba(8, 36, 62, .96)); }

.home-stats {
  grid-column: 1 / -1;
  display: flex;
  gap: 42px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.home-stats div { display: flex; align-items: baseline; gap: 8px; }
.home-stats strong { font-size: 1.25rem; color: var(--gold); }
.home-stats span { color: var(--muted); font-size: 0.86rem; }
.signature {
  grid-column: 1 / -1;
  justify-self: end;
  position: static;
  margin-top: -28px;
  padding: 12px 4px 2px;
  color: rgba(255,255,255,.62);
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 700;
  z-index: 2;
}

.section-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  align-items: center;
  margin: 46px 0 38px;
}
.section-heading h2 { font-size: clamp(2rem, 4.5vw, 3.8rem); }
.section-heading .eyebrow { margin-bottom: 8px; }

.back-button,
.quit-button,
.dialog-head button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
  font-size: 1.6rem;
  cursor: pointer;
}
.back-button:hover, .quit-button:hover, .dialog-head button:hover { border-color: var(--teal); }

.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding-bottom: 35px; }
.choice-card {
  min-height: 146px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  background: rgba(12, 32, 57, 0.78);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}
.choice-card:hover { transform: translateY(-3px); background: var(--panel-2); border-color: var(--teal); }
.choice-card strong { font-size: 1.22rem; }
.choice-card small { color: var(--muted); line-height: 1.4; }
.choice-code { color: var(--teal); font-weight: 900; letter-spacing: .12em; font-size: .76rem; }
.challenge-intro { margin: -16px 0 28px 70px; color: var(--muted); line-height: 1.55; }
.challenge-grid .challenge-choice { min-height: 190px; position: relative; }
.challenge-status {
  position: absolute;
  top: 18px;
  right: 18px;
  border: 1px solid rgba(248, 200, 90, .34);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--gold);
  background: rgba(248, 200, 90, .08);
  font-size: .76rem;
  font-weight: 850;
}
.challenge-status.joined { color: var(--teal); border-color: rgba(45, 212, 191, .35); background: var(--teal-soft); }

.levels-heading { grid-template-columns: auto 1fr auto; }
.progress-summary { text-align: right; color: var(--muted); }
.progress-summary strong { display: block; color: var(--gold); font-size: 1.6rem; }
.difficulty-legend {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  padding: 14px 0 20px;
  border-top: 1px solid var(--line);
}
.legend-stars { color: var(--gold); white-space: nowrap; }
.levels-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 9px; padding-bottom: 35px; }
.level-button {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  color: var(--ink);
  display: grid;
  place-items: center;
  gap: 1px;
  cursor: pointer;
  position: relative;
}
.level-button:hover:not(:disabled) { border-color: var(--teal); background: var(--panel-2); }
.level-button:disabled { opacity: .34; cursor: not-allowed; }
.level-button.current { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.level-button.completed { background: var(--teal-soft); }
.level-button strong { font-size: 1.08rem; }
.level-button small { color: var(--gold); font-size: .62rem; letter-spacing: -1px; }
.level-lock { font-size: .8rem; color: var(--muted); }
.challenge-levels-grid { grid-template-columns: repeat(5, 1fr); }
.challenge-levels-grid .level-button { aspect-ratio: 1.7; }
.challenge-levels-grid .level-button small { letter-spacing: 0; }

.quiz-screen { padding: 35px 0 24px; max-width: 880px; margin: 0 auto; }
.quiz-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; }
.quiz-context { display: grid; gap: 3px; }
.quiz-context span, .live-score span { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .11em; }
.quiz-context strong { font-size: 1.05rem; }
.live-score { text-align: right; display: grid; }
.live-score strong { color: var(--gold); font-size: 1.65rem; line-height: 1; }
.progress-track { height: 5px; background: rgba(255,255,255,.08); margin: 24px 0 0; overflow: hidden; border-radius: 5px; }
.progress-track div { height: 100%; width: 10%; background: var(--teal); transition: width 260ms ease; }

.question-panel { padding: clamp(42px, 8vh, 82px) 0 30px; text-align: center; }
.question-kicker { color: var(--teal); font-weight: 800; text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; }
.question-panel h2 { margin: 18px auto 38px; max-width: 760px; font-size: clamp(1.75rem, 4.5vw, 3.15rem); line-height: 1.12; letter-spacing: -.045em; }
.answers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.answer-button {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(12, 32, 57, .88);
  color: var(--ink);
  padding: 17px 20px;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}
.answer-button:hover:not(:disabled) { border-color: var(--teal); transform: translateY(-2px); }
.answer-index { color: var(--muted); font-weight: 850; }
.answer-text { font-size: 1rem; font-weight: 650; }
.answer-button.correct { border-color: var(--green); background: rgba(66, 211, 146, .18); }
.answer-button.wrong { border-color: var(--red); background: rgba(251, 113, 133, .17); }
.answer-button.erased { opacity: .17; pointer-events: none; }
.feedback { min-height: 25px; margin: 18px 0 0; font-weight: 750; }
.feedback.good { color: var(--green); }
.feedback.bad { color: var(--red); }

.answer-fact-toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  width: min(520px, calc(100% - 28px));
  transform: translateX(-50%);
  display: grid;
  gap: 5px;
  padding: 17px 20px;
  border: 1px solid rgba(45, 212, 191, .48);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(11, 42, 65, .98), rgba(4, 18, 34, .98));
  box-shadow: 0 20px 70px rgba(0, 0, 0, .55), 0 0 28px rgba(45, 212, 191, .12);
  pointer-events: none;
  animation: answer-fact-in 180ms ease-out;
}
.answer-fact-toast small { color: var(--teal); font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.answer-fact-toast strong { color: var(--ink); font-size: 1.2rem; }
.answer-fact-toast span { color: var(--muted); line-height: 1.35; }
@keyframes answer-fact-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.joker-dock { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.joker-dock button {
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: rgba(8, 25, 45, .9);
  padding: 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}
.joker-dock button:hover:not(:disabled) { border-color: var(--gold); }
.joker-dock button:disabled { opacity: .3; cursor: not-allowed; }
.joker-icon { grid-row: 1 / 3; width: 36px; height: 36px; border-radius: 50%; background: rgba(248,200,90,.13); color: var(--gold); display: grid; place-items: center; font-weight: 900; }
.joker-dock small { color: var(--muted); }

.result-screen { display: grid; place-items: center; padding: 30px 0; }
.result-card { width: min(620px, 100%); text-align: center; background: linear-gradient(150deg, var(--panel-2), var(--navy)); border: 1px solid var(--line); border-radius: 4px 38px 4px 38px; padding: clamp(30px, 7vw, 60px); box-shadow: var(--shadow); }
.result-ring { width: 126px; height: 126px; border: 8px solid var(--teal); border-radius: 50%; margin: 0 auto 30px; display: flex; align-items: baseline; justify-content: center; padding-top: 35px; box-shadow: 0 0 40px rgba(45,212,191,.15); }
.result-ring strong { font-size: 2.7rem; line-height: 1; }
.result-ring span { color: var(--muted); }
.result-card h2 { font-size: clamp(2rem, 5vw, 3.2rem); }
.result-card p { color: var(--muted); line-height: 1.55; margin: 18px auto 30px; max-width: 460px; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.primary-button, .secondary-button, .danger-button { border-radius: 999px; padding: 13px 21px; cursor: pointer; font-weight: 800; }
.primary-button { background: var(--teal); color: #04201d; border: 1px solid var(--teal); }
.secondary-button { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.danger-button { background: var(--red); color: #2a0710; border: 1px solid var(--red); }
.danger-outline { color: #ffd3da; border-color: rgba(251,113,133,.55); }
.primary-button:disabled { opacity: .38; cursor: not-allowed; }

dialog {
  color: var(--ink);
  background: linear-gradient(145deg, #1b527a, #0c2d4d);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(1, 6, 14, .78); backdrop-filter: blur(6px); }
.scores-dialog { width: min(650px, calc(100% - 28px)); max-height: min(740px, calc(100dvh - 30px)); border-radius: 24px; padding: 0; overflow: hidden; }
.dialog-head { padding: 27px; display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 2.1rem; }
.dialog-head .eyebrow { margin-bottom: 6px; }
.score-tabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 13px 27px 0; gap: 7px; }
.score-tabs button { border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; padding: 12px; cursor: pointer; }
.score-tabs button.active { color: var(--ink); border-color: var(--teal); }
#scores-content { padding: 22px 27px 30px; overflow-y: auto; max-height: 520px; }
.score-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.score-stat { background: rgba(255,255,255,.045); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.score-stat span { color: var(--muted); display: block; font-size: .8rem; margin-bottom: 5px; }
.score-stat strong { font-size: 1.45rem; color: var(--gold); }
.score-list { display: grid; gap: 8px; }
.score-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.score-row span { color: var(--muted); }
.score-empty { color: var(--muted); padding: 35px 0; text-align: center; }

.confirm-dialog { width: min(430px, calc(100% - 28px)); border-radius: 22px; padding: 28px; }
.confirm-dialog h2 { margin-top: 0; }
.confirm-dialog p { color: var(--muted); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.install-dialog { width: min(540px, calc(100% - 28px)); border-radius: 24px; padding: 0; }
.install-copy { padding: 24px 28px 30px; color: var(--muted); line-height: 1.6; }
.install-copy p { margin-top: 0; }
.install-copy ol { margin: 18px 0 0; padding-left: 22px; }
.install-copy strong { color: var(--ink); }
.data-error { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); padding: 14px 18px; border-radius: 12px; background: var(--red); color: #28070e; font-weight: 800; }

.profile-button {
  border: 1px solid rgba(45,212,191,.35); border-radius: 999px; color: var(--ink); background: rgba(45,212,191,.08);
  padding: 10px 14px; display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-weight: 750;
}
.profile-icon { display: block; width: 22px; height: 22px; flex: 0 0 22px; color: #fff; }
.duel-heading { grid-template-columns: auto 1fr auto; }
.notify-button { white-space: nowrap; }
.duel-layout { display: grid; grid-template-columns: minmax(280px, .72fr) minmax(360px, 1.28fr); gap: 24px; padding-bottom: 35px; }
.duel-tools { display: grid; gap: 16px; align-content: start; }
.duel-create-card, .duel-list-section, .loading-card {
  background: rgba(12,32,57,.8); border: 1px solid var(--line); border-radius: 20px; padding: 24px;
}
.duel-create-card { align-self: start; display: grid; gap: 14px; }
.duel-create-card h3, .duel-list-section h3 { margin: 0; font-size: 1.35rem; }
.duel-card-copy { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.duel-create-card label, .profile-dialog label { color: var(--muted); font-size: .84rem; font-weight: 750; }
.duel-create-card > input, .friend-add-form input, .profile-dialog input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; background: rgba(4,13,27,.72); color: var(--ink); padding: 13px 14px; font: inherit;
}
.duel-create-card fieldset { margin: 2px 0; padding: 0; border: 0; }
.duel-create-card legend { color: var(--muted); font-size: .84rem; font-weight: 750; margin-bottom: 9px; }
.duel-difficulties { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.duel-difficulties label { position: relative; cursor: pointer; }
.duel-difficulties input { position: absolute; opacity: 0; }
.duel-difficulties span { display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 12px; padding: 11px; color: var(--ink); }
.duel-difficulties small { color: var(--muted); font-weight: 500; }
.duel-difficulties input:checked + span { border-color: var(--teal); background: var(--teal-soft); }
.form-message { min-height: 1.3em; margin: 0; color: var(--gold); font-size: .88rem; }
.request-expiry { color: var(--muted); line-height: 1.45; }
.friend-add-form { display: grid; gap: 10px; }
.friend-add-form > div { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.friends-card { gap: 12px; }
.friend-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.friend-row > div { display: flex; align-items: center; gap: 7px; }
.friend-row button { padding: 8px 11px; }
.friend-remove { width: 34px; height: 34px; border: 1px solid rgba(251,113,133,.25); border-radius: 9px; color: var(--red); background: transparent; cursor: pointer; font-size: 1.2rem; }
.friend-remove:hover { background: rgba(251,113,133,.1); }
.duel-lists { display: grid; gap: 14px; align-content: start; }
.duel-list-section { padding: 18px; }
.duel-list-section h3 { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.duel-list-section h3 span { min-width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--teal-soft); color: var(--teal); font-size: .82rem; }
.duel-list-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.duel-list-card > div:first-child { display: grid; gap: 3px; }
.duel-list-card span, .duel-empty { color: var(--muted); font-size: .82rem; }
.duel-empty { margin: 0; padding: 7px 0; }
.duel-card-actions { display: flex; gap: 7px; }
.duel-card-actions button { padding: 9px 13px; }
.duel-card-safety { border: 0; background: transparent; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.duel-card-safety:hover { color: #ffd3da; }
.error-card { color: var(--red); }
.duel-score { display: flex; gap: 9px; align-items: baseline; font-size: 1.35rem; font-weight: 900; color: var(--gold); }
.duel-score small { color: var(--muted); }
.duel-reveal { margin: 18px auto 0; max-width: 570px; padding: 15px 18px; border: 1px solid rgba(248,200,90,.35); border-radius: 13px; background: rgba(248,200,90,.08); display: grid; gap: 5px; }
.duel-reveal span { color: var(--muted); font-size: .82rem; }
#duel-next { display: block; margin: 20px auto 0; }
.duel-joker-dock { grid-template-columns: minmax(190px, 290px); justify-content: center; }
.duel-result-screen { display: grid; place-items: center; padding: 36px 0; }
.duel-result-card { position: relative; overflow: hidden; }
.duel-result-card::before { content: ""; position: absolute; width: 210px; height: 210px; border-radius: 50%; top: -130px; right: -80px; background: rgba(45,212,191,.13); }
.duel-result-state { display: grid; place-items: center; width: 112px; min-height: 112px; margin: 0 auto 28px; padding: 12px; border: 7px solid var(--gold); border-radius: 50%; color: var(--gold); font-weight: 950; font-size: 1.08rem; text-transform: uppercase; letter-spacing: .05em; }
.duel-result-card.won .duel-result-state { color: var(--green); border-color: var(--green); box-shadow: 0 0 38px rgba(66,211,146,.2); }
.duel-result-card.lost .duel-result-state { color: var(--red); border-color: var(--red); box-shadow: 0 0 38px rgba(251,113,133,.17); }
.duel-result-card.draw .duel-result-state { color: var(--gold); border-color: var(--gold); box-shadow: 0 0 38px rgba(248,200,90,.17); }
.duel-safety-action { margin-top: 20px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .8rem; text-decoration: underline; text-underline-offset: 3px; }
.duel-safety-action:hover { color: #ffd3da; }
.duel-final-score { margin: 24px auto 2px; color: var(--gold); font-size: clamp(2.2rem, 7vw, 4.2rem); font-weight: 950; letter-spacing: -.06em; }
.review-answers-grid .answer-button { cursor: default; grid-template-columns: 30px 1fr auto; }
.review-answers-grid .answer-button:hover { transform: none; }
.review-answers-grid .opponent-choice { box-shadow: inset 0 0 0 2px rgba(248,200,90,.58); }
.answer-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.answer-badge { padding: 4px 7px; border-radius: 999px; font-size: .67rem; font-weight: 900; white-space: nowrap; }
.answer-badge.mine { color: #04201d; background: var(--teal); }
.answer-badge.opponent { color: #332400; background: var(--gold); }
.duel-review-legend { margin: 18px auto 0; max-width: 740px; display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.duel-review-legend > span { padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .8rem; background: rgba(255,255,255,.045); }
.duel-review-legend strong { color: var(--ink); }
.legend-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; }
.correct-dot { background: var(--green); }
.review-navigation { display: flex; justify-content: center; gap: 10px; margin-top: 25px; }
.review-navigation button:disabled { opacity: .35; cursor: not-allowed; }
.profile-dialog { width: min(480px, calc(100% - 28px)); border-radius: 24px; padding: 28px; }
#profile-setup-dialog[open] { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; display: grid; place-items: center; overflow-y: auto; background: radial-gradient(circle at 50% 18%, rgba(45,107,145,.42), transparent 30%), radial-gradient(circle at 18% 88%, rgba(255,51,71,.13), transparent 27%), linear-gradient(155deg, #07182a, #010205 62%); }
#profile-setup-dialog::backdrop { background: #010205; }
.profile-launch-card { position: relative; width: min(540px, 100%); padding: clamp(28px, 6vw, 48px); text-align: center; border: 1px solid rgba(255,255,255,.17); border-radius: 8px 38px 8px 38px; background: linear-gradient(150deg, rgba(21,69,104,.78), rgba(1,2,5,.94)); box-shadow: 0 32px 100px rgba(0,0,0,.55); overflow: hidden; }
.profile-launch-card::before { content: ""; position: absolute; width: 210px; height: 210px; top: -145px; right: -95px; border: 24px solid rgba(255,214,92,.08); border-radius: 50%; }
.profile-launch-card .profile-logo { width: 140px; height: 140px; margin: 0 auto 18px; border-radius: 31px; box-shadow: 0 22px 58px rgba(0,0,0,.55); }
.profile-launch-name { display: block; margin-bottom: 30px; color: var(--ink); font-size: 1.05rem; letter-spacing: .08em; text-transform: uppercase; }
.profile-launch-card > .eyebrow { display: block; margin: 0 0 8px; }
.profile-launch-card h2 { font-size: clamp(2rem, 7vw, 3rem); }
.profile-launch-card > p { max-width: 440px; margin: 18px auto 0; }
.profile-launch-card form { text-align: left; }
.profile-launch-card form .primary-button { width: 100%; margin-top: 4px; }
.profile-launch-card .terms-check { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 9px; font-weight: 500; line-height: 1.45; }
.profile-launch-card .terms-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--teal); }
.profile-launch-card .terms-check a { color: var(--teal); text-underline-offset: 3px; }
.profile-dialog > .eyebrow { display: block; margin: 18px 0 6px; }
.profile-dialog h2 { margin: 0; font-size: 2rem; }
.profile-dialog p, .privacy-note { color: var(--muted); line-height: 1.5; }
.profile-dialog form { display: grid; gap: 12px; margin: 22px 0; }
.profile-dialog .dialog-head { padding: 0 0 20px; margin-bottom: 20px; }
.profile-status { display: flex; justify-content: space-between; gap: 15px; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 18px 0; }
.profile-status span { color: var(--muted); }
.profile-data-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 20px; }
.profile-data-actions a { color: var(--teal); font-size: .86rem; text-underline-offset: 3px; }
.profile-delete-button { width: 100%; margin-top: 20px; }
#profile-delete-dialog form { display: grid; gap: 12px; margin-top: 20px; }
#profile-delete-dialog label { color: var(--muted); line-height: 1.5; }
#profile-delete-dialog label strong { color: var(--ink); }
#profile-delete-dialog input { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: rgba(4,13,27,.72); color: var(--ink); padding: 13px 14px; font: inherit; }
#report-block-dialog form { display: grid; gap: 12px; margin-top: 20px; }
#report-block-dialog label { color: var(--muted); }
#report-block-dialog select { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #07182a; color: var(--ink); padding: 13px 14px; font: inherit; }
.duel-score-overview { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 900px) {
  .home-screen { grid-template-columns: 1fr; gap: 34px; padding-top: 35px; align-items: start; }
  .continent-progress-card { min-height: 430px; }
  .home-stats { grid-column: 1; }
  .choice-grid { grid-template-columns: 1fr 1fr; }
  .levels-grid { grid-template-columns: repeat(8, 1fr); }
  .duel-layout { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .app-shell { padding-left: 16px; padding-right: 16px; }
  .topbar { min-height: 72px; }
  .brand-name { display: none; }
  .brand-logo { width: 56px; height: 56px; border-radius: 14px; }
  .profile-launch-card { padding: 28px 20px; }
  .profile-launch-card .profile-logo { width: 116px; height: 116px; border-radius: 27px; }
  .profile-launch-name { margin-bottom: 24px; font-size: .88rem; }
  .score-button span:last-child,
  .install-button span:last-child,
  .reset-button span:last-child { display: none; }
  .profile-button span:last-child { display: none; }
  .score-button,
  .install-button,
  .reset-button { width: 42px; height: 42px; justify-content: center; padding: 0; }
  .profile-button { width: 42px; height: 42px; justify-content: center; padding: 0; }
  .topbar-actions { gap: 6px; }
  .wqc-balance { min-height: 42px; padding: 6px 9px; gap: 4px; }
  .wqc-balance small { display: none; }
  .home-screen { padding-top: 28px; gap: 28px; }
  .continent-progress-card { min-height: auto; padding: 22px 18px; }
  .home-intro { margin-bottom: 24px; }
  .continent-progress-heading { margin-bottom: 24px; }
  .continent-progress-row { grid-template-columns: 86px 1fr 40px; gap: 9px; }
  .mode-card { min-height: 130px; padding: 20px 17px; gap: 13px; }
  .home-stats { gap: 18px; justify-content: space-between; }
  .home-stats div { display: grid; gap: 1px; }
  .signature { margin-top: -12px; padding-bottom: 8px; }
  .section-heading { margin: 28px 0 27px; gap: 14px; }
  .choice-grid { grid-template-columns: 1fr; }
  .choice-card { min-height: 115px; }
  .challenge-intro { margin: -10px 0 22px; }
  .levels-heading { grid-template-columns: auto 1fr; }
  .progress-summary { grid-column: 2; text-align: left; display: flex; gap: 7px; align-items: baseline; }
  .progress-summary strong { font-size: 1.1rem; }
  .difficulty-legend { display: grid; font-size: .86rem; }
  .levels-grid { grid-template-columns: repeat(5, 1fr); gap: 7px; }
  .challenge-levels-grid { grid-template-columns: repeat(2, 1fr); }
  .challenge-levels-grid .level-button { aspect-ratio: 1.8; }
  .quiz-screen { padding-top: 22px; }
  .question-panel { padding-top: 45px; }
  .question-panel h2 { margin-bottom: 28px; }
  .answers-grid { grid-template-columns: 1fr; gap: 9px; }
  .answer-button { min-height: 64px; }
  .joker-dock button { grid-template-columns: 1fr; place-items: center; text-align: center; padding: 9px 4px; }
  .joker-icon { grid-row: auto; width: 33px; height: 33px; }
  .joker-dock small { display: none; }
  .result-actions { display: grid; }
  .score-overview { grid-template-columns: 1fr; }
  .score-tabs { grid-template-columns: repeat(2, 1fr); }
  .duel-heading { grid-template-columns: auto 1fr; }
  .notify-button { grid-column: 2; justify-self: start; }
  .duel-create-card, .duel-list-section { padding: 17px; }
  .duel-list-card { align-items: flex-start; flex-direction: column; }
  .duel-card-actions { flex-wrap: wrap; }
  .duel-difficulties { grid-template-columns: 1fr; }
  .friend-add-form > div { grid-template-columns: 1fr; }
  .duel-score-overview { grid-template-columns: repeat(3, 1fr); }
  .review-answers-grid .answer-button { grid-template-columns: 26px 1fr; }
  .answer-badges { grid-column: 2; justify-content: flex-start; }
  .review-navigation { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}


.startup-splash { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; background: #080807; }
.startup-splash img { display: block; width: min(100%, 800px); height: auto; max-height: 100dvh; object-fit: contain; }
.home-legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 22px; padding: 12px 16px 24px; }
.home-legal-links a { color: var(--muted); font-size: .875rem; text-decoration: underline; text-underline-offset: 3px; }
.home-legal-links a:hover { color: var(--ink); }

.home-footer { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; text-align: center; }
.home-footer .signature { margin: 0; padding: 0; }
.home-footer .home-legal-links { width: 100%; padding: 0 16px 12px; }

.home-footer .signature { text-align: center; }
.rights-reserved { display: inline; font-family: var(--font-body, sans-serif); font-size: .85rem; font-style: normal; font-weight: 400; }
