:root {
  --bg: #f5f7fb;
  --bg-accent: #eef4ff;
  --surface: rgba(255,255,255,0.88);
  --surface-strong: #ffffff;
  --surface-2: #f4f7ff;
  --text: #182230;
  --heading: #101828;
  --muted: #5f6f85;
  --accent: #6ea8ff;
  --accent-2: #8ee0d4;
  --accent-3: #e7f2ff;
  --line: rgba(110, 168, 255, 0.18);
  --line-strong: rgba(110, 168, 255, 0.26);
  --card-front: #ebf5ff;
  --card-back: #fff4e6;
  --border-front: #bdd9ff;
  --border-back: #bfe8cf;
  --card-text-front: #182230;
  --card-text-back: #182230;
  --success: #229268;
  --danger: #d85d75;
  --warning: #e7a52a;
  --shadow: 0 18px 40px rgba(16, 24, 40, 0.08);
  --shadow-soft: 0 8px 20px rgba(16, 24, 40, 0.05);
}

.binary {
  font-family: Consolas, "Courier New", monospace;
  display: inline-block;
  line-height: 1.4;  
  font-size: 1.5rem;
  white-space: pre;  
}

body.dark {
  --bg: #09111f;
  --bg-accent: #10233f;
  --surface: rgba(22, 34, 56, 0.84);
  --surface-strong: #18263f;
  --surface-2: #12213a;
  --text: #edf2ff;
  --heading: #ffffff;
  --muted: #b5c2d8;
  --accent: #8eb4ff;
  --accent-2: #80dccf;
  --accent-3: #203556;
  --line: rgba(142, 180, 255, 0.16);
  --line-strong: rgba(142, 180, 255, 0.24);
  --card-front: #2c4672;
  --card-back: #21483e;
  --border-front: #80aaf4;
  --border-back: #63c593;
  --card-text-front: #f6f8ff;
  --card-text-back: #f6f8ff;
  --success: #56c894;
  --danger: #ff9aad;
  --warning: #f5c560;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.2);
}

body.theme-lilac {
  --accent: #b79ced;
  --accent-2: #f0bfd8;
  --accent-3: #f7f0ff;
  --card-front: #efe3ff;
  --card-back: #ffe3ef;
  --border-front: #c9a8ff;
  --border-back: #f0a8c8;
}

.binary-block {
  font-family: Consolas, monospace;
  font-size: 1.4rem;
  background: #f5f7fa;
  padding: 12px 16px;
  border-radius: 8px;
  display: inline-block;
  margin: 10px 0;
  line-height: 1.4;
  text-align: left;
}

body.theme-warm {
  --accent: #ef67d2;     /* your pink */
  --accent-2: #ffd5ab;   /* your peach */
  --accent-3: #fff0f8;
  --card-front: #fff1c7;
  --card-back: #ffe1cc;
  --border-front: #e7bf57;
  --border-back: #e7a978;
}

body.theme-ocean {
  --accent: #71adff;
  --accent-2: #89ded1;
  --accent-3: #e8f5ff;
  --card-front: #dcebff;
  --card-back: #d8f7ee;
  --border-front: #9fc6ff;
  --border-back: #8ddcc0;
}

body.theme-forest {
  --accent: #80cfa9;
  --accent-2: #b6e0c5;
  --accent-3: #eef9f2;
  --card-front: #e2f5e8;
  --card-back: #f0f8d8;
  --border-front: #9fd1b5;
  --border-back: #c9dea0;
}

body.theme-sunset {
  --accent: #ef67d2;
  --accent-2: #ffd5ab;
  --accent-3: #fff0f8;
  --card-front: #ffe3f7;
  --card-back: #fff1df;
  --border-front: #ef9fe0;
  --border-back: #f2c8a2;
}

body.dark.theme-lilac,
body.dark.theme-warm,
body.dark.theme-ocean,
body.dark.theme-forest,
body.dark.theme-sunset {
  --card-text-front: #f6f8ff;
  --card-text-back: #f6f8ff;
}

body.dark .site-notice {
  background: var(--surface-strong);
  color: var(--text);
  border-color: var(--line);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 18%, transparent), transparent 35%),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; }
h1, h2, h3 { color: var(--heading); }
p { line-height: 1.5; }

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

header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--line);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
}

.brand {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.site-notice {
  margin: 0 0 18px 0;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid #d8dee9;
  background: #f8fafc;
  font-size: 0.95rem;
}



.brand a {
  display: inline-block;
  padding: 6px 2px;
}

.nav-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px 14px;
  align-items: center;
}

