:root {
  --ink: #17312d;
  --muted: #637773;
  --cream: #f6f3e9;
  --paper: #fffdf7;
  --green: #123c35;
  --green-2: #1d5a4f;
  --mint: #d7eee7;
  --lime: #d8f07a;
  --orange: #f2a65a;
  --red: #b7483e;
  --line: #dfe5dc;
  --shadow: 0 22px 60px rgba(25, 54, 48, 0.12);
  --radius-lg: 30px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(216, 240, 122, 0.26), transparent 26rem),
    radial-gradient(circle at 90% 70%, rgba(215, 238, 231, 0.7), transparent 28rem),
    var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

button {
  color: inherit;
}

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

.topbar {
  height: 94px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.brand,
.icon-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 15px 15px 15px 5px;
  color: var(--cream);
  background: var(--green);
  font-family: Georgia, serif;
  font-size: 27px;
  font-weight: 700;
  transform: rotate(-3deg);
}

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

.brand strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  line-height: 1;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.icon-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.72);
  font-size: 14px;
  font-weight: 700;
}

.history-badge {
  display: grid;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: var(--green);
  font-size: 11px;
}

.profile-mini {
  display: grid;
  gap: 10px;
  margin-top: 28px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
}

.profile-mini strong {
  color: white;
  font-family: Georgia, serif;
  font-size: 24px;
}

.profile-mini span,
.profile-mini small {
  color: #c9d8d3;
}

.countdown-chip {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--green);
  background: var(--lime);
  font-weight: 900;
}

main {
  padding: 22px 0 64px;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(310px, 0.75fr);
  gap: 24px;
  align-items: stretch;
}

.hero-card,
.setup-card,
.quiz-card,
.result-card {
  border: 1px solid rgba(18, 60, 53, 0.08);
  box-shadow: var(--shadow);
}

.hero-card {
  position: relative;
  min-height: 590px;
  padding: clamp(32px, 5vw, 66px);
  overflow: hidden;
  border-radius: var(--radius-lg);
  color: #f9f7ed;
  background: var(--green);
}

.hero-card::before,
.hero-card::after {
  position: absolute;
  content: "";
  border-radius: 50%;
}

.hero-card::before {
  top: -130px;
  right: -90px;
  width: 350px;
  height: 350px;
  border: 70px solid rgba(216, 240, 122, 0.12);
}

.hero-card::after {
  right: 70px;
  bottom: -140px;
  width: 300px;
  height: 300px;
  background: rgba(215, 238, 231, 0.06);
}

.eyebrow {
  display: block;
  margin-bottom: 12px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero-card .eyebrow {
  color: var(--lime);
}

.hero-card h1 {
  max-width: 650px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 7vw, 84px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.hero-card h1 em {
  color: var(--lime);
  font-weight: 500;
}

.hero-copy {
  max-width: 570px;
  margin: 27px 0 38px;
  color: #c9d8d3;
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.65;
}

.stats-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 52px;
}

.stat {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
}

.stat strong {
  display: block;
  margin-bottom: 5px;
  color: white;
  font-family: Georgia, serif;
  font-size: 30px;
}

.stat span {
  color: #b9cbc6;
  font-size: 12px;
}

.setup-card {
  display: flex;
  flex-direction: column;
  padding: 32px;
  border-radius: var(--radius-lg);
  background: var(--paper);
}

.setup-card h2,
.dialog-head h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 32px;
  font-weight: 500;
}

.field-label {
  display: block;
  margin: 28px 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.choice-card {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: 160ms ease;
}

.choice-card:hover,
.choice-card:has(input:checked) {
  border-color: var(--green-2);
  background: #eef7f2;
  transform: translateY(-1px);
}

.choice-card input {
  position: absolute;
  opacity: 0;
}

.choice-icon {
  display: grid;
  flex: 0 0 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  color: var(--green);
  background: var(--mint);
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 700;
}

.choice-card strong,
.choice-card small {
  display: block;
}

.choice-card small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.select-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

select,
input[type="number"] {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: white;
}

select:focus,
input[type="number"]:focus {
  border-color: var(--green-2);
  box-shadow: 0 0 0 3px rgba(29, 90, 79, 0.12);
}

.input-hint {
  display: block;
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.primary-button,
.secondary-button,
.text-button {
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: auto;
  padding: 15px 20px;
  border-radius: 15px;
  color: white;
  background: var(--green);
  box-shadow: 0 10px 24px rgba(18, 60, 53, 0.2);
}

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

.setup-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.quiz-wrap,
.result-wrap {
  max-width: 930px;
  margin: 0 auto;
}

.quiz-topline,
.result-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.quiz-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pill {
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--green);
  background: var(--mint);
}

.timer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.progress-track {
  height: 8px;
  margin-bottom: 24px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8df;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
  transition: width 240ms ease;
}

.quiz-card {
  padding: clamp(24px, 5vw, 52px);
  border-radius: var(--radius-lg);
  background: var(--paper);
}

.question-number {
  color: var(--orange);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.question-text {
  margin: 15px 0 30px;
  font-family: Georgia, serif;
  font-size: clamp(27px, 4vw, 39px);
  font-weight: 500;
  line-height: 1.25;
}

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.option {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
  text-align: left;
  transition: 150ms ease;
}

.option:hover {
  border-color: #8da69f;
  transform: translateY(-1px);
}

.option.selected {
  border-color: var(--green);
  background: #edf6f2;
  box-shadow: inset 0 0 0 1px var(--green);
}

.option-letter {
  display: grid;
  flex: 0 0 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--cream);
  font-weight: 900;
}

.option.selected .option-letter {
  color: white;
  background: var(--green);
}

.quiz-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 30px;
}

