:root {
  color-scheme: dark;
  --bg: #0d1020;
  --card: #171b31;
  --card-light: #202642;
  --text: #f5f7fb;
  --muted: #aeb7d4;
  --primary: #7c5cff;
  --primary-strong: #9c82ff;
  --success: #39d98a;
  --error: #ff6b7a;
  --warning: #ffd166;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 24px 70px rgba(0, 0, 0, 0.45);
  --card-glow: inset 0 1px 0 rgba(255,255,255,0.08);
  --accent-beginner: #39d98a;
  --accent-advanced: #00c2ff;
  --accent-master: #ffd166;
  --accent-challenge: #ff8bd1;
  --space-card: clamp(16px, 3vw, 24px);
  --motion-fast: 150ms ease;
  --motion-normal: 260ms ease;
}


* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(124, 92, 255, 0.35), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(0, 194, 255, 0.16), transparent 32rem),
    linear-gradient(135deg, rgba(255,255,255,0.015), transparent 40%),
    var(--bg);
  color: var(--text);
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03)), var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow), var(--card-glow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
  margin-bottom: 24px;
}

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

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(2.4rem, 7vw, 4.5rem); line-height: 0.95; }
h2 { margin-bottom: 16px; }
h3 { margin-bottom: 8px; color: var(--warning); }

.hero-text, .muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.score-card {
  min-width: 150px;
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 20px;
  border-radius: 20px;
  background: rgba(124, 92, 255, 0.18);
  border: 1px solid rgba(124, 92, 255, 0.35);
}
.score-card span { color: var(--muted); }
.score-card strong { font-size: 3rem; }

.game-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 24px;
}

.level-panel, .level-card, .editor-card, .result-card { padding: 24px; }
.play-area { display: grid; gap: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }


.progress-card {
  display: grid;
  gap: 12px;
  margin: 18px 0 20px;
  padding: 16px;
  border: 1px solid rgba(124, 92, 255, 0.32);
  border-radius: 18px;
  background: rgba(124, 92, 255, 0.12);
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.progress-header span:first-child {
  color: var(--text);
  font-weight: 800;
}

.progress-header span:last-child {
  text-align: right;
}

.progress-track {
  overflow: hidden;
  width: 100%;
  min-height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(9, 12, 24, 0.72);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.32);
}

.progress-fill {
  width: 0%;
  height: 16px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), #00c2ff);
  transition: width var(--motion-normal);
}
.progress-fill, .mini-progress-fill, .challenge-progress-track span { background-size: 160% 100%; animation: quest-progress-shine 3.8s ease-in-out infinite; }

.progress-percent {
  margin: 0;
  color: #d8fff0;
  font-size: 0.9rem;
  font-weight: 800;
  text-align: right;
}

.level-list { display: grid; gap: 12px; }
.level-button {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card-light);
  color: var(--text);
  padding: 14px;
  text-align: left;
  cursor: pointer;
}
.level-button span { display: block; color: var(--muted); font-size: 0.82rem; }
.level-button-topline {
  align-items: center;
  display: flex !important;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.level-number {
  flex: 0 0 auto;
  min-width: 2ch;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  line-height: 1.1;
}
.level-stars {
  color: var(--warning) !important;
  flex-shrink: 0;
  font-size: 0.95rem !important;
  letter-spacing: 1px;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  line-height: 1.1;
}
.level-button.active { border-color: var(--primary-strong); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18); }
.level-button.locked {
  cursor: not-allowed;
  opacity: 0.58;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.035);
}
.level-button.locked strong { color: var(--muted); }
.level-button.solved strong::after { content: ' ✓'; color: var(--success); }

.level-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.pill {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(57, 217, 138, 0.16);
  color: var(--success);
  font-weight: 700;
  font-size: 0.85rem;
}
.pill.secondary { background: rgba(124, 92, 255, 0.18); color: #c7bbff; }
.task-box, .hint-text {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--border);
}
.hint-text {
  margin-top: 16px;
  color: var(--warning);
  background: rgba(255, 209, 102, 0.14);
  border-color: rgba(255, 209, 102, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.08);
  font-weight: 800;
}

.editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.editor-heading label { margin-bottom: 0; }

label { display: block; margin-bottom: 10px; font-weight: 800; }
textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid rgba(124, 92, 255, 0.35);
  border-radius: 18px;
  padding: 18px;
  background: #090c18;
  color: #d8fff0;
  font: 1rem/1.5 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  outline: none;
}
textarea:focus { border-color: var(--primary-strong); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2); }

.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
button { font: inherit; transition: transform var(--motion-fast), border-color var(--motion-fast), background var(--motion-fast), box-shadow var(--motion-fast), color var(--motion-fast); }
button:hover:not(:disabled) { transform: translateY(-1px); }
.primary-button, .secondary-button, .ghost-button {
  position: relative;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}
.primary-button { background: linear-gradient(135deg, var(--primary), #00c2ff); box-shadow: 0 12px 28px rgba(0, 194, 255, 0.18); }
.secondary-button { background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.035)), var(--card-light); border: 1px solid var(--border); }
.ghost-button { background: transparent; border: 1px solid var(--border); padding: 8px 12px; color: var(--muted); }

.feedback {
  min-height: 48px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}
