:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --panel-2: #eef3ee;
  --text: #17211c;
  --muted: #64716a;
  --line: #dce5de;
  --primary: #0f766e;
  --primary-2: #115e59;
  --accent: #d97706;
  --danger: #b42318;
  --success: #167849;
  --shadow: 0 18px 42px rgba(22, 34, 27, 0.12);
  --radius: 8px;
}

body.dark {
  color-scheme: dark;
  --bg: #111614;
  --panel: #19211e;
  --panel-2: #222c28;
  --text: #edf3ee;
  --muted: #a6b3ad;
  --line: #314039;
  --primary: #2dd4bf;
  --primary-2: #5eead4;
  --accent: #f59e0b;
  --danger: #fb7185;
  --success: #4ade80;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, opacity 0.15s;
}

/* Anillo de foco accesible visible solo con teclado */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius);
}
:focus:not(:focus-visible) {
  outline: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-item span {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--text);
  transition: color 0.15s;
}

.nav-item:hover,
.nav-item.active {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.nav-item.active {
  border-color: var(--primary);
  color: var(--primary);
}

.nav-item.active span {
  color: var(--primary);
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.sidebar-note p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto 18px;
  max-width: 1180px;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.answer-button,
.chip {
  border-radius: var(--radius);
  min-height: 40px;
  border: 1px solid var(--line);
}

.primary-button {
  padding: 0 16px;
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.primary-button:hover {
  background: var(--primary-2);
  border-color: var(--primary-2);
}

body.dark .primary-button {
  color: #062421;
}

.secondary-button,
.ghost-button {
  padding: 0 14px;
  background: var(--panel);
  color: var(--text);
  font-weight: 700;
}

.secondary-button:hover {
  background: var(--panel-2);
  border-color: var(--primary);
}

.ghost-button {
  background: transparent;
}

.ghost-button:hover {
  background: var(--panel-2);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  background: var(--panel);
  color: var(--text);
  font-size: 1.2rem;
}

.icon-button:hover {
  background: var(--panel-2);
  border-color: var(--primary);
}

.hero-strip {
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: center;
  gap: 24px;
  max-width: 1180px;
  min-height: 152px;
  margin: 0 auto 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.road-visual {
  position: relative;
  height: 152px;
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(15, 118, 110, 0.78), rgba(217, 119, 6, 0.58)),
    linear-gradient(145deg, #27342f 0 48%, #56645d 49% 51%, #1e2925 52% 100%);
}

.road-visual .line {
  position: absolute;
  bottom: 34px;
  width: 78px;
  height: 6px;
  border-radius: 999px;
  background: #f7f7d4;
  transform: rotate(-17deg);
}

.line-a {
  left: 42px;
}

.line-b {
  left: 158px;
}

.sign {
  position: absolute;
  top: 24px;
  left: 24px;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 7px solid #ef4444;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-weight: 900;
}

.car {
  position: absolute;
  right: 34px;
  bottom: 44px;
  width: 76px;
  height: 30px;
  border-radius: 18px 22px 8px 8px;
  background: #facc15;
  box-shadow: 0 12px 0 -5px rgba(0, 0, 0, 0.3);
}

.car::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 20px;
  width: 34px;
  height: 20px;
  border-radius: 12px 12px 2px 2px;
  background: #bfdbfe;
}

.hero-copy {
  display: grid;
  gap: 8px;
  padding-right: 24px;
}

.hero-copy strong {
  font-size: 1.25rem;
}

.hero-copy span {
  color: var(--muted);
  line-height: 1.55;
}

.view {
  max-width: 1180px;
  margin: 0 auto;
}

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

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.test-card,
.theory-card,
.stat-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel {
  padding: 18px;
}

.stat-card {
  padding: 16px;
}

.stat-card small {
  color: var(--muted);
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.65rem;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 24px 0 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.test-card,
.theory-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  transition: box-shadow 0.18s, border-color 0.18s;
}

.test-card:hover,
.theory-card:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--line));
  box-shadow: 0 4px 18px rgba(15, 118, 110, 0.09);
}

.test-card h3,
.theory-card h3 {
  margin: 0;
}