.nav-links,
.nav-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-link,
.button,
button {
  border: 1px solid color-mix(in srgb, var(--line) 55%, var(--accent) 45%);
  background: color-mix(in srgb, var(--surface-strong) 92%, var(--accent-3));
  color: var(--text);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}

.nav-link { font-weight: 700; }

.nav-link:hover,
.button:hover,
button:hover,
select:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(0,0,0,0.15);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #102033;
}

body.dark .nav-link.active,
body.dark .btn-primary,
body.dark button.btn-primary,
body.dark .level-switch a.active,
body.dark .level-switch a:hover,
body.dark .topic-chip.active,
body.dark .topic-chip:hover {
  color: var(--heading);
}

button { cursor: pointer; }

.button,
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: 14px;
  transition: all 0.2s ease;
}

.btn-primary,
button.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #102033;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: color-mix(in srgb, var(--surface-strong) 85%, var(--accent-3));
  color: var(--text);
  font-size: 1.05rem;
  padding: 12px 18px;
  border-radius: 16px;
  border: 2px solid var(--accent);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

.hero-button {
  font-size: 1.15rem;
  padding: 18px 26px;
  border-radius: 20px;
  border: 2px solid var(--accent);
  box-shadow: 0 10px 26px rgba(0,0,0,0.18);
  transition: all 0.2s ease;
  min-width: 220px;
}

.hero-button:hover {
  transform: translateY(-6px) scale(1.04);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #102033;
  box-shadow: 0 18px 40px rgba(0,0,0,0.25);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-soft);
}

.hero,
.panel {
  background: var(--surface);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 30px;
  margin: 28px 0;
  border: 1px solid var(--line);
}

.hero.compact { padding: 22px 24px; }

.hero h1 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
}

.hero p { max-width: 65ch; }

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.page-head .actions { margin-top: 0; }

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

.card,
.topic-card,
.stat,
.mini-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.topic-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
}

.topic-card h3,
.card h3,
.stat h3,
.mini-card h3 { margin: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 20%, var(--surface-strong));
  color: var(--heading);
  font-size: 0.86rem;
  font-weight: 700;
  border: 1px solid var(--line);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.actions.push-bottom { margin-top: auto; }

.actions .btn-secondary[href="practice.html"],
.actions .btn-primary[href="practice.html"] {
  min-width: 108px;
}

.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 0.95rem; }

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 700;
}

.callout {
  padding: 12px 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid var(--line);
}

.level-switch,
.topic-chip-row {
  display: inline-flex;
  flex-wrap: wrap;
  background: color-mix(in srgb, var(--surface-strong) 76%, var(--accent-3));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 6px;
  gap: 6px;
  box-shadow: var(--shadow-soft);
}

.level-switch a,
.topic-chip {
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
}

.level-switch a.active,
.level-switch a:hover,
.topic-chip.active,
.topic-chip:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #102033;
}

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

.summary-grid .mini-card p { margin-bottom: 0; }

.flashcard-wrap { display: grid; gap: 18px; }

.flashcard {
  width: min(760px, 100%);
  margin: 0 auto;
  height: 350px;
  perspective: 1200px;
}

.flashcard-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.75s ease;
}

.flashcard.flip .flashcard-inner { transform: rotateY(180deg); }

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px 28px 28px 28px;
  text-align: center;
  box-shadow: var(--shadow);
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  line-height: 1.4;
}

.flashcard-front {
  background: var(--card-front);
  border: 2px solid var(--border-front);
  color: var(--card-text-front);
}

.flashcard-back {
  background: var(--card-back);
  border: 2px solid var(--border-back);
  color: var(--card-text-back);
  transform: rotateY(180deg);
  white-space: pre-wrap;
  font-family: monospace;
  text-align: center;
  align-items: center;
}

.flashcard-tip {
  text-align: center;
  color: var(--muted);
  margin-top: 12px;
}

.truth-table {
  margin: 18px auto;
  border-collapse: collapse;
  width: 340px;
  max-width: 92%;
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  overflow: hidden;
}

.truth-table th {
  background: rgba(255,255,255,0.08);
  color: var(--heading);
  padding: 12px;
  border: 2px solid var(--line);
  text-align: center;
  font-size: 1.05rem;
}

.truth-table td {
  height: 52px;
  border: 2px solid var(--line);
  text-align: center;
  vertical-align: middle;
  font-size: 1.15rem;
}



.quiz-shell { display: grid; gap: 20px; }

.quiz-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease;
}