button:focus-visible,
.level-button:focus-visible,
.overview-tab:focus-visible,
.level-section-tab:focus-visible { outline: 3px solid var(--warning); outline-offset: 3px; }

.feedback.success { color: var(--success); border-color: rgba(57, 217, 138, 0.4); }
.feedback.error { color: var(--error); border-color: rgba(255, 107, 122, 0.45); }
.feedback.info { color: #8ed7ff; }

.table-wrap { overflow-x: auto; }
.empty-state { color: var(--muted); padding: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 520px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: #c7bbff; background: rgba(124, 92, 255, 0.12); }
tr:hover td { background: rgba(255, 255, 255, 0.035); }

@media (max-width: 840px) {
  .app-shell { width: min(100% - 20px, 680px); padding: 16px 0; }
  .hero { flex-direction: column; padding: 24px; }
  .game-layout { grid-template-columns: 1fr; }
  .level-list { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .panel-heading { align-items: flex-start; }
  .progress-header { align-items: flex-start; flex-direction: column; }
  .progress-header span:last-child,
  .progress-percent { text-align: left; }
}

.database-intro {
  padding: 32px;
  margin-bottom: 24px;
}

.database-intro > p {
  max-width: 720px;
}

.schema-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.schema-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.055);
}

.schema-card h3 {
  color: var(--success);
}

.schema-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.schema-card li + li {
  margin-top: 6px;
}

code {
  color: #d8fff0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.key-relationship-section {
  display: grid;
  gap: 16px;
  margin: 24px 0;
  padding: 20px;
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: 20px;
  background: rgba(255, 209, 102, 0.08);
}

.key-relationship-section > .muted {
  margin-bottom: 0;
}

.key-card-grid,
.relationship-card-grid {
  display: grid;
  gap: 16px;
}

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

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

.info-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(9, 12, 24, 0.42);
}

.info-card h4 {
  margin: 0 0 10px;
  color: var(--text);
}

.info-card p {
  margin-bottom: 8px;
  color: var(--muted);
}

.info-card p:last-child {
  margin-bottom: 0;
}

.key-card {
  border-color: rgba(57, 217, 138, 0.32);
}

.key-card h4 {
  color: var(--success);
}

.relationship-card {
  border-color: rgba(124, 92, 255, 0.35);
}

.relationship-card h4 {
  color: var(--warning);
}

.relationship-box {
  padding: 20px;
  border-radius: 20px;
  background: rgba(124, 92, 255, 0.13);
  border: 1px solid rgba(124, 92, 255, 0.35);
}

.relationship-box p {
  margin-bottom: 8px;
  color: var(--muted);
}

.relationship-box pre {
  overflow-x: auto;
  margin: 16px 0 0;
  padding: 16px;
  border-radius: 16px;
  background: #090c18;
  color: #d8fff0;
  font: 0.95rem/1.6 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.intro-actions {
  margin-top: 24px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

[hidden] {
  display: none !important;
}

@media (max-width: 840px) {
  .database-intro { padding: 24px; }
  .schema-grid,
  .key-card-grid,
  .relationship-card-grid { grid-template-columns: 1fr; }
}

.path-selection,
.beginner-intro {
  padding: 32px;
  margin-bottom: 24px;
}

.path-selection > p,
.beginner-intro > p {
  max-width: 760px;
}

.path-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.path-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 260px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.055);
}

.path-card p {
  flex: 1;
  color: var(--muted);
}

.path-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.path-card-header h3 {
  margin-bottom: 0;
}

.active-path {
  border-color: rgba(57, 217, 138, 0.45);
  box-shadow: 0 0 0 3px rgba(57, 217, 138, 0.08);
}

.disabled-path {
  opacity: 0.78;
}

.coming-soon-badge {
  white-space: nowrap;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 209, 102, 0.16);
  color: var(--warning);
  border: 1px solid rgba(255, 209, 102, 0.35);
  font-size: 0.78rem;
  font-weight: 800;
}

.sql-example {
  overflow-x: auto;
  max-width: 760px;
  margin: 14px 0 18px;
  padding: 18px;
  border: 1px solid rgba(57, 217, 138, 0.36);
  border-radius: 18px;
  background: #090c18;
  box-shadow: inset 0 0 0 1px rgba(216, 255, 240, 0.06);
}

.sql-example code {
  font-size: 1.05rem;
  line-height: 1.6;
}

.hint-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-radius: 50%;
  padding: 0;
  color: var(--warning);
  background: rgba(255, 209, 102, 0.12);
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
}

.hint-button:hover {
  border-color: rgba(255, 209, 102, 0.72);
  background: rgba(255, 209, 102, 0.18);
}

@media (max-width: 840px) {
  .path-selection,
  .beginner-intro { padding: 24px; }
  .path-grid { grid-template-columns: 1fr; }
  .path-card { min-height: auto; }
}