.test-card p,
.theory-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search {
  min-width: min(100%, 360px);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

.small-input {
  min-width: 130px;
  max-width: 160px;
}

.muted-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ranking-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.ranking-row span {
  color: var(--muted);
  font-weight: 700;
}

.ranking-row strong span,
.link-button span {
  color: var(--muted);
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 900;
  text-align: left;
}

.link-button:hover {
  color: var(--primary);
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
}

.leaderboard-board {
  display: grid;
  gap: 10px;
  align-content: start;
}

/* Ranking — sección minijuegos */
.ranking-section-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 22px 0 10px;
}
.mini-personal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 6px;
}
.mini-personal-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}
.mini-personal-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}
.mini-personal-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.mini-personal-info strong {
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-personal-best {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
}
.mini-personal-empty {
  font-size: 0.8rem;
  color: var(--muted);
}

.seo-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 18px;
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.seo-hero h2 {
  margin: 12px 0 10px;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.08;
}

.seo-hero p,
.seo-section p,
.faq-section p {
  color: var(--muted);
  line-height: 1.6;
}

.seo-points {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.seo-points span {
  font-weight: 800;
  color: var(--muted);
}

.seo-section,
.faq-section {
  margin-top: 24px;
}

.seo-section h2,
.faq-section h2 {
  margin: 0 0 10px;
}

.faq-section details {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.faq-section summary {
  cursor: pointer;
  font-weight: 900;
}

.auth-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.auth-panel h2,
.panel h2 {
  margin: 0;
  font-size: 1.1rem;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-head span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.avatar {
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--panel-2);
}

.avatar.large {
  width: 88px;
  height: 88px;
}

.avatar.mini {
  width: 36px;
  height: 36px;
}

.people-list {
  display: grid;
  gap: 10px;
}

.person-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.person-row > span {
  color: var(--muted);
  font-weight: 800;
}

.friend-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.quick-message-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.online-chip {
  background: color-mix(in srgb, var(--success) 16%, var(--panel-2));
  color: var(--success);
}

.level-card {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.level-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
}

.level-head h2 {
  margin: 8px 0 0;
  font-size: 1.35rem;
}

.level-head strong {
  font-size: 1.2rem;
}

.level-track {
  height: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
}

.level-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #f59e0b);
}

.message-inbox {
  margin-bottom: 6px;
}

.file-control,
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--muted);
  font-weight: 800;
}

.file-control {
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.file-control input {
  max-width: 180px;
}

.copy-link {
  overflow-wrap: anywhere;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 800;
}

.achievement-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.achievement-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.achievement-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.achievement-card.unlocked {
  border-color: color-mix(in srgb, var(--success) 50%, var(--line));
  background: color-mix(in srgb, var(--success) 10%, var(--panel));
}

.sign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.sign-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  min-height: 210px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.sign-art {
  display: grid;
  place-items: start center;
}

.mistake-sign {
  width: min(220px, 100%);
  margin-bottom: 10px;
}

.sign-art svg,
.official-sign img {
  display: block;
  width: 100%;
  max-height: 150px;
  height: auto;
  border-radius: var(--radius);
}

.official-sign {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 150px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--panel-2);
}

.sign-copy {
  display: grid;
  gap: 8px;
  align-content: start;
}

.sign-copy h3 {
  margin: 0;
  font-size: 1rem;
}

.sign-copy p,
.sign-copy small {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.sign-copy small {
  font-weight: 800;
}

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

.tab-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.tab-button:hover {
  background: var(--panel-2);
  border-color: var(--primary);
  color: var(--text);
}

.tab-button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

body.dark .tab-button.active {
  color: #062421;
}

.theory-body {
  display: grid;
  gap: 12px;
}

.theory-body ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 13, 10, 0.72);
}

.modal.hidden {
  display: none;
}