.feedback-box {
  min-height: 60px;
  margin-top: 20px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  white-space: pre;
  line-height: 1.5;
  font-family: Consolas, "Courier New", monospace;
}

.feedback-box.correct {
  background: color-mix(in srgb, var(--success) 15%, var(--surface));
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  border-left: 6px solid var(--success);
}

.feedback-box.incorrect {
  background: color-mix(in srgb, var(--danger) 13%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 38%, transparent);
  border-left: 6px solid var(--danger);
}


.code-block {
  font-family: Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.6;
}

.quiz-option {
  width: 100%;
  text-align: left;
  margin: 8px 0;
  padding: 14px 16px;
  background: var(--surface-strong);
}

.quiz-option.correct {
  outline: 2px solid var(--success);
  background: color-mix(in srgb, var(--success) 13%, var(--surface));
}

.quiz-option.incorrect {
  outline: 2px solid var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}

.quiz-option:disabled {
  cursor: default;
  opacity: 1;
}

.result-score {
  font-size: clamp(2rem, 6vw, 3.4rem);
  margin: 8px 0;
  color: var(--heading);
}

.practice-shell .hero { margin-bottom: 20px; }

.practice-panel {
  max-width: 720px;
  margin: 0 auto;
}

.practice-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.practice-toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
  margin: 14px 0 8px;
  flex-wrap: wrap;
}

.difficulty-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.practice-select {
  min-width: 160px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
}

.practice-select:focus {
  outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-color: var(--accent);
}

.practice-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--text);
  font-size: 1.05rem;
  box-shadow: var(--shadow-soft);
  margin-top: 10px;
}

.practice-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.controls-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group label,
.control-group > span {
  font-weight: 600;
}

/* Dropdown only */
.control-group select {
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid var(--accent);
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 600;
  min-width: 180px;
  box-shadow: var(--shadow-soft);
}

/* Answer box stays simple */
#answer {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 1rem;
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.question-card {
  margin-top: 10px;
  padding: 24px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border: 1px solid #e5e7eb;
}

.control-group select:hover,
.control-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.question-card h2 {
  margin-bottom: 10px;
  font-size: 0.9rem;
  letter-spacing: 1px;
  color: #6b7280;
}

.question-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.question-text {
  font-size: 1.4rem;
  line-height: 1.6;
  font-weight: 600;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    rgba(110, 168, 255, 0.18),
    rgba(142, 224, 212, 0.12)
  );
  border: 1px solid rgba(110, 168, 255, 0.2);
  margin-top: 10px;
  font-family: "Courier New", monospace;
  color: var(--heading);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.top-gap { margin-top: 20px; }

footer {
  padding: 16px 0 42px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .navbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-stack { justify-content: flex-start; }
  .flashcard { height: 300px; }

  .hero,
  .panel {
    padding: 22px;
    border-radius: 24px;
  }

  .practice-meta {
    align-items: flex-start;
    flex-direction: column;
  }
}

.practice-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.stat-box {
  background: #f3f4f6;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
}


.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.topic-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: all 0.22s ease;
  overflow: hidden;
  position: relative;
}

.topic-card:hover {
  background: color-mix(in srgb, var(--surface) 88%, var(--accent-3));
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 18px 36px rgba(0,0,0,0.22);
  border-color: var(--accent);
}

/* Large answer box for exam-style topics only */
#answer.exam-answer {
  width: 100%;
  min-height: 180px;
  line-height: 1.5;
  resize: vertical;
}




body.dark h1,
body.dark h2,
body.dark h3,
body.dark .kicker,
body.dark .badge,
body.dark .topic-card h3,
body.dark .hero h1,
body.dark .page-head h1 {
  color: #f5f7fb;
}

body.dark .muted,
body.dark .topic-card .muted,
body.dark .hero .muted,
body.dark #cardCounter,
body.dark .flashcard-tip,
body.dark footer,
body.dark .small {
  color: #cbd5e1;
}

body.dark .flashcard-front {
  background: #2c4672;
  border-color: #80aaf4;
  color: #f6f8ff;
}

body.dark .flashcard-back {
  background: #21483e;
  border-color: #63c593;
  color: #f6f8ff;
}


.image-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 14px;
  margin: 18px 0 8px;
}

.image-option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.image-option:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.image-option img {
  max-width: 100%;
  max-height: 82px;
  object-fit: contain;
}

.image-option.correct {
  border-color: var(--success);
}

.image-option.incorrect {
  border-color: var(--danger);
}