.solution-box {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(57, 217, 138, 0.45);
  border-radius: 16px;
  background: rgba(57, 217, 138, 0.12);
  color: #d8fff0;
  font: 1rem/1.5 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.level-overview {
  padding: 24px;
  margin-bottom: 24px;
}

.level-overview .level-list {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.game-layout {
  grid-template-columns: 1fr;
}

.game-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

@media (max-width: 640px) {
  .level-overview {
    padding: 16px;
  }

  .level-overview .panel-heading {
    gap: 16px;
  }

  .level-overview .level-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
  }

  .level-overview .level-button {
    display: grid;
    align-content: center;
    min-height: 82px;
    padding: 9px 6px;
    text-align: center;
    border-radius: 14px;
  }

  .level-overview .level-button-topline {
    display: grid !important;
    justify-items: center;
    gap: 6px;
    margin-bottom: 0;
  }

  .level-overview .level-number {
    flex-basis: auto;
    font-size: 0;
  }

  .level-overview .level-number::after {
    content: attr(data-level-number);
    display: inline-block;
    font-size: 1.05rem;
    color: var(--text);
    font-weight: 900;
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    line-height: 1.1;
  }

  .level-overview .level-stars {
    display: block;
    max-width: 100%;
    font-size: 0.68rem !important;
    letter-spacing: -0.02em;
    line-height: 1.15;
  }

  .level-overview .level-button strong {
    display: none;
  }

  .level-overview .level-button.locked .level-number::after {
    color: var(--muted);
  }

  .level-overview .progress-card {
    margin: 12px 0 14px;
    padding: 12px;
  }

  .game-toolbar {
    justify-content: flex-start;
  }
}

.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 7, 18, 0.72);
  backdrop-filter: blur(4px);
}

.success-modal {
  position: relative;
  width: min(100%, 480px);
  max-height: min(92vh, 720px);
  overflow-y: auto;
  padding: 30px;
  text-align: center;
}

.modal-close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.modal-close-button:focus-visible,
.success-modal button:focus-visible {
  outline: 3px solid var(--warning);
  outline-offset: 3px;
}

.success-modal h2 {
  margin-bottom: 12px;
  padding: 0 36px;
}

.success-modal-stars {
  margin: 14px 0 4px;
  color: var(--warning);
  font-size: clamp(3.4rem, 16vw, 5.6rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1;
  text-shadow: 0 8px 28px rgba(255, 209, 102, 0.25);
}

.success-modal-star-text {
  margin-bottom: 10px;
  color: #fff2c2;
  font-size: 1.2rem;
  font-weight: 900;
}

.success-modal-best {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 8px 14px;
  border: 1px solid rgba(57, 217, 138, 0.45);
  border-radius: 999px;
  background: rgba(57, 217, 138, 0.14);
  color: var(--success);
  font-weight: 900;
}

.success-modal-message,
.success-modal-completion {
  color: var(--muted);
  font-size: 1.05rem;
}

.success-modal-completion {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 209, 102, 0.35);
  border-radius: 16px;
  background: rgba(255, 209, 102, 0.1);
  color: #ffe6a3;
  font-weight: 800;
}

.success-modal-actions {
  justify-content: center;
  margin-top: 22px;
}