.modal-panel {
  width: min(860px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 4px 0 0;
  font-size: 1.25rem;
}

.progress-track {
  height: 8px;
  background: var(--panel-2);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.question-card {
  padding: 22px;
}

.question-card.signal-question-card {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.question-visual {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
}

.question-visual svg {
  display: block;
  width: 100%;
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.question-visual figcaption {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.signal-question-card .sign-question-visual {
  grid-row: span 4;
  margin: 0;
}

.sign-question-visual .official-sign {
  min-height: auto;
  max-width: 280px;
  margin: 0 auto;
  padding: 10px;
}

.sign-question-visual .official-sign img,
.sign-question-visual svg {
  width: auto;
  max-width: 100%;
  max-height: 190px;
  margin: 0 auto;
}

.sign-question-visual .fallback-sign svg {
  width: 100%;
}

.question-text {
  margin: 10px 0 16px;
  font-size: 1.28rem;
  font-weight: 850;
  line-height: 1.35;
}

.answers {
  display: grid;
  gap: 10px;
}

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

.answers-grid .answer-button:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.answers-offset .answer-button:nth-child(2) {
  margin-left: 22px;
}

.answers-offset .answer-button:nth-child(3) {
  margin-right: 22px;
}

.answer-button {
  padding: 14px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  line-height: 1.45;
}

.answer-button:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--panel));
}

.answer-button.correct {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, var(--panel));
}

.answer-button.wrong {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--panel));
}