.secondary-button {
  min-height: 46px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.quiz-footer .primary-button {
  min-height: 48px;
  margin: 0;
}

.question-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.question-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #cbd4cd;
  cursor: pointer;
}

.question-dot.answered {
  background: var(--green-2);
}

.question-dot.current {
  box-shadow: 0 0 0 3px var(--orange);
}

.result-card {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--paper);
}

.result-hero {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 34px;
  align-items: center;
  padding: clamp(28px, 5vw, 48px);
  color: white;
  background: var(--green);
}

.score-ring {
  display: grid;
  width: 170px;
  height: 170px;
  place-items: center;
  border: 12px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--lime);
  border-right-color: var(--lime);
  border-radius: 50%;
}

.score-ring strong,
.score-ring span {
  display: block;
  text-align: center;
}

.score-ring strong {
  font-family: Georgia, serif;
  font-size: 44px;
}

.score-ring span {
  color: #bcd0ca;
  font-size: 12px;
}

.result-hero h1 {
  margin: 5px 0 10px;
  font-family: Georgia, serif;
  font-size: clamp(35px, 5vw, 54px);
  font-weight: 500;
}

.result-hero p {
  max-width: 520px;
  margin: 0;
  color: #c5d5d0;
  line-height: 1.6;
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.summary-item {
  padding: 22px;
  text-align: center;
}

.summary-item + .summary-item {
  border-left: 1px solid var(--line);
}

.summary-item strong,
.summary-item span {
  display: block;
}

.summary-item strong {
  margin-bottom: 4px;
  font-family: Georgia, serif;
  font-size: 28px;
}

.summary-item span {
  color: var(--muted);
  font-size: 12px;
}

.review-section {
  padding: clamp(24px, 5vw, 42px);
}

.review-section h2 {
  margin: 0 0 18px;
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 500;
}

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

.review-item {
  padding: 17px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--red);
  border-radius: 12px;
  background: white;
}

.review-item.correct {
  border-left-color: var(--green-2);
}

.review-item strong {
  display: block;
  margin-bottom: 8px;
}

.review-item p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 14px;
}

.review-item .answer-good {
  color: var(--green-2);
  font-weight: 800;
}

.review-item .answer-bad {
  color: var(--red);
  font-weight: 800;
}

.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.result-actions .primary-button {
  margin: 0;
}

.history-dialog {
  width: min(700px, calc(100% - 30px));
  max-height: 86vh;
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.profile-dialog {
  width: min(560px, calc(100% - 30px));
  max-height: 86vh;
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.profile-dialog::backdrop {
  background: rgba(12, 31, 27, 0.62);
  backdrop-filter: blur(5px);
}

.profile-form {
  display: grid;
  gap: 8px;
  padding: 0 28px 24px;
}

.compact-footer {
  padding: 16px 0 0;
}

.compact-primary {
  min-height: 46px;
  margin: 0;
}

.history-dialog::backdrop {
  background: rgba(12, 31, 27, 0.62);
  backdrop-filter: blur(5px);
}

.dialog-head,
.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 24px 28px;
}

.dialog-head {
  border-bottom: 1px solid var(--line);
}

.dialog-head .eyebrow {
  margin-bottom: 6px;
}

.close-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  cursor: pointer;
  font-size: 24px;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 52vh;
  padding: 20px 28px;
  overflow-y: auto;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 15px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.history-item strong,
.history-item small {
  display: block;
}

.history-item small {
  margin-top: 5px;
  color: var(--muted);
}

.history-score {
  min-width: 68px;
  text-align: right;
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 700;
}

.history-score.incomplete {
  color: var(--orange);
  font-family: inherit;
  font-size: 12px;
  text-transform: uppercase;
}

.empty-state {
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 22px;
}

.dialog-footer {
  border-top: 1px solid var(--line);
}

.text-button {
  padding: 10px 0;
  background: transparent;
}

.danger {
  color: var(--red);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: 330px;
  padding: 14px 18px;
  border-radius: 12px;
  color: white;
  background: var(--green);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.question-visual {
  margin: -10px 0 26px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fbfaf2;
}

.question-visual strong {
  display: block;
  margin-bottom: 12px;
}

.bar-visual {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 58px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar-label {
  font-weight: 800;
}

.bar-track {
  height: 17px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8df;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-2), var(--orange));
}

.bar-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
}