@media (max-width: 480px) {
  .modal-overlay {
    padding: 12px;
  }

  .success-modal {
    padding: 26px 18px 20px;
    border-radius: 20px;
  }

  .success-modal h2 {
    padding: 0 30px;
  }

  .success-modal-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

.sql-basics-card {
  margin-bottom: 18px;
}

.sql-basics-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.sql-basics-chapter {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  background: rgba(255, 255, 255, 0.04);
}

.sql-basics-chapter[open] {
  border-color: rgba(57, 217, 138, 0.36);
  background: rgba(57, 217, 138, 0.08);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.sql-basics-chapter-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  overflow-wrap: anywhere;
}

.sql-basics-chapter-summary::-webkit-details-marker {
  display: none;
}

.sql-basics-chapter-summary::before {
  content: '+';
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-radius: 999px;
  color: var(--warning);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  transition: transform 0.15s ease, background 0.15s ease;
}

.sql-basics-chapter[open] > .sql-basics-chapter-summary::before {
  content: '−';
  background: rgba(255, 209, 102, 0.14);
  transform: rotate(180deg);
}

.sql-basics-chapter-summary:focus-visible {
  outline: 3px solid var(--warning);
  outline-offset: -3px;
}

.sql-basics-chapter-title-group {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.sql-basics-chapter-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sql-basics-chapter-title {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.3;
}

.sql-basics-chapter-status {
  justify-self: end;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}

.sql-basics-chapter-status.unlocked {
  border-color: rgba(57, 217, 138, 0.38);
  color: #d8fff0;
  background: rgba(57, 217, 138, 0.12);
}

.sql-basics-chapter-content {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
  min-width: 0;
}

.sql-basics-chapter-content p {
  margin: 0;
  overflow-wrap: anywhere;
}

.sql-basics-chapter.locked {
  opacity: 0.72;
  background: rgba(255, 255, 255, 0.02);
}

@media (min-width: 760px) {
  .sql-basics-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.game-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.game-info-card {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 20px;
}

.game-info-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.game-info-heading h2 {
  margin-bottom: 0;
}

.info-progress {
  flex-shrink: 0;
  padding: 6px 10px;
  border: 1px solid rgba(57, 217, 138, 0.38);
  border-radius: 999px;
  color: #d8fff0;
  background: rgba(57, 217, 138, 0.12);
  font-size: 0.82rem;
  font-weight: 800;
}

.learned-sql-list {
  display: grid;
  gap: 14px;
}

.learned-sql-stage {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
}

.learned-sql-stage h3 {
  margin: 0;
  font-size: 1rem;
}

.learned-sql-stage.locked {
  opacity: 0.74;
  background: rgba(255, 255, 255, 0.02);
}

.learned-sql-stage-grid {
  display: grid;
  gap: 12px;
}

.learned-sql-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(124, 92, 255, 0.28);
  border-radius: 14px;
  background: rgba(124, 92, 255, 0.1);
}

.learned-sql-item h4 {
  justify-self: start;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(9, 12, 24, 0.72);
  color: #d8fff0;
  font-size: 0.95rem;
  font-weight: 800;
}

.learned-sql-item p {
  margin: 0;
}

.learned-sql-details {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.learned-sql-example-label {
  color: #d8fff0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.learned-sql-example {
  margin: 0;
}

@media (max-width: 840px) {
  .game-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .game-info-heading,
  .learned-sql-item {
    grid-template-columns: 1fr;
  }

  .game-info-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

.sql-basics-term-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.sql-basics-term-list strong {
  color: var(--text);
}

.learned-sql-stage {
  overflow: hidden;
}

.learned-sql-stage-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.learned-sql-stage-summary::-webkit-details-marker {
  display: none;
}

.learned-sql-stage-summary::before {
  content: '▸';
  color: var(--warning);
  font-weight: 900;
  transition: transform 0.15s ease;
}

.learned-sql-stage[open] > .learned-sql-stage-summary::before {
  transform: rotate(90deg);
}

.learned-sql-stage-summary:focus-visible {
  border-radius: 12px;
  outline: 3px solid var(--warning);
  outline-offset: 4px;
}

.learned-sql-stage-title {
  flex: 1;
  color: var(--warning);
  font-size: 1rem;
  font-weight: 800;
}

.learned-sql-stage-status {
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
  font-weight: 900;
}

.learned-sql-stage-status.unlocked {
  border-color: rgba(57, 217, 138, 0.38);
  color: #d8fff0;
  background: rgba(57, 217, 138, 0.12);
}

.learned-sql-stage[open] {
  gap: 14px;
}

.learned-sql-stage[open] > .learned-sql-stage-grid,
.learned-sql-stage[open] > p {
  margin-top: 12px;
}

.learned-sql-example code,
.sql-example code {
  display: block;
  min-width: max-content;
}

@media (max-width: 520px) {
  .learned-sql-stage-summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

.overview-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(9, 12, 24, 0.44);
}

.overview-tab {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.overview-tab.active,
.overview-tab[aria-selected="true"] {
  border-color: rgba(57, 217, 138, 0.42);
  color: #d8fff0;
  background: rgba(57, 217, 138, 0.14);
}

.overview-tab:focus-visible,
.learning-overview-card:focus-within {
  outline: 3px solid var(--warning);
  outline-offset: 3px;
}

.learned-overview-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.learned-overview-heading,
.learning-overview-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.learned-overview-heading h3,
.learning-overview-card-header h4 {
  margin: 0;
}

.learned-overview-grid {
  display: grid;
  gap: 14px;
}

.learning-overview-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(124, 92, 255, 0.28);
  border-radius: 20px;
  background: rgba(124, 92, 255, 0.1);
}

.learning-overview-card.in-progress {
  border-color: rgba(255, 209, 102, 0.42);
  background: rgba(255, 209, 102, 0.1);
}

.learning-overview-card.unlocked {
  border-color: rgba(57, 217, 138, 0.38);
  background: rgba(57, 217, 138, 0.1);
}

.learning-overview-card.locked {
  opacity: 0.76;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.035);
}

.learning-overview-card.advanced-preview {
  border-color: rgba(0, 194, 255, 0.3);
}

.status-badge {
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-badge.unlocked {
  border-color: rgba(57, 217, 138, 0.45);
  color: #d8fff0;
  background: rgba(57, 217, 138, 0.15);
}

.status-badge.in-progress {
  border-color: rgba(255, 209, 102, 0.48);
  color: #ffe6a3;
  background: rgba(255, 209, 102, 0.14);
}

.status-badge.locked {
  border-style: dashed;
}

.learning-overview-range,
.learning-overview-progress,
.learning-overview-terms {
  margin: 0;
}

.learning-overview-range,
.learning-overview-progress {
  color: #d8fff0;
  font-weight: 900;
}

.learning-overview-terms {
  color: var(--muted);
}

.learning-overview-terms strong {
  color: var(--text);
}

.mini-progress-track {
  overflow: hidden;
  min-height: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(9, 12, 24, 0.72);
}

.mini-progress-fill {
  height: 12px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), #00c2ff);
}

@media (min-width: 780px) {
  .learned-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .overview-tabs,
  .overview-tab,
  .level-section-tabs,
  .level-section-tab {
    width: 100%;
  }

  .learned-overview-heading,
  .learning-overview-card-header {
    flex-direction: column;
  }
}

.level-section-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(9, 12, 24, 0.44);
}

.level-section-tab {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.level-section-tab[aria-selected="true"] {
  border-color: rgba(57, 217, 138, 0.42);
  color: #d8fff0;
  background: rgba(57, 217, 138, 0.14);
}

.level-section-tab:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.level-section-tab:focus-visible {
  outline: 3px solid var(--warning);
  outline-offset: 3px;
}

.level-section-locked-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.level-section-subheading {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
}

.level-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.level-section + .level-section {
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.level-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.level-section-heading h3 {
  margin: 0;
}

.level-section-heading span {
  border: 1px solid rgba(57, 217, 138, 0.38);
  border-radius: 999px;
  padding: 5px 10px;
  color: #d8fff0;
  background: rgba(57, 217, 138, 0.12);
  font-size: 0.82rem;
  font-weight: 800;
}

.level-section.completed .level-section-heading h3::after {
  content: ' ✓';
  color: var(--success);
}

.learning-overview-card.completed {
  border-color: rgba(57, 217, 138, 0.58);
  background: rgba(57, 217, 138, 0.14);
}

.status-badge.completed {
  border-color: rgba(57, 217, 138, 0.58);
  color: #d8fff0;
  background: rgba(57, 217, 138, 0.2);
}

.floating-nav-button {
  position: fixed;
  z-index: 40;
  bottom: max(18px, env(safe-area-inset-bottom));
  min-width: 52px;
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0 18px;
  color: var(--text);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.95), rgba(0, 194, 255, 0.78));
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.floating-nav-button-left {
  left: max(18px, env(safe-area-inset-left));
}

.floating-nav-button-right {
  right: max(18px, env(safe-area-inset-right));
}

.floating-nav-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

.floating-nav-button:focus-visible {
  outline: 3px solid var(--warning);
  outline-offset: 4px;
}

.floating-nav-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 520px) {
  .app-shell {
    padding-bottom: 16px;
  }

  .floating-nav-button {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 20px - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-width: 280px;
    min-width: 0;
    min-height: 48px;
    margin: 6px calc(10px + env(safe-area-inset-right)) 6px calc(10px + env(safe-area-inset-left));
    padding: 0 14px;
  }

  .floating-nav-button-right {
    max-width: 280px;
  }
}

/* Mobile robustness: keep every major region inside the viewport without masking layout bugs. */
.app-shell,
.card,
.hero,
.game-layout,
.play-area,
.level-panel,
.level-card,
.editor-card,
.result-card,
.database-intro,
.path-selection,
.beginner-intro,
.game-info-grid,
.learned-sql-list,
.learned-overview-grid,
.level-section,
.level-list,
.progress-card,
.task-box,
.hint-text,
.feedback,
.table-wrap,
.sql-example,
.relationship-box pre {
  max-width: 100%;
}

.hero,
.card,
button,
.pill,
.status-badge,
.info-progress,
.level-button,
.learning-overview-card,
.learned-sql-stage,
.learned-sql-item,
.schema-card,
.info-card,
.path-card,
.task-box,
.hint-text,
.feedback,
th,
td,
p,
li,
h1,
h2,
h3,
h4,
strong,
span {
  overflow-wrap: anywhere;
}

.sql-example,
.relationship-box pre,
.table-wrap {
  overscroll-behavior-x: contain;
}

.learning-overview-card {
  overflow: hidden;
}

.learning-overview-card-header {
  cursor: pointer;
  list-style: none;
}

.learning-overview-card-header::-webkit-details-marker {
  display: none;
}

.learning-overview-card-header::before {
  content: '▸';
  flex: 0 0 auto;
  color: var(--warning);
  font-weight: 900;
  transition: transform 0.15s ease;
}

.learning-overview-card[open] > .learning-overview-card-header::before {
  transform: rotate(90deg);
}

.learning-overview-card-content {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .app-shell {
    width: min(calc(100% - 16px), 100%);
    padding-top: 10px;
  }

  .hero,
  .database-intro,
  .path-selection,
  .beginner-intro,
  .level-panel,
  .level-card,
  .editor-card,
  .result-card,
  .game-info-card {
    padding: 16px;
    border-radius: 20px;
  }

  .hero,
  .database-intro,
  .path-selection,
  .beginner-intro,
  .level-overview,
  .sql-basics-card {
    margin-bottom: 16px;
  }

  h1 { font-size: clamp(2rem, 15vw, 3.1rem); }
  h2 { font-size: 1.28rem; }
  h3 { font-size: 1.05rem; }

  .score-card {
    min-width: 0;
    padding: 14px;
  }

  .score-card strong { font-size: 2.35rem; }

  .panel-heading,
  .editor-heading,
  .level-section-heading,
  .game-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-actions,
  .button-row,
  .intro-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
    padding: 11px 14px;
  }

  .overview-tabs,
  .level-section-tabs {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-radius: 18px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .overview-tab,
  .level-section-tab {
    flex: 0 0 auto;
    width: auto;
    max-width: min(76vw, 240px);
    padding: 9px 11px;
    font-size: 0.86rem;
    white-space: normal;
  }

  .level-overview .level-list {
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  }

  .level-section-heading span,
  .info-progress,
  .status-badge {
    align-self: flex-start;
    white-space: normal;
  }

  .learned-overview-heading,
  .learning-overview-card-header,
  .learned-sql-stage-summary {
    gap: 8px;
  }

  .learning-overview-card,
  .learned-sql-stage,
  .learned-sql-item,
  .sql-basics-chapter,
  .info-card {
    gap: 8px;
    padding: 12px;
    border-radius: 16px;
  }

  .learning-overview-card-content {
    gap: 8px;
  }

  .learned-sql-stage-title {
    min-width: 0;
  }

  .learned-sql-stage-status {
    flex-shrink: 1;
    white-space: normal;
  }

  .sql-example,
  .relationship-box pre {
    padding: 12px;
    font-size: 0.86rem;
  }

  .sql-example code,
  .learned-sql-example code {
    font-size: 0.86rem;
  }

  .learned-overview-panel {
    gap: 12px;
    margin-top: 14px;
  }

  .learned-overview-grid,
  .learned-sql-list,
  .learned-sql-stage-grid {
    gap: 10px;
  }

  .learned-overview-heading,
  .learning-overview-card-header,
  .learned-sql-stage-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .learning-overview-card-header::before,
  .learned-sql-stage-summary::before {
    margin-top: 2px;
  }

  .learning-overview-card-header,
  .learned-sql-stage-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .sql-basics-chapter-summary {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 56px;
    padding: 14px;
  }

  .sql-basics-chapter-status {
    justify-self: start;
    grid-column: 2;
    white-space: normal;
  }

  .sql-basics-chapter-content {
    padding: 0 14px 14px;
  }

  .learning-overview-card-header .status-badge,
  .learned-sql-stage-status {
    grid-column: 2;
  }

  .learning-overview-terms {
    line-height: 1.55;
  }

  .learned-sql-details {
    padding-left: 18px;
    line-height: 1.5;
  }

  textarea {
    min-width: 0;
    font-size: 0.95rem;
  }

  table {
    min-width: 460px;
  }
}

@media (max-width: 360px) {
  .app-shell {
    width: min(calc(100% - 12px), 100%);
  }

  .hero,
  .database-intro,
  .path-selection,
  .beginner-intro,
  .level-panel,
  .level-card,
  .editor-card,
  .result-card,
  .game-info-card,
  .level-overview {
    padding: 12px;
  }

  .level-overview .level-list {
    grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
    gap: 6px;
  }

  .level-overview .level-button {
    min-height: 78px;
    padding: 7px 4px;
  }

  .level-overview .level-button-topline {
    gap: 5px;
  }

  .level-overview .level-stars {
    font-size: 0.6rem !important;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding-bottom: 16px;
  }

  .floating-nav-button {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 20px - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-width: 280px;
    min-width: 0;
    min-height: 48px;
    margin: 6px calc(10px + env(safe-area-inset-right)) 6px calc(10px + env(safe-area-inset-left));
    padding: 0 14px;
    font-size: 0.9rem;
  }

  .floating-nav-button-left {
    left: auto;
  }

  .floating-nav-button-right {
    right: auto;
    max-width: 280px;
  }
}

@media (max-width: 640px) {
  .learning-overview-card-header {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.test-mode-panel {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px dashed rgba(255, 209, 102, 0.55);
  border-radius: 18px;
  background: rgba(255, 209, 102, 0.09);
}

.test-mode-panel[hidden] {
  display: none;
}

.test-mode-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.test-mode-heading h3 {
  margin-bottom: 0;
}

.test-mode-badge {
  flex-shrink: 0;
  padding: 6px 10px;
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-radius: 999px;
  color: var(--warning);
  font-size: 0.78rem;
  font-weight: 800;
}

.test-mode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.test-mode-actions .ghost-button {
  min-height: 42px;
}

@media (max-width: 520px) {
  .test-mode-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .test-mode-badge,
  .test-mode-actions .ghost-button {
    width: 100%;
  }
}

.completion-card {
  display: grid;
  gap: 16px;
  margin: 18px 0 20px;
  padding: clamp(20px, 5vw, 32px);
  overflow-wrap: anywhere;
  background:
    radial-gradient(circle at top right, rgba(57, 217, 138, 0.22), transparent 18rem),
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03)),
    var(--card);
  border-color: rgba(57, 217, 138, 0.42);
}

.completion-card[hidden] { display: none; }

.completion-card h2 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 7vw, 3rem);
}