.explanation {
  margin-top: 14px;
  padding: 14px;
  border-left: 4px solid var(--primary);
  background: var(--panel-2);
  color: var(--muted);
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.result-box {
  display: grid;
  gap: 14px;
  text-align: center;
  padding: 22px;
}

.result-score {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
}

.result-score.pass {
  color: var(--success);
}

.result-score.fail {
  color: var(--danger);
}

/* DGT exact exam verdict */
.dgt-verdict {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  padding: 10px 0 4px;
}
.dgt-verdict.pass { color: var(--success); }
.dgt-verdict.fail { color: var(--danger); }
.dgt-reason {
  margin: 8px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

/* Lives display */
.lives-display {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}
.heart {
  font-size: 1.15rem;
  color: var(--danger);
  transition: color 0.25s, transform 0.2s;
}
.heart.lost {
  color: var(--line);
  transform: scale(0.82);
}

/* DGT card highlight */
.dgt-card {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
  background: color-mix(in srgb, var(--danger) 4%, var(--panel));
}
.dgt-card:hover {
  border-color: color-mix(in srgb, var(--danger) 55%, var(--line));
}
.chip.chip-danger {
  background: color-mix(in srgb, var(--danger) 15%, var(--panel-2));
  color: var(--danger);
}
.chip.chip-warning {
  background: color-mix(in srgb, #f59e0b 15%, var(--panel-2));
  color: #b45309;
}
.chip.chip-info {
  background: color-mix(in srgb, var(--primary) 15%, var(--panel-2));
  color: var(--primary);
}

/* Minijuegos */
.mini-hero {
  padding: 24px 0 8px;
}
.mini-hero h2 {
  font-size: 1.7rem;
  font-weight: 900;
  margin: 0 0 6px;
}
.mini-hero p {
  color: var(--muted);
  margin: 0;
}
.minigame-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.minigame-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 2px;
}
.minigame-card h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0;
}
.minigame-card p {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
  flex: 1;
}
.mini-record {
  font-size: 0.82rem !important;
  color: var(--primary) !important;
  font-weight: 600;
}
.minigame-card .primary-button {
  margin-top: 10px;
  align-self: flex-start;
}
.speedrun-card {
  border-color: color-mix(in srgb, #f59e0b 35%, var(--line));
  background: color-mix(in srgb, #f59e0b 4%, var(--panel));
}
.speedrun-card:hover { border-color: color-mix(in srgb, #f59e0b 60%, var(--line)); }
.survival-card {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  background: color-mix(in srgb, var(--danger) 4%, var(--panel));
}
.survival-card:hover { border-color: color-mix(in srgb, var(--danger) 58%, var(--line)); }
.signal-card {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
  background: color-mix(in srgb, var(--primary) 4%, var(--panel));
}
.signal-card:hover { border-color: color-mix(in srgb, var(--primary) 58%, var(--line)); }
.blitz-card {
  border-color: color-mix(in srgb, #f59e0b 35%, var(--line));
  background: color-mix(in srgb, #f59e0b 4%, var(--panel));
}
.blitz-card:hover { border-color: color-mix(in srgb, #f59e0b 60%, var(--line)); }
.mistakes-card {
  border-color: color-mix(in srgb, var(--success) 30%, var(--line));
  background: color-mix(in srgb, var(--success) 4%, var(--panel));
}
.mistakes-card:hover { border-color: color-mix(in srgb, var(--success) 58%, var(--line)); }
.minigame-rules {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-top: 10px;
}
.minigame-rules h3 {
  font-size: 0.95rem;
  font-weight: 800;
  margin: 0 0 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.rules-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rules-list li {
  font-size: 0.87rem;
  color: var(--muted);
  padding-left: 14px;
  position: relative;
}
.rules-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}
.rules-list li strong {
  color: var(--text);
}
.survival-streak {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--danger);
  letter-spacing: 0.02em;
}

/* Topic breakdown bars */
.topic-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.topic-bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 28px;
  align-items: center;
  gap: 10px;
}
.topic-bar-label {
  font-size: 0.83rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topic-bar-track {
  height: 8px;
  background: var(--panel-2);
  border-radius: 4px;
  overflow: hidden;
}
.topic-bar-fill {
  height: 100%;
  background: var(--danger);
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 4px;
}
.topic-bar-count {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--danger);
  text-align: right;
}

.empty-state {
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state.compact {
  margin-bottom: 14px;
  padding: 12px 14px;
  text-align: left;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
    padding: 8px;
    font-size: 0.86rem;
  }

  .nav-item span,
  .sidebar-note {
    display: none;
  }

  .main {
    padding: 18px;
  }

  .hero-strip,
  .seo-hero,
  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2 {
    grid-template-columns: 1fr;
  }

  .question-card.signal-question-card,
  .answers-grid {
    grid-template-columns: 1fr;
  }

  .signal-question-card .sign-question-visual {
    grid-row: auto;
  }

  .road-visual {
    height: 120px;
  }

  .hero-copy {
    padding: 0 18px 18px;
  }
}

@media (max-width: 560px) {
  .topbar,
  .section-head,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sign-card {
    grid-template-columns: 1fr;
  }

  .sign-art {
    max-width: 180px;
  }

  .person-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .ranking-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .person-row > span,
  .person-row .small-button,
  .ranking-row > span,
  .ranking-row .small-button {
    grid-column: 2;
  }

  .answers-offset .answer-button:nth-child(2),
  .answers-offset .answer-button:nth-child(3) {
    margin: 0;
  }
}

/* ============================================================
   POLISH v20260517 — animations, micro-interactions, refinements
   ============================================================ */

/* Modal entrance animation */
@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal:not(.hidden) {
  animation: modal-fade 0.2s ease;
}

@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal:not(.hidden) .modal-panel {
  animation: modal-in 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Answer button micro-interactions */
.answer-button {
  transform: translateY(0);
  transition: background 0.13s, border-color 0.13s, color 0.13s, box-shadow 0.13s, transform 0.1s;
}

.answer-button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.12);
}

.answer-button:not(:disabled):active {
  transform: translateY(0) scale(0.98);
}

.answer-button.correct {
  animation: answer-correct 0.35s ease;
}

.answer-button.wrong {
  animation: answer-wrong 0.4s ease;
}

@keyframes answer-correct {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.025); }
  100% { transform: scale(1); }
}

@keyframes answer-wrong {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-5px); }
  40%  { transform: translateX(5px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

/* Result box enhancements */
.result-box {
  animation: result-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes result-in {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.result-score {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 12px;
  letter-spacing: -0.02em;
}

.result-score.pass {
  background: color-mix(in srgb, var(--success) 12%, transparent);
}

.result-score.fail {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

/* Explanation fade-in */
.explanation {
  animation: explain-in 0.25s ease;
  border-radius: 0 var(--radius) var(--radius) 0;
}

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

/* Smooth question transitions */
.question-card {
  animation: q-in 0.18s ease;
}

@keyframes q-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Progress bar glow */
.progress-track span {
  box-shadow: 2px 0 8px color-mix(in srgb, var(--primary) 60%, transparent);
}

/* Primary button shine */
.primary-button {
  position: relative;
  overflow: hidden;
}

.primary-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.primary-button:hover::after {
  transform: translateX(100%);
}

/* Nav item active indicator */
.nav-item.active {
  position: relative;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

/* Stat card hover lift */
.stat-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.10);
}

/* Keyboard shortcut hint in modal */
.key-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

.key-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  font-size: 0.7rem;
  font-family: inherit;
  line-height: 1.5;
}

/* Sign card hover */
.sign-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sign-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.10);
}

/* Toast-style feedback message */
.feedback-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 30;
  padding: 12px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  animation: toast-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 340px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Visual question label */
.visual-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: center;
}

/* Smooth chip transitions */
.chip {
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

/* ============================================================ */