.pause-card {
  display: grid;
  gap: 14px;
  padding: 34px;
  border: 1px dashed #a8bbb4;
  border-radius: var(--radius-md);
  background: #f5f7ef;
  text-align: center;
}

.pause-card strong {
  font-family: Georgia, serif;
  font-size: 30px;
}

.timer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.timer-actions .secondary-button {
  min-height: 38px;
  padding: 8px 12px;
}

.calculator-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  width: min(320px, calc(100% - 32px));
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.calculator-panel.hidden {
  display: none;
}

.calculator-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.small-close {
  width: 30px;
  height: 30px;
  font-size: 18px;
}

.calculator-display {
  width: 100%;
  margin-bottom: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 22px;
  text-align: right;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.calculator-grid button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--cream);
  cursor: pointer;
  font-weight: 800;
}

.calculator-grid button:hover {
  background: var(--mint);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 29;
  background: rgba(10, 30, 26, 0.45);
  backdrop-filter: blur(3px);
}

.sidebar-backdrop.hidden {
  display: none;
}

.side-menu {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  display: flex;
  width: min(340px, calc(100% - 28px));
  flex-direction: column;
  padding: 24px;
  border-radius: 26px;
  color: white;
  background: linear-gradient(160deg, #0f4d42, #07372f);
  box-shadow: 0 28px 80px rgba(5, 33, 28, 0.35);
  transform: translateX(calc(100% + 30px));
  transition: transform 220ms ease;
}

.side-menu.open {
  transform: translateX(0);
}

.side-menu-head,
.side-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.side-brand {
  justify-content: flex-start;
  gap: 12px;
  font-family: Georgia, serif;
  font-size: 22px;
}

.side-close {
  color: white;
  border-color: rgba(255,255,255,.2);
  background: transparent;
}

.side-menu-nav {
  display: grid;
  gap: 6px;
  margin-top: 34px;
}

.side-menu-nav button {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  border: 0;
  border-radius: 12px;
  color: #e6f0ec;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-weight: 750;
}

.side-menu-nav button:hover,
.side-menu-nav button.active {
  background: rgba(255,255,255,.1);
}

.side-menu-nav button span {
  color: var(--lime);
  font-size: 11px;
}

.side-menu-footer {
  margin-top: auto;
  color: #a8c5bd;
}

.page-shell {
  display: grid;
  gap: 22px;
  animation: page-in 180ms ease;
}

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

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

.page-head h1 {
  margin: 4px 0 0;
  font-family: Georgia, serif;
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 500;
  letter-spacing: -.035em;
}

.page-head p {
  max-width: 580px;
  margin: 8px 0 0;
  color: var(--muted);
}

.back-link {
  width: fit-content;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
  font-weight: 800;
}

.dashboard-new {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 20px;
}

.dashboard-hero {
  min-height: 390px;
  padding: clamp(30px, 5vw, 56px);
  border-radius: var(--radius-lg);
  color: white;
  background: linear-gradient(135deg, #0f493f, #07372f);
  box-shadow: var(--shadow);
}

.dashboard-hero h1 {
  max-width: 620px;
  margin: 12px 0 20px;
  font-family: Georgia, serif;
  font-size: clamp(46px, 7vw, 78px);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .98;
}

.dashboard-hero h1 em { color: var(--lime); font-weight: 500; }
.dashboard-hero p { max-width: 560px; color: #c8d9d4; line-height: 1.65; }

.hero-actions,
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.accent-button {
  min-height: 50px;
  padding: 12px 18px;
  border: 0;
  border-radius: 13px;
  color: var(--green);
  background: var(--lime);
  cursor: pointer;
  font-weight: 900;
}

.ghost-on-dark {
  min-height: 50px;
  padding: 12px 18px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 13px;
  color: white;
  background: rgba(255,255,255,.06);
  cursor: pointer;
  font-weight: 800;
}

.dashboard-side {
  display: grid;
  gap: 16px;
}

.panel-card {
  padding: 24px;
  border: 1px solid rgba(18,60,53,.08);
  border-radius: var(--radius-md);
  background: var(--paper);
  box-shadow: 0 12px 35px rgba(25,54,48,.08);
}

.panel-card h2,
.panel-card h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-weight: 500;
}

.countdown-large {
  display: block;
  margin: 18px 0 2px;
  color: var(--green);
  font-family: Georgia, serif;
  font-size: 54px;
  font-weight: 700;
}

.dashboard-stats,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.metric-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}

.metric-card strong,
.metric-card span { display: block; }
.metric-card strong { font-family: Georgia, serif; font-size: 28px; }
.metric-card span { margin-top: 5px; color: var(--muted); font-size: 12px; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr);
  gap: 18px;
}