.completion-message,
.completion-note {
  margin: 0;
  color: var(--muted);
}

.completion-note {
  color: var(--success);
  font-weight: 800;
}

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

.completion-stats div {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.completion-stats dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.completion-stats dd {
  margin: 6px 0 0;
  font-size: clamp(1.25rem, 5vw, 2rem);
  font-weight: 900;
}

.completion-actions {
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .completion-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 390px) {
  .completion-stats { grid-template-columns: 1fr; }
  .completion-actions > button { width: 100%; }
}

.milestone-banner {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(57, 217, 138, 0.45);
  border-radius: 18px;
  color: #d8fff0;
  background: linear-gradient(135deg, rgba(57, 217, 138, 0.22), rgba(0, 194, 255, 0.14));
  font-weight: 900;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

.badges-card {
  background: rgba(255, 209, 102, 0.08);
  border-color: rgba(255, 209, 102, 0.26);
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.badge-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
}

.badge-card.unlocked {
  border-color: rgba(57, 217, 138, 0.52);
  background: rgba(57, 217, 138, 0.13);
}

.badge-card.locked {
  opacity: 0.62;
  background: rgba(255, 255, 255, 0.03);
  border-style: dashed;
}

.badge-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: rgba(9, 12, 24, 0.42);
  font-size: 1.35rem;
}

.badge-card h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 0.98rem;
}

