:root {
  color-scheme: light;
  --ink: #0b1638;
  --muted: #59677f;
  --line: #dce6f5;
  --soft-line: #edf2fa;
  --panel: #ffffff;
  --canvas: #f6f8fc;
  --blue: #2166e8;
  --blue-strong: #0e55d8;
  --green: #3dbb65;
  --teal: #28b8b6;
  --purple: #7b55e7;
  --orange: #ff8b22;
  --yellow: #e9ad08;
  --red: #ef4b55;
  --shadow: 0 16px 38px rgba(30, 65, 120, 0.11);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf4ff;
  --muted: #aebbd2;
  --line: #2a3a56;
  --soft-line: #1f2d43;
  --panel: #101a2d;
  --canvas: #071121;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; align-self: start; height: 100vh; border-right: 1px solid var(--line); background: var(--panel); padding: 26px 20px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--blue); font-size: 1.35rem; font-weight: 900; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 9px; background: var(--blue); color: #fff; box-shadow: 0 10px 22px rgba(33, 102, 232, 0.25); font-size: 0.82rem; }
.side-nav { display: grid; gap: 10px; margin-top: 34px; }
.side-link { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; min-height: 58px; border: 1px solid transparent; border-radius: 12px; color: #17233f; padding: 0 12px; font-weight: 750; }
.side-link span { display: grid; width: 30px; height: 30px; place-items: center; color: var(--blue); font-size: 0.76rem; }
.side-link:hover, .side-link.active { border-color: #b8d0ff; background: #eef5ff; color: var(--blue); }
:root[data-theme="dark"] .side-link { color: #dce8ff; }
:root[data-theme="dark"] .side-link:hover, :root[data-theme="dark"] .side-link.active { background: #122342; }
.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: auto minmax(360px, 1fr) auto; gap: 18px; align-items: center; min-height: 84px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.94); padding: 0 30px; backdrop-filter: blur(18px); }
:root[data-theme="dark"] .topbar { background: rgba(16, 26, 45, 0.94); }
.breadcrumb { display: flex; align-items: center; gap: 12px; color: var(--muted); white-space: nowrap; }
.breadcrumb strong { color: var(--ink); }
.topbar-controls { display: grid; grid-template-columns: 160px 220px minmax(220px, 1fr); gap: 14px; }
.select-wrap, .search-box { display: flex; align-items: center; min-height: 48px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.select-wrap select, .search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); padding: 0 14px; }
.search-box span { color: var(--muted); padding-left: 14px; font-size: 0.82rem; }
.profile-box { display: flex; align-items: center; gap: 12px; }
.profile-box small { display: block; color: var(--muted); margin-top: 2px; }
.avatar { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50%; background: linear-gradient(135deg, #ffcf9a, #f2f5ff); color: #17345f; font-weight: 900; }
.mode-button, .primary-action, .secondary-action, .ghost-button, .swap-button { display: inline-grid; min-height: 44px; place-items: center; border-radius: 9px; font-weight: 850; }
.mode-button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 0 12px; }
.primary-action { border: 0; background: var(--blue); color: #fff; padding: 0 18px; box-shadow: 0 12px 22px rgba(33, 102, 232, 0.22); }
.primary-action:hover { background: var(--blue-strong); }
.secondary-action, .ghost-button, .swap-button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 0 14px; }
main { padding: 24px 30px 34px; }
.hero-grid { display: grid; grid-template-columns: minmax(380px, 1.05fr) minmax(480px, 1.35fr); gap: 18px; }
.hero-card, .converter-card, .tool-grid-section, .table-shell, .category-strip, .formula-shell, .code-shell, .quick-levels { border: 1px solid var(--soft-line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.hero-card { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 18px; overflow: hidden; min-height: 310px; padding: 30px 26px; background: linear-gradient(135deg, #eef6ff, #ffffff 60%, #eef7ff); }
:root[data-theme="dark"] .hero-card { background: linear-gradient(135deg, #11223f, #101a2d 60%, #0d253d); }
.eyebrow { margin: 0 0 10px; color: var(--blue); font-size: 0.76rem; font-weight: 900; letter-spacing: 0; text-transform: uppercase; }
h1 { margin-bottom: 14px; max-width: 620px; font-size: clamp(2.1rem, 4vw, 3.1rem); line-height: 1.18; letter-spacing: 0; }
h1 span:nth-of-type(1) { color: var(--green); } h1 span:nth-of-type(2) { color: var(--blue); } h1 span:nth-of-type(3) { color: var(--purple); }
h2 { margin-bottom: 0; font-size: 1.45rem; line-height: 1.2; letter-spacing: 0; }
h3 { margin-bottom: 0; font-size: 1.08rem; line-height: 1.22; }
.hero-card p, .section-note, .converter-title p, .learning-card p, .formula-grid span { color: var(--muted); line-height: 1.55; }
.hero-note { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; max-width: 420px; margin-top: 28px; border: 1px solid #b8d0ff; border-radius: 12px; background: rgba(235, 244, 255, 0.75); color: var(--blue); padding: 15px 16px; }
.hero-note span { color: #27518d; font-weight: 700; }
:root[data-theme="dark"] .hero-note span { color: #bdd4ff; }
.hero-visual { position: relative; min-height: 240px; }
.math-card, .book-card, .pencil-card { position: absolute; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.9); box-shadow: var(--shadow); color: var(--blue); font-weight: 900; }
.math-card { width: 110px; height: 90px; right: 20px; top: 10px; } .book-card { width: 150px; height: 90px; right: 42px; bottom: 18px; color: var(--orange); } .pencil-card { width: 82px; height: 70px; left: 0; bottom: 60px; color: var(--purple); }
:root[data-theme="dark"] .math-card, :root[data-theme="dark"] .book-card, :root[data-theme="dark"] .pencil-card { background: #101a2d; }
.featured-converter { padding: 24px; }
.converter-title { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; margin-bottom: 22px; }
.panel-icon, .card-icon, .tool-icon { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 12px; background: linear-gradient(135deg, var(--blue), #4f99ff); color: #fff; font-size: 0.82rem; font-weight: 950; }
.badge { display: inline-grid; min-height: 34px; place-items: center; border-radius: 999px; padding: 0 14px; font-size: 0.82rem; font-weight: 850; }
.badge.amber { border: 1px solid #ffd99e; background: #fff6df; color: #cc7500; }
.converter-form { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(170px, 1fr) 54px minmax(150px, 1fr) minmax(170px, 1fr); gap: 12px; align-items: end; }
.field, .code-field { display: grid; gap: 8px; }
.field span, .code-field span { color: #263651; font-size: 0.88rem; font-weight: 850; }
:root[data-theme="dark"] .field span, :root[data-theme="dark"] .code-field span { color: #dce8ff; }
.field input, .field select, .code-field textarea { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); padding: 10px 12px; outline: 0; }
.swap-button { width: 54px; min-height: 54px; color: var(--blue); font-size: 1.4rem; }
.result-action-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; margin-top: 16px; border: 1px solid #bfe9d5; border-radius: 10px; background: #effcf6; padding: 12px; }
.result-box { display: block; min-height: 52px; white-space: pre-wrap; color: #0c5b31; font-weight: 800; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 20px 22px; }
.tool-grid-section, .table-shell, .quick-levels, .category-strip, .formula-shell, .code-shell { margin-top: 18px; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 0 22px 22px; }
.learning-card { display: grid; grid-template-columns: 58px minmax(0, 1fr); grid-template-rows: auto auto auto; gap: 4px 14px; align-items: start; min-height: 150px; border: 1px solid var(--soft-line); border-radius: 12px; background: var(--panel); color: var(--ink); padding: 18px; text-align: left; box-shadow: 0 8px 22px rgba(30, 65, 120, 0.06); }
.learning-card:hover { border-color: #aecaFF; transform: translateY(-1px); }
.learning-card strong { align-self: end; font-size: 1.02rem; }
.learning-card p { grid-column: 2; margin-bottom: 6px; font-size: 0.9rem; }
.learning-card small { grid-column: 2; justify-self: start; border-radius: 999px; background: #e9f8ee; color: #15803d; padding: 3px 9px; font-weight: 850; }
.learning-card.dashed { border-style: dashed; border-color: #8db7ff; background: #f8fbff; }
.tool-icon.green, .card-icon.green { background: var(--green); } .tool-icon.teal, .card-icon.teal { background: var(--teal); } .tool-icon.orange { background: var(--orange); } .tool-icon.purple, .card-icon.purple { background: var(--purple); } .tool-icon.yellow { background: var(--yellow); } .tool-icon.red, .card-icon.red { background: var(--red); } .tool-icon.pale { background: #eef5ff; color: var(--blue); border: 1px solid #b8d0ff; }
.table-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.compact-select { width: 110px; }
.table-output { padding: 0 22px 22px; overflow: auto; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.learning-table { width: 100%; border-collapse: collapse; min-width: 720px; background: var(--panel); }
.learning-table th, .learning-table td { border: 1px solid var(--soft-line); padding: 9px 10px; text-align: center; white-space: nowrap; }
.learning-table th { position: sticky; top: 0; background: #eef5ff; color: #17345f; font-weight: 900; }
.learning-table td:first-child, .learning-table th:first-child { position: sticky; left: 0; background: #f8fbff; font-weight: 900; }
.table-caption { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 12px; color: var(--muted); }
.quick-levels { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 20px; }
.quick-levels button { border: 0; border-radius: 999px; background: #eef5ff; color: var(--blue); padding: 10px 16px; font-weight: 900; }
.quick-levels button span { margin-left: 6px; color: var(--muted); font-weight: 700; }
.category-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 18px; }
.category-card { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; align-items: center; border: 1px solid var(--soft-line); border-radius: 12px; background: var(--panel); color: var(--ink); padding: 14px; text-align: left; }
.category-card:hover, .category-card.active { border-color: #aecaFF; background: #f8fbff; }
.category-card small { display: block; color: var(--muted); margin-top: 3px; }
.formula-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0 22px 22px; }
.formula-grid article { display: grid; gap: 8px; border: 1px solid var(--soft-line); border-radius: 12px; padding: 16px; background: var(--panel); }
.code-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr) minmax(0, 1fr); gap: 18px; padding: 0 22px 22px; }
.code-panel { border: 1px solid var(--soft-line); border-radius: 12px; background: var(--panel); padding: 18px; }
.code-controls { display: grid; grid-template-columns: 1fr 54px 1fr; gap: 10px; align-items: end; margin-bottom: 14px; }
.code-field textarea { min-height: 250px; background: #07111f; color: #d8ecff; font-family: "Cascadia Code", Consolas, monospace; line-height: 1.55; resize: vertical; }
.prompt-field textarea { min-height: 170px; background: #f8fbff; color: var(--ink); font-family: inherit; }
.code-result { min-height: 330px; margin: 0; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #07111f; color: #d8ecff; padding: 16px; font-family: "Cascadia Code", Consolas, monospace; font-size: 0.92rem; line-height: 1.55; }
.quick-examples { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.quick-examples button { min-height: 34px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--blue); padding: 0 12px; font-weight: 850; }
.code-examples { border-top: 1px solid var(--soft-line); padding: 0 22px 22px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 30; max-width: min(360px, calc(100vw - 40px)); border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 13px 14px; box-shadow: var(--shadow); color: var(--ink); font-weight: 800; }
.is-hidden { display: none !important; }
@media (max-width: 1280px) { .app-shell { grid-template-columns: 86px minmax(0, 1fr); } .sidebar { padding: 20px 12px; } .brand span:last-child, .side-link { font-size: 0; } .side-link { grid-template-columns: 1fr; justify-items: center; } .side-link span { font-size: 0.68rem; } .topbar { grid-template-columns: 1fr; padding: 14px 20px; } .topbar-controls { grid-template-columns: 1fr 1fr; } .search-box { grid-column: 1 / -1; } .hero-grid, .tool-grid, .category-strip, .formula-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .code-layout { grid-template-columns: 1fr; } .converter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .swap-button { width: 100%; } }
@media (max-width: 760px) { .app-shell { display: block; } .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); } .brand span:last-child { display: inline; font-size: 1.2rem; } .side-nav { grid-template-columns: repeat(3, 1fr); margin-top: 18px; } .side-link { min-height: 48px; padding: 8px; } .topbar { position: static; } .topbar-controls, .hero-grid, .hero-card, .tool-grid, .category-strip, .formula-grid, .converter-form { grid-template-columns: 1fr; } main { padding: 16px; } .hero-visual { display: none; } .converter-title, .result-action-row, .section-heading { display: grid; grid-template-columns: 1fr; } .badge { justify-self: start; } .learning-card { grid-template-columns: 52px minmax(0, 1fr); } .quick-levels { display: grid; } }

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

.featured-converter .swap-button {
  grid-column: 1 / -1;
  justify-self: center;
  width: 54px;
}

.hero-note {
  grid-template-columns: 1fr;
}

body {
  overflow-x: hidden;
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
  }

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

  .side-link {
    font-size: 0.82rem;
    min-width: 0;
  }

  .side-link span {
    display: none;
  }

  .topbar-controls,
  .profile-box,
  .hero-card,
  .featured-converter,
  .tool-grid-section,
  .table-shell,
  .quick-levels,
  .category-strip,
  .formula-shell,
  .code-shell {
    min-width: 0;
  }

  h1 {
    font-size: 1.82rem;
    line-height: 1.22;
    overflow-wrap: anywhere;
  }

  .hero-card {
    padding: 22px;
  }

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

  .profile-box {
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .app-shell,
  .workspace,
  main,
  .sidebar,
  .topbar,
  .hero-grid,
  .hero-card,
  .featured-converter {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .hero-card > div,
  .featured-converter > div,
  .converter-title > div {
    min-width: 0;
  }

  .hero-card p,
  .converter-title p,
  .learning-card p {
    overflow-wrap: anywhere;
  }

  h1,
  h2,
  h3 {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 760px) {
  .hero-card h1 {
    max-width: 300px;
    font-size: 1.55rem;
    line-height: 1.26;
  }

  .hero-card p {
    max-width: 300px;
    font-size: 0.95rem;
  }

  .hero-note {
    max-width: 300px;
  }
}

.topbar-controls > .select-wrap {
  display: none;
}

.dropdown-menu {
  position: relative;
  min-width: 160px;
}

.dropdown-trigger {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 38px 0 14px;
  text-align: left;
  font-weight: 750;
}

.dropdown-trigger::after {
  content: "⌄";
  position: absolute;
  right: 14px;
  top: 13px;
  color: var(--muted);
}

.dropdown-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 50;
  display: none;
  width: 100%;
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 8px;
}

.dropdown-menu.open .dropdown-panel {
  display: grid;
  gap: 4px;
}

.dropdown-panel button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 0 10px;
  text-align: left;
  font-weight: 750;
}

.dropdown-panel button:hover {
  background: #eef5ff;
  color: var(--blue);
}

.quiz-shell,
.periodic-shell {
  margin-top: 18px;
  border: 1px solid var(--soft-line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.quiz-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.compact-field {
  width: 130px;
}

.quiz-output {
  padding: 0 22px 22px;
}

.quiz-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quiz-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: #f8fbff;
  padding: 12px;
  font-weight: 850;
}

.quiz-item input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
  padding: 8px 10px;
}

.quiz-item input.correct {
  border-color: #32b56b;
  background: #edfff5;
}

.quiz-item input.wrong {
  border-color: #ef4b55;
  background: #fff1f2;
}

.quiz-score {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 850;
}

.compact-search {
  width: min(360px, 100%);
}

.periodic-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 0 22px 22px;
}

.element-card {
  position: relative;
  min-height: 132px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff, var(--panel));
  padding: 12px;
}

.element-card small {
  color: var(--muted);
  font-weight: 900;
}

.element-card strong {
  display: block;
  margin: 6px 0 2px;
  color: var(--blue);
  font-size: 1.6rem;
}

.element-card span,
.element-card em,
.element-card b {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
  line-height: 1.35;
}

.formula-grid article small {
  color: var(--blue);
  font-weight: 900;
}

@media (max-width: 1280px) {
  .topbar-controls {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 760px) {
  .dropdown-menu,
  .compact-field,
  .compact-search {
    width: 100%;
  }

  .quiz-controls,
  .quiz-list,
  .quiz-item,
  .periodic-grid {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* 20260621-4 refinements */
.featured-converter {
  padding: 18px;
}

.featured-converter .converter-title {
  margin-bottom: 14px;
}

.featured-converter h2 {
  font-size: 1.15rem;
}

.featured-converter .panel-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.featured-converter .badge {
  min-height: 30px;
  font-size: 0.76rem;
}

.featured-converter .field input,
.featured-converter .field select {
  min-height: 42px;
}

.featured-converter .swap-button {
  min-height: 44px;
}

.featured-converter .result-box {
  min-height: 42px;
  font-size: 0.92rem;
}

.formula-grid article em,
.formula-grid article b {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-style: normal;
  line-height: 1.45;
}

.formula-grid article b {
  border-top: 1px solid var(--soft-line);
  padding-top: 8px;
  color: #174c86;
  font-weight: 850;
}

.quiz-single {
  display: grid;
  gap: 16px;
  max-width: 620px;
  border: 1px solid var(--soft-line);
  border-radius: 14px;
  background: #f8fbff;
  padding: 22px;
}

.quiz-progress {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
}

.quiz-question {
  color: var(--ink);
  font-size: 1.8rem;
}

.quiz-answer-field {
  display: grid;
  gap: 8px;
}

.quiz-answer-field span {
  color: var(--muted);
  font-weight: 850;
}

.quiz-answer-field input {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  padding: 10px 12px;
  font-size: 1.15rem;
}

.quiz-next-button {
  justify-self: start;
  min-width: 160px;
}

.quiz-result {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  border: 1px solid #bfe9d5;
  border-radius: 12px;
  background: #effcf6;
  padding: 16px;
}

.quiz-result strong {
  color: #0c5b31;
  font-size: 1.1rem;
}

@media (max-width: 760px) {
  .featured-converter h2 {
    font-size: 1.08rem;
  }

  .quiz-single {
    max-width: 100%;
  }

  .quiz-question {
    font-size: 1.45rem;
  }
}


/* 20260621-5 AI learning suite */
.ai-suite {
  margin-top: 18px;
  border: 1px solid var(--soft-line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.ai-workbench {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) repeat(2, minmax(240px, 0.85fr));
  gap: 14px;
  padding: 0 22px 18px;
}

.ai-input-panel,
.ai-tool-panel {
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff, var(--panel));
  padding: 16px;
}

.ai-input-panel {
  grid-row: span 2;
}

.ai-input-panel textarea {
  min-height: 280px;
  background: var(--panel);
  color: var(--ink);
  font-family: inherit;
}

.ai-inline-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 10px;
  margin-top: 12px;
}

.ai-tool-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.answer-panel textarea {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
  padding: 10px 12px;
  resize: vertical;
}

.ai-tool-head {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.ai-tool-head p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.ai-output {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.generated-item,
.flashcard {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 12px;
}

.generated-item small,
.flashcard small {
  color: var(--blue);
  font-weight: 900;
}

.generated-item p,
.generated-item ol,
.flashcard p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.generated-item b {
  color: #174c86;
}

.flashcard {
  min-height: 130px;
  background: linear-gradient(135deg, #ffffff, #eef5ff);
}

.ai-coming-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid var(--soft-line);
  padding: 16px 22px 22px;
}

.ai-coming-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  border: 1px dashed #aecaFF;
  border-radius: 12px;
  background: #f8fbff;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 850;
}

.ai-coming-links span {
  border-radius: 999px;
  background: #fff6df;
  color: #cc7500;
  padding: 4px 8px;
  font-size: 0.76rem;
}

@media (max-width: 1280px) {
  .ai-workbench {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-input-panel {
    grid-column: 1 / -1;
    grid-row: auto;
  }

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

@media (max-width: 760px) {
  .ai-workbench,
  .ai-inline-controls,
  .ai-coming-links {
    grid-template-columns: 1fr;
  }

  .ai-suite,
  .ai-input-panel,
  .ai-tool-panel {
    min-width: 0;
  }
}


/* 20260621-6 slim utility layout */
:root {
  --shadow: 0 8px 18px rgba(30, 65, 120, 0.07);
}

.hero-card,
.converter-card,
.tool-grid-section,
.table-shell,
.category-strip,
.formula-shell,
.quick-levels,
.quiz-shell,
.periodic-shell,
.ai-suite {
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(30, 65, 120, 0.06);
}

main {
  padding-top: 18px;
}

.hero-grid,
.tool-grid,
.ai-workbench,
.category-strip,
.formula-grid,
.periodic-grid {
  gap: 10px;
}

.hero-card {
  min-height: 230px;
  padding: 20px;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 2.45rem);
}

h2 {
  font-size: 1.18rem;
}

.section-heading {
  padding: 14px 16px;
}

.tool-grid,
.table-output,
.quiz-output,
.periodic-grid,
.formula-grid,
.ai-workbench,
.ai-coming-links {
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 16px;
}

.learning-card {
  grid-template-columns: 38px minmax(0, 1fr);
  min-height: 96px;
  gap: 2px 10px;
  border-radius: 9px;
  padding: 10px 12px;
  box-shadow: none;
}

.learning-card strong {
  font-size: 0.9rem;
}

.learning-card p {
  margin-bottom: 3px;
  font-size: 0.78rem;
  line-height: 1.35;
}

.learning-card small {
  padding: 2px 7px;
  font-size: 0.68rem;
}

.tool-icon,
.panel-icon,
.card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 0.68rem;
}

.ai-input-panel,
.ai-tool-panel,
.formula-grid article,
.element-card,
.generated-item,
.flashcard,
.quiz-single,
.code-panel {
  border-radius: 9px;
  padding: 10px 12px;
  box-shadow: none;
}

.ai-input-panel textarea {
  min-height: 190px;
}

.ai-tool-panel {
  gap: 10px;
}

.ai-tool-head {
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
}

.ai-tool-head h3 {
  font-size: 0.96rem;
}

.ai-tool-head p,
.generated-item p,
.generated-item ol,
.flashcard p,
.formula-grid article em,
.formula-grid article b {
  font-size: 0.78rem;
  line-height: 1.35;
}

.flashcard {
  min-height: 96px;
}

.element-card {
  min-height: 96px;
}

.element-card strong {
  font-size: 1.28rem;
}

.featured-converter {
  padding: 14px;
}

.featured-converter .converter-title {
  margin-bottom: 10px;
}

.field input,
.field select,
.select-wrap,
.search-box,
.dropdown-trigger,
.primary-action,
.secondary-action,
.ghost-button,
.mode-button {
  min-height: 38px;
  border-radius: 8px;
}

.category-table-shell {
  display: block;
  padding: 12px;
}

.category-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}

.category-table th,
.category-table td {
  border: 1px solid var(--soft-line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 0.86rem;
}

.category-table th {
  background: #eef5ff;
  color: #17345f;
  font-weight: 900;
}

.category-table .category-card {
  display: inline-grid;
  min-height: 30px;
  min-width: 74px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--blue);
  padding: 0 12px;
  font-weight: 850;
}

.category-table .category-card.active,
.category-table .category-card:hover {
  border-color: var(--blue);
  background: #eef5ff;
}

@media (max-width: 760px) {
  .learning-card {
    grid-template-columns: 36px minmax(0, 1fr);
    min-height: 88px;
  }

  .category-table {
    min-width: 560px;
  }

  .hero-card {
    padding: 16px;
  }
}


/* 20260621-7 Scratch quiz */
.scratch-shell {
  margin-top: 18px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 6px 16px rgba(30, 65, 120, 0.06);
}

.scratch-output {
  padding: 0 16px 16px;
}

.scratch-question-card {
  display: grid;
  gap: 12px;
  max-width: 760px;
  border: 1px solid var(--soft-line);
  border-radius: 9px;
  background: #f8fbff;
  padding: 14px;
}

.scratch-question {
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.35;
}

.scratch-options {
  display: grid;
  gap: 8px;
}

.scratch-options label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 9px 10px;
  color: var(--ink);
  font-weight: 750;
}

.scratch-options label:hover {
  border-color: #aecaFF;
  background: #eef5ff;
}

.scratch-options input {
  margin: 0;
}

.scratch-next-button {
  justify-self: start;
  min-width: 130px;
}

@media (max-width: 760px) {
  .scratch-question-card {
    max-width: 100%;
  }
}