.activity-list,
.history-page-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

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

.activity-row:last-child { border-bottom: 0; }
.activity-row small { color: var(--muted); }

.topic-search {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

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

.filter-chip {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.filter-chip.active { color: white; background: var(--green); }

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

.topic-tile {
  display: grid;
  min-height: 130px;
  align-content: space-between;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  cursor: pointer;
  text-align: left;
  transition: 160ms ease;
}

.topic-tile:hover,
.topic-tile.selected {
  border-color: var(--green-2);
  background: #edf6f2;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(25,54,48,.09);
}

.topic-tile-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  color: var(--green);
  background: var(--mint);
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 800;
}

.topic-tile strong { margin-top: 20px; }

.settings-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}

.settings-card {
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.difficulty-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  cursor: pointer;
  text-align: center;
}

.difficulty-card.selected { border-color: var(--green); background: #edf6f2; box-shadow: inset 0 0 0 1px var(--green); }
.difficulty-card strong,
.difficulty-card small { display: block; }
.difficulty-card small { margin-top: 5px; color: var(--muted); }

.settings-preview {
  display: grid;
  align-content: start;
  gap: 14px;
}

.score-trend {
  display: flex;
  height: 160px;
  align-items: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 10px;
  border-bottom: 1px solid var(--line);
}

.trend-column {
  display: flex;
  flex: 1;
  height: 100%;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  text-align: center;
}

.trend-bar {
  min-height: 6px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(var(--mint), var(--green-2));
}

.trend-column small { color: var(--muted); font-size: 10px; }

.profile-page-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
}

.profile-avatar {
  display: grid;
  width: 84px;
  height: 84px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--mint);
  font-family: Georgia, serif;
  font-size: 38px;
}

.calculator-page {
  max-width: 560px;
  margin: 0 auto;
}

.calculator-page .calculator-display {
  min-height: 92px;
  font-size: 34px;
}

.calculator-page .calculator-grid button { min-height: 62px; font-size: 17px; }

@media (max-width: 900px) {
  .dashboard-new,
  .content-grid,
  .settings-layout,
  .profile-page-grid { grid-template-columns: 1fr; }
  .topic-card-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-stats,
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .hero-card {
    min-height: auto;
  }

  .setup-card {
    min-height: 590px;
  }
}

@media (max-width: 600px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
  }

  .topbar {
    height: 78px;
  }

  .brand small,
  .icon-button > span:nth-child(2) {
    display: none;
  }

  .top-actions {
    gap: 5px;
  }

  main {
    padding-top: 8px;
  }

  .hero-card,
  .setup-card,
  .quiz-card,
  .result-card {
    border-radius: 22px;
  }

  .hero-card {
    padding: 34px 25px;
  }

  .hero-card h1 {
    font-size: 48px;
  }

  .stats-row {
    margin-top: 36px;
  }

  .stat {
    padding: 13px 9px;
  }

  .stat strong {
    font-size: 24px;
  }

  .setup-card {
    min-height: 560px;
    padding: 25px;
  }

  .options {
    grid-template-columns: 1fr;
  }

  .quiz-footer {
    flex-wrap: wrap;
  }

  .question-dots {
    order: -1;
    width: 100%;
    margin-bottom: 8px;
  }

  .result-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .result-summary {
    grid-template-columns: 1fr 1fr;
  }

  .score-ring {
    width: 145px;
    height: 145px;
    margin: 0 auto;
  }

  .result-actions {
    flex-direction: column;
  }

  .bar-row {
    grid-template-columns: 70px 1fr 48px;
  }

  .topic-card-grid { grid-template-columns: 1fr 1fr; }
  .difficulty-grid { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .dashboard-hero h1 { font-size: 46px; }
  .activity-row { grid-template-columns: 1fr auto; }
  .activity-row small:last-child { display: none; }
}