.badge-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.badge-card span {
  color: #d8fff0;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge-card.locked span {
  color: var(--muted);
}

@media (max-width: 430px) {
  .badge-grid { grid-template-columns: 1fr; }
  .badge-card { padding: 10px; }
  .badge-icon { width: 34px; height: 34px; font-size: 1.15rem; }
}

.replay-overview-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.replay-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.replay-level-button span:last-child {
  margin-top: 6px;
}


.daily-challenge-card {
  border-color: rgba(255, 204, 102, 0.45);
  background: linear-gradient(135deg, rgba(255, 204, 102, 0.12), rgba(124, 92, 255, 0.08));
}
.daily-challenge-content {
  display: grid;
  gap: 12px;
}
.daily-challenge-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}
.daily-challenge-title {
  margin: 0;
  font-size: 1.15rem;
}
.daily-challenge-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.daily-challenge-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.time-challenge-overview-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}
.time-challenge-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 209, 102, 0.42);
  border-radius: 18px;
  background: rgba(255, 209, 102, 0.1);
}
.editor-card .time-challenge-timer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 209, 102, 0.55);
  border-radius: 18px;
  background: rgba(255, 209, 102, 0.14);
  color: #ffe6a3;
  font-weight: 800;
  max-width: 100%;
  margin: 0 0 8px;
}
.time-challenge-timer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}
.time-challenge-timer strong {
  color: var(--warning);
  font-size: clamp(1.2rem, 6vw, 1.65rem);
  line-height: 1;
}
.challenge-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.16);
}
.challenge-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--warning), var(--success));
}
.time-challenge-end-card {
  display: grid;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(59, 230, 168, 0.45);
  border-radius: 18px;
  background: rgba(59, 230, 168, 0.1);
  overflow-wrap: anywhere;
}
.time-challenge-end-card h3 {
  margin: 0;
}
.time-challenge-end-card p {
  margin: 0;
  overflow-wrap: anywhere;
}
.time-challenge-timer span {
  min-width: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 430px) {
  .editor-card .time-challenge-timer,
  .time-challenge-card,
  .daily-challenge-actions {
    width: 100%;
  }
  .editor-card .time-challenge-timer {
    align-items: flex-start;
    flex-direction: column;
  }
}