.final-message {
  background: #fff3cd;
  border-left: 5px solid #f0ad4e;
  padding: 12px 16px;
  margin-top: 10px;
  font-weight: 600;
  border-radius: 6px;
}

/* Algorithm mode buttons */
#algorithmModeButtons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  max-width: 620px;
}

#algorithmModeButtons .button {
  flex: 1 1 240px;
  padding: 14px 18px;
  border-radius: 16px;
  border: 2px solid var(--accent);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

#algorithmModeButtons .button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

#algorithmModeButtons .btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #102033;
  border-color: transparent;
}

/* Flowchart mode buttons */
#flowchartModeButtons .button {
  min-width: 180px;
  font-weight: 600;
  border-radius: 10px;
  padding: 10px 14px;
  border: 2px solid var(--accent);
  background: var(--surface-2);
  color: var(--text);
  transition: all 0.2s ease;
}


#flowchartModeButtons .button:hover {
  background: var(--accent);
  color: white;
  transform: translateY(-1px);
}



body.dark .practice-panel,
body.dark .question-card,
body.dark .practice-stats .stat-box,
body.dark #feedback {
  background: var(--surface-strong);
  color: var(--text);
}

body.dark .practice-input {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line-strong);
}

body.dark .practice-input::placeholder {
  color: var(--muted);
}


body.dark .question-card {
  border: 1px solid var(--line);
}

body.dark .practice-stats .stat-box {
  border: 1px solid var(--line);
}


.flowchart-solution {
  background: #ffffff;
  padding: 12px;
  border-radius: 12px;
  display: inline-block;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border: 2px solid var(--line-strong);
}

/* Pseudocode hints / feedback mobile wrapping */
#feedback {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#feedback br {
  display: block;
}


.trace-missing {
  color: #ff6b6b;
  font-weight: bold;
}


.flowchart-solution img {
  max-width: 100%;
  max-height: 300px;   /* controls height */
  width: auto;
  display: block;
  margin: 0 auto;
  border-radius: 12px;
}


#showTraceAnswerBtn {
  width: auto;
  padding: 10px 18px;
  font-size: 1rem;
  display: inline-block;
}


#imageOptions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}


/* Clean dropdown style */
select {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.95rem;
}


/* Fix dropdown container + alignment */
.control-group {
  align-items: flex-start;
}

.control-group select {
  height: 42px;
  padding: 6px 10px;
  font-size: 0.95rem;
  border-radius: 10px;
}


/* Space below dropdown */
.mode-control {
  margin-bottom: 16px;
}


/* Make dropdown stand out a bit */
#mode {
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent);
}


/* Add horizontal space between dropdown area and standard method buttons */
.mode-control {
  margin-right: 28px;
}

/* Space between heading text and dropdown */
.mode-instructions {
  margin-bottom: 8px;
}


.answer-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#arrowBtn {
  padding: 6px 10px;
  font-size: 1rem;
}

.arrow-help {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Practice difficulty dropdown: match mode dropdown size */
#difficulty.practice-select {
  width: auto;
  min-width: 140px;
  height: 42px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.95rem;
  margin-bottom: 12px;
}



/* ===== SEARCH-01 ===== */

.search-section {
  margin: 24px 0;
}

.search-section input {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
}

#searchResults {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.search-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.search-result:hover {
  transform: translateY(-1px);
}

.search-result span {
  font-size: 0.85rem;
  opacity: 0.7;
}


/* ===== SEARCH-POLISH-01 ===== */

.search-section {
  margin: 32px 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(135deg, var(--card), var(--bg));
  box-shadow: var(--shadow);
}

.search-section h2 {
  margin: 0 0 6px;
}

.search-section p {
  margin-top: 0;
  margin-bottom: 14px;
}

.search-section input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  border: 2px solid var(--accent);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
}

.search-section input:focus {
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent);
}

#searchResults {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.search-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.search-result:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.search-result span {
  font-size: 0.85rem;
  opacity: 0.75;
}


/* ===== BOOLEAN BUTTON FIX ===== */
#booleanModeButtons .button-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

#booleanModeButtons .button {
  width: 100%;
  text-align: center;
}


/* ===== SHORTS-PAGE-01 ===== */

.shorts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.short-card {
  background: var(--card-bg, #ffffff);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.short-video-wrapper {
  aspect-ratio: 9 / 16;
  width: 100%;
  max-width: 360px;
  margin: 0 auto 1rem auto;
}

.short-video-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 16px;
}

.short-card h3 {
  margin-bottom: 0.5rem;
}