.hero { position: relative; overflow: hidden; }
.hero::after { content: "SELECT * FROM quest_log"; position: absolute; right: 24px; bottom: 14px; color: rgba(216,255,240,0.08); font: 800 0.8rem/1 "SFMono-Regular", Consolas, monospace; letter-spacing: 0.08em; }
.level-overview { position: relative; overflow: hidden; }
.level-overview::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(124,92,255,0.08) 1px, transparent 1px), linear-gradient(rgba(124,92,255,0.06) 1px, transparent 1px); background-size: 42px 42px; mask-image: radial-gradient(circle at top right, #000, transparent 60%); }
.level-overview > * { position: relative; }
.level-overview .panel-heading h2::after { content: " · Deine Mission"; color: var(--primary-strong); font-size: 0.86rem; font-weight: 900; letter-spacing: 0.05em; text-transform: uppercase; }
.overview-tabs, .level-section-tabs { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 14px 36px rgba(0,0,0,0.22); }
.overview-tab.active, .overview-tab[aria-selected="true"], .level-section-tab[aria-selected="true"] { box-shadow: 0 10px 24px rgba(57,217,138,0.14); }
.level-section-tab[data-section="beginner"][aria-selected="true"] { border-color: rgba(57,217,138,0.5); background: rgba(57,217,138,0.16); }
.level-section-tab[data-section="advancedJoins"][aria-selected="true"] { border-color: rgba(0,194,255,0.5); background: rgba(0,194,255,0.15); color: #d8f7ff; }
.level-section-tab[data-section="master"][aria-selected="true"] { border-color: rgba(255,209,102,0.55); background: rgba(255,209,102,0.15); color: #fff1bf; }
.level-section { position: relative; padding: var(--space-card); border: 1px solid var(--border); border-radius: 24px; background: rgba(9,12,24,0.28); animation: quest-fade-slide var(--motion-normal); }
.level-section::before { content: ""; position: absolute; inset: 16px auto 16px 8px; width: 3px; border-radius: 999px; background: var(--section-accent, var(--primary)); box-shadow: 0 0 24px var(--section-accent, var(--primary)); opacity: 0.75; }
.level-section.section-beginner { --section-accent: var(--accent-beginner); background: radial-gradient(circle at top left, rgba(57,217,138,0.13), transparent 18rem), rgba(9,12,24,0.3); }
.level-section.section-advancedJoins { --section-accent: var(--accent-advanced); background: radial-gradient(circle at top left, rgba(0,194,255,0.12), transparent 18rem), rgba(9,12,24,0.3); }
.level-section.section-master { --section-accent: var(--accent-master); background: radial-gradient(circle at top left, rgba(255,209,102,0.13), transparent 18rem), rgba(9,12,24,0.3); }
.level-section-heading h3::before { content: attr(data-icon); margin-right: 8px; }
.level-section-heading span, .info-progress, .status-badge, .pill { box-shadow: inset 0 1px 0 rgba(255,255,255,0.07); }
.level-button, .badge-card, .learning-overview-card, .time-challenge-card, .path-card, .schema-card { transition: transform var(--motion-normal), border-color var(--motion-normal), box-shadow var(--motion-normal), background var(--motion-normal); }
.level-button { position: relative; overflow: hidden; background: linear-gradient(180deg, rgba(255,255,255,0.075), rgba(255,255,255,0.035)), var(--card-light); }
.level-button::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--primary), #00c2ff); opacity: 0.75; }
.level-button:hover:not(.locked), .badge-card:hover, .learning-overview-card:hover, .time-challenge-card:hover, .path-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.level-button.solved::before { background: linear-gradient(90deg, var(--success), #00c2ff); }
.level-stars, .success-modal-stars { text-shadow: 0 0 18px rgba(255,209,102,0.38); }
.progress-card { position: relative; overflow: hidden; box-shadow: 0 16px 44px rgba(0,0,0,0.18), var(--card-glow); }
.progress-card::after { content: ""; position: absolute; inset: auto 14px 12px auto; width: 74px; height: 34px; pointer-events: none; opacity: 0.18; background: linear-gradient(90deg, transparent 12px, currentColor 12px 14px, transparent 14px), linear-gradient(currentColor 0 0) left 8px top 8px/54px 2px no-repeat, linear-gradient(currentColor 0 0) left 8px top 18px/38px 2px no-repeat; color: #d8fff0; }
.daily-challenge-card { border-color: rgba(255,139,209,0.5); background: radial-gradient(circle at top right, rgba(255,139,209,0.16), transparent 16rem), linear-gradient(135deg, rgba(255,204,102,0.12), rgba(124,92,255,0.1)); }
.daily-challenge-card .progress-header span:first-child::before { content: "✦ "; color: var(--accent-challenge); }
.daily-challenge-title { color: var(--text); }
.daily-challenge-meta span { padding: 5px 9px; border: 1px solid rgba(255,255,255,0.12); border-radius: 999px; background: rgba(255,255,255,0.045); }
.time-challenge-card { border-color: rgba(255,139,209,0.5); background: radial-gradient(circle at top right, rgba(255,139,209,0.18), transparent 16rem), rgba(255,209,102,0.1); }
.editor-card .time-challenge-timer { box-shadow: 0 0 0 3px rgba(255,209,102,0.08), 0 18px 44px rgba(255,139,209,0.12); }
.badges-card { background: radial-gradient(circle at top right, rgba(255,209,102,0.16), transparent 18rem), rgba(255,209,102,0.08); }
.badge-card.unlocked .badge-icon { background: linear-gradient(135deg, rgba(57,217,138,0.28), rgba(0,194,255,0.16)); box-shadow: 0 0 22px rgba(57,217,138,0.16); }
.completion-stats div, .score-card { background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.035)); }
@keyframes quest-fade-slide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes quest-progress-shine { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.001ms !important; } button:hover:not(:disabled), .level-button:hover:not(.locked), .badge-card:hover, .learning-overview-card:hover, .time-challenge-card:hover, .path-card:hover { transform: none; } }
@media (max-width: 430px) { .level-overview .panel-heading h2::after { display:block; margin-top:4px; } .daily-challenge-meta span { width: 100%; } .level-section { padding: 14px; } .level-section::before { inset: 12px auto 12px 5px; } }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 18px;
}
.dashboard-card {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 22px;
  padding: 20px;
  background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.035));
  box-shadow: 0 18px 42px rgba(0,0,0,0.20);
  min-width: 0;
}
.dashboard-card h3 { margin-top: 0; }
.next-mission-card {
  grid-row: span 2;
  padding: 28px;
  border-color: rgba(57,217,138,0.42);
  background: radial-gradient(circle at top right, rgba(57,217,138,0.18), transparent 17rem), linear-gradient(145deg, rgba(124,92,255,0.18), rgba(255,255,255,0.04));
}
.next-mission-card h3 { font-size: clamp(1.6rem, 6vw, 2.6rem); line-height: 1.05; }
.challenge-card { position: relative; overflow: hidden; }
.daily-dashboard-card { border-color: rgba(255,139,209,0.45); background: radial-gradient(circle at top right, rgba(255,139,209,0.18), transparent 14rem), rgba(255,255,255,0.05); }
.time-dashboard-card { border-color: rgba(0,194,255,0.42); background: radial-gradient(circle at top right, rgba(0,194,255,0.16), transparent 14rem), rgba(255,255,255,0.05); }
.progress-dashboard-card { grid-column: 1 / -1; }
.dashboard-card .primary-button,
.dashboard-card .secondary-button { min-height: 44px; margin-top: 8px; }
@media (max-width: 760px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .next-mission-card, .progress-dashboard-card { grid-column: auto; grid-row: auto; }
}
@media (max-width: 430px) {
  .dashboard-card { padding: 16px; border-radius: 18px; }
  .next-mission-card { padding: 20px; }
  .dashboard-grid { gap: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .dashboard-card, .next-mission-card { transition: none; animation: none; }
}
