/* [skill: go-team-standards · dev-dna] 定义 B1 每日闯关冲刺的响应式与无障碍视觉 */
:root {
  color-scheme: light;
  --canvas: #f7f3e9;
  --canvas-deep: #eee5cf;
  --surface: #fffdf7;
  --surface-muted: #f3eddf;
  --navy: #17233f;
  --navy-soft: #33415f;
  --ink-muted: #5a6070;
  --purple: #6857e5;
  --purple-dark: #4f3dc9;
  --purple-soft: #eeeaff;
  --orange: #f49a45;
  --orange-dark: #d56f24;
  --orange-deep: #a8500f;
  --sky: #8ed8ff;
  --yellow: #ffd765;
  --yellow-soft: #fff4bd;
  --hard: #c94f47;
  --hard-soft: #fff0ec;
  --fuzzy: #bd7417;
  --fuzzy-soft: #fff3d1;
  --mastered: #267757;
  --mastered-soft: #e6f5ec;
  --warning: #76560c;
  --warning-bg: #fff4c7;
  --error: #962f39;
  --error-bg: #ffe9e9;
  --line: 2px solid var(--navy);
  --line-heavy: 3px solid var(--navy);
  --shadow-small: 4px 4px 0 var(--navy);
  --shadow-medium: 7px 7px 0 var(--navy);
  --shadow-large: 11px 11px 0 var(--navy);
  --radius-large: 28px;
  --radius-medium: 18px;
  --radius-small: 12px;
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-synthesis: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--navy);
  background:
    radial-gradient(circle at 8% 4%, rgb(104 87 229 / 10%), transparent 24rem),
    radial-gradient(circle at 92% 18%, rgb(244 154 69 / 14%), transparent 25rem),
    linear-gradient(155deg, var(--canvas), var(--canvas-deep));
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgb(23 35 63 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(23 35 63 / 4%) 1px, transparent 1px);
  background-size: 32px 32px;
  content: "";
  pointer-events: none;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button,
.data-action {
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease;
}

button:disabled {
  cursor: not-allowed;
}

button:not(:disabled):active,
.data-action:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--navy);
}

:where(button, a, input, [tabindex]):focus-visible {
  outline: 4px solid var(--orange);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  min-height: 44px;
  padding: 12px 16px;
  border: var(--line);
  border-radius: 10px;
  color: #fff;
  background: var(--purple-dark);
  box-shadow: var(--shadow-small);
  font-weight: 800;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

.app-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  border: var(--line-heavy);
  border-radius: 22px;
  background: rgb(255 253 247 / 94%);
  box-shadow: var(--shadow-medium);
}

.brand-lockup {
  display: flex;
  min-width: max-content;
  align-items: center;
  gap: 12px;
}

.companion-brand {
  display: grid;
  justify-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.mascot {
  --mascot-size: 48px;
  --mascot-skin: var(--yellow);
  --mascot-ear: var(--orange);
  --mascot-ear-inner: var(--orange-dark);
  display: inline-flex;
  width: var(--mascot-size);
  height: var(--mascot-size);
}

.mascot-art {
  width: 100%;
  height: 100%;
}

.mascot-shadow,
.mascot-pupil,
.mascot-nose {
  fill: var(--navy);
}

.mascot-ear {
  fill: var(--mascot-ear);
  stroke: var(--navy);
  stroke-width: 2.4;
}

.mascot-ear-inner {
  fill: var(--mascot-ear-inner);
}

.mascot-head {
  fill: var(--mascot-skin);
  stroke: var(--navy);
  stroke-width: 2.4;
}

.mascot-eye {
  fill: var(--surface);
  stroke: var(--navy);
  stroke-width: 2.2;
}

.mascot-glint {
  fill: var(--surface);
}

.mascot-mouth,
.mascot-brow,
.mascot-spark {
  fill: none;
  stroke: var(--navy);
  stroke-linecap: round;
  stroke-width: 2.3;
}

.mascot-tooth rect {
  fill: var(--surface);
  stroke: var(--navy);
  stroke-width: 1.6;
}

.mascot-tooth path {
  fill: none;
  stroke: var(--navy);
  stroke-width: 1.4;
}

.mascot-sweat {
  fill: var(--sky);
  stroke: var(--navy);
  stroke-width: 1.8;
}

.mascot-shout {
  fill: var(--hard);
  stroke: var(--navy);
  stroke-width: 2.2;
}

.mascot-mood {
  display: none;
}

.mascot-normal .mascot-mood-normal,
.mascot-anxious .mascot-mood-anxious,
.mascot-frantic .mascot-mood-frantic {
  display: inline;
}

.mascot-anxious {
  --mascot-skin: var(--yellow-soft);
}

.mascot-frantic {
  --mascot-skin: var(--orange);
  --mascot-ear: var(--orange-dark);
  --mascot-ear-inner: var(--orange-deep);
  transform: rotate(-3deg);
}

.mascot-status {
  margin: 0;
  color: var(--navy-soft);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.brand-kicker,
.eyebrow {
  margin: 0;
  color: var(--purple-dark);
  font-size: 0.73rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1.35;
  text-transform: uppercase;
}

.brand-lockup h1 {
  margin: 3px 0 0;
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.mode-switch {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.mode-button,
.utility-button {
  border: 2px solid transparent;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 850;
  white-space: nowrap;
}

.mode-button {
  padding: 0 14px;
  background: transparent;
}

.mode-button:not(:disabled):hover {
  border-color: var(--purple);
  background: var(--purple-soft);
}

.mode-button[aria-pressed="true"] {
  border-color: var(--navy);
  color: #fff;
  background: var(--purple);
  box-shadow: 3px 3px 0 var(--navy);
}

.mode-button[aria-pressed="true"]:hover {
  background: var(--purple-dark);
}

.mode-count {
  display: inline-grid;
  min-width: 1.55rem;
  height: 1.55rem;
  margin-left: 4px;
  padding: 0 5px;
  place-items: center;
  border: 1px solid currentcolor;
  border-radius: 999px;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.daily-checkin-stat {
  align-items: flex-start;
}

.daily-checkin-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.daily-checkin-copy strong {
  font-variant-numeric: tabular-nums;
}

.daily-checkin-caption {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
}

.daily-progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 1.5px solid var(--navy);
  border-radius: 999px;
  background: var(--surface-muted);
}

.daily-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--orange));
}

.header-tools {
  display: contents;
}

.build-tag {
  align-self: center;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.utility-button {
  padding: 0 14px;
  border-color: var(--navy);
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--navy);
}

.utility-button:not(:disabled):hover {
  background: var(--yellow-soft);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--navy);
}

.stats-strip {
  display: grid;
  grid-template-columns:
    minmax(135px, 0.8fr)
    minmax(280px, 1.8fr)
    minmax(135px, 0.8fr)
    minmax(135px, 0.8fr);
  gap: 10px;
  margin: 22px 0 18px;
}

.stat-item,
.xp-status {
  min-width: 0;
  border: var(--line);
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-small);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: var(--surface);
}

.stat-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid var(--navy);
  border-radius: 10px;
  color: var(--purple-dark);
  background: var(--purple-soft);
  font-size: 0.8rem;
  font-weight: 900;
}

.stat-item p {
  min-width: 0;
  margin: 0;
}

.stat-item strong,
.stat-label {
  display: block;
}

.stat-label {
  margin-bottom: 2px;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.stat-item strong {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.xp-status {
  padding: 12px 16px;
  background: var(--yellow);
}

.xp-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.xp-copy strong {
  font-size: 1rem;
}

.xp-copy span {
  font-size: 0.78rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.xp-track,
.progress-track {
  overflow: hidden;
  border: 2px solid var(--navy);
  border-radius: 999px;
  background: rgb(255 255 255 / 74%);
}

.xp-track {
  height: 12px;
}

.xp-fill,
.progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  transition: width 260ms ease;
}

.xp-fill {
  background:
    repeating-linear-gradient(
      135deg,
      var(--purple),
      var(--purple) 8px,
      var(--purple-dark) 8px,
      var(--purple-dark) 14px
    );
}

.notice-stack:empty {
  display: none;
}

.notice {
  margin-bottom: 14px;
  padding: 13px 16px;
  border: var(--line);
  border-radius: var(--radius-small);
  box-shadow: 3px 3px 0 var(--navy);
  font-weight: 700;
  line-height: 1.5;
}

.notice-warning {
  color: var(--warning);
  background: var(--warning-bg);
}

.notice-error {
  color: var(--error);
  background: var(--error-bg);
}

.notice-update {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--purple-dark);
  background: var(--purple-soft);
}

.notice-summary {
  color: var(--navy);
  background: var(--yellow-soft);
}

.notice-action {
  flex: 0 0 auto;
  padding: 0 14px;
  border: 2px solid var(--navy);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 2px 2px 0 var(--navy);
  font-weight: 850;
}

.question-card,
.empty-state {
  border: var(--line-heavy);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow-large);
}

.question-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(22px, 4vw, 44px);
}

.question-card::before {
  position: absolute;
  z-index: -1;
  top: -7rem;
  right: -7rem;
  width: 18rem;
  height: 18rem;
  border: 32px solid rgb(104 87 229 / 7%);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.question-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.question-number,
.progress-text {
  margin: 0;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.question-number {
  color: var(--purple-dark);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.progress-text {
  flex: 0 0 auto;
  color: var(--ink-muted);
  font-size: 0.82rem;
}

.source-badge {
  padding: 5px 9px;
  border: 2px solid var(--navy);
  border-radius: 999px;
  color: var(--navy);
  background: var(--yellow);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.progress-track {
  height: 10px;
  margin-top: 14px;
  border-width: 1px;
  background: var(--surface-muted);
}

.progress-fill {
  background: linear-gradient(90deg, var(--purple), var(--orange));
}

.question-body {
  max-width: 900px;
  min-height: 230px;
  padding: clamp(42px, 8vw, 78px) 0 clamp(34px, 6vw, 58px);
}

.question-text {
  max-width: 24em;
  margin: 10px 0 0;
  font-size: clamp(1.75rem, 4.7vw, 3.35rem);
  line-height: 1.22;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.prompt-content {
  min-width: 0;
  max-width: 100%;
  margin-top: 24px;
  font-size: 1rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.prompt-content > :first-child {
  margin-top: 0;
}

.prompt-content > :last-child {
  margin-bottom: 0;
}

.recall-hint {
  max-width: 44rem;
  margin: 20px 0 0;
  color: var(--ink-muted);
  font-size: 0.96rem;
  font-weight: 650;
  line-height: 1.65;
}

.answer-panel {
  margin: 2px 0 26px;
  padding: clamp(20px, 4vw, 32px);
  border: var(--line);
  border-radius: var(--radius-medium);
  background:
    linear-gradient(rgb(255 255 255 / 68%), rgb(255 255 255 / 68%)),
    var(--purple-soft);
  animation: reveal-panel 220ms ease-out;
}

.answer-heading-row {
  padding-bottom: 15px;
  border-bottom: 1px solid rgb(23 35 63 / 20%);
}

.answer-heading-row h3,
.rating-copy h3 {
  margin: 4px 0 0;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  line-height: 1.25;
}

.answer-content {
  min-width: 0;
  padding-top: 6px;
  font-size: 1rem;
  line-height: 1.78;
  overflow-wrap: anywhere;
}

.answer-content > :first-child {
  margin-top: 14px;
}

.answer-content > :last-child {
  margin-bottom: 0;
}

.answer-content li + li {
  margin-top: 8px;
}

.answer-content blockquote {
  margin-inline: 0;
  padding: 2px 0 2px 18px;
  border-left: 5px solid var(--purple);
  color: var(--ink-muted);
}

.answer-content pre,
.prompt-content pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 18px;
  border: 2px solid var(--navy);
  border-radius: 13px;
  color: #f8f6ff;
  background: #202c48;
  box-shadow: 3px 3px 0 rgb(23 35 63 / 20%);
  line-height: 1.55;
  tab-size: 4;
  -webkit-overflow-scrolling: touch;
}

.answer-content code,
.prompt-content code {
  padding: 0.14em 0.36em;
  border-radius: 5px;
  font-family:
    ui-monospace,
    "SFMono-Regular",
    Menlo,
    Consolas,
    monospace;
  font-size: 0.91em;
  background: rgb(104 87 229 / 12%);
}

.answer-content pre code,
.prompt-content pre code {
  padding: 0;
  color: inherit;
  background: transparent;
}

.rating-panel {
  margin: 2px 0 26px;
  padding: clamp(18px, 3.5vw, 28px);
  border: var(--line);
  border-radius: var(--radius-medium);
  background: var(--surface-muted);
  animation: reveal-panel 220ms ease-out;
}

.rating-copy {
  margin-bottom: 16px;
}

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

.rating-button {
  display: flex;
  min-width: 0;
  min-height: 76px;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 12px 15px;
  border: 2px solid var(--navy);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--navy);
  text-align: left;
}

.rating-button:not(:disabled):hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--navy);
}

.rating-name {
  font-size: 1.02rem;
  font-weight: 950;
}

.rating-button small {
  color: currentcolor;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.35;
  opacity: 0.82;
}

.rating-feedback {
  display: grid;
  gap: 4px;
  margin: 16px 0 0;
  padding: 11px 13px;
  border: 2px solid var(--navy);
  border-radius: 12px;
  background: var(--yellow-soft);
}

.rating-feedback-primary {
  font-weight: 950;
  font-size: 1rem;
}

.rating-feedback-secondary {
  color: var(--navy-soft);
  font-size: 0.78rem;
  font-weight: 750;
}

.study-record-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.study-record-tab {
  padding: 0 14px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-weight: 850;
}

.study-record-tab[aria-selected="true"] {
  border-color: var(--navy);
  color: #fff;
  background: var(--purple);
  box-shadow: 3px 3px 0 var(--navy);
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.calendar-month-label {
  margin: 0;
  font-size: 1rem;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekday,
.calendar-cell {
  min-height: 44px;
  padding: 6px 4px;
  border-radius: 10px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25;
}

.calendar-weekday {
  color: var(--ink-muted);
  font-size: 0.68rem;
}

.calendar-cell {
  border: 1.5px solid rgb(23 35 63 / 18%);
  background: var(--surface);
}

.calendar-pad {
  border-color: transparent;
  background: transparent;
}

.calendar-checked {
  border-color: var(--mastered);
  background: var(--mastered-soft);
}

.calendar-partial,
.calendar-unverified,
.calendar-today {
  border-color: var(--orange);
  background: var(--yellow-soft);
}

.calendar-missed {
  border-style: dashed;
  color: var(--ink-muted);
  background: var(--surface-muted);
}

.calendar-future {
  opacity: 0.55;
}

.calendar-today {
  box-shadow: inset 0 0 0 2px var(--purple);
}

.calendar-key {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.notebook-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.notebook-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.notebook-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.notebook-question {
  margin: 0;
  font-weight: 800;
  line-height: 1.35;
}

.notebook-status {
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
}

.notebook-hard {
  color: var(--hard);
  background: var(--hard-soft);
}

.notebook-fuzzy {
  color: var(--fuzzy);
  background: var(--fuzzy-soft);
}

.notebook-empty {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-weight: 750;
}

.rate-hard {
  color: var(--hard);
  background: var(--hard-soft);
}

.rate-fuzzy {
  color: var(--fuzzy);
  background: var(--fuzzy-soft);
}

.rate-mastered {
  color: var(--mastered);
  background: var(--mastered-soft);
}

.rate-hard[aria-pressed="true"],
.rate-hard.is-selected {
  color: #fff;
  background: var(--hard);
}

.rate-fuzzy[aria-pressed="true"],
.rate-fuzzy.is-selected {
  color: var(--navy);
  background: var(--yellow);
}

.rate-mastered[aria-pressed="true"],
.rate-mastered.is-selected {
  color: #fff;
  background: var(--mastered);
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 1.5fr) 1fr;
  gap: 12px;
  padding-top: 24px;
  border-top: 2px dashed rgb(23 35 63 / 24%);
}

.action-button {
  min-width: 0;
  min-height: 54px;
  padding: 10px 16px;
  border: 2px solid var(--navy);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--navy);
  font-weight: 900;
}

.action-button:not(:disabled):hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--navy);
}

.action-primary {
  color: var(--navy);
  background: var(--orange);
}

.action-primary:not(:disabled):hover {
  background: #ffa75a;
}

.action-secondary {
  background: var(--surface);
}

.action-secondary:not(:disabled):hover {
  background: var(--purple-soft);
}

.review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding-inline: 4px;
}

.review-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.review-button {
  padding: 0 16px;
  border: 2px solid var(--navy);
  border-radius: 999px;
  background: rgb(255 253 247 / 80%);
  box-shadow: 3px 3px 0 var(--navy);
  font-size: 0.86rem;
  font-weight: 850;
}

.review-button:not(:disabled):hover {
  background: var(--yellow-soft);
}

.hard-button[aria-pressed="true"] {
  color: #fff;
  background: var(--hard);
}

.keyboard-hint {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.45;
  text-align: right;
}

.empty-state {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: clamp(30px, 6vw, 54px);
}

.empty-icon {
  display: grid;
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  place-items: center;
  border: var(--line);
  border-radius: 22px;
  color: #fff;
  background: var(--mastered);
  box-shadow: var(--shadow-small);
  font-size: 2rem;
  font-weight: 950;
  transform: rotate(-4deg);
}

.empty-state h2 {
  margin: 6px 0 0;
  font-size: clamp(1.45rem, 4vw, 2.2rem);
  letter-spacing: -0.025em;
}

.empty-state p:last-child {
  max-width: 42rem;
  margin: 10px 0 0;
  color: var(--ink-muted);
  line-height: 1.65;
}

.app-dialog {
  width: min(calc(100% - 28px), 620px);
  max-height: min(86vh, 780px);
  margin: auto;
  padding: clamp(20px, 4vw, 30px);
  overflow: auto;
  border: var(--line-heavy);
  border-radius: 24px;
  color: var(--navy);
  background: var(--surface);
  box-shadow: var(--shadow-large);
}

.app-dialog[open] {
  animation: dialog-pop 180ms ease-out;
}

.app-dialog::backdrop {
  background: rgb(16 24 45 / 62%);
  backdrop-filter: blur(3px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--navy);
}

.dialog-header h2 {
  margin: 5px 0 0;
  font-size: clamp(1.5rem, 5vw, 2rem);
  line-height: 1.15;
}

.dialog-header form,
.dialog-footer {
  margin: 0;
}

.dialog-close {
  display: grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border: 2px solid var(--navy);
  border-radius: 12px;
  background: var(--surface-muted);
  box-shadow: 2px 2px 0 var(--navy);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.dialog-intro,
.dialog-note {
  color: var(--ink-muted);
  line-height: 1.6;
}

.dialog-intro {
  margin: 18px 0;
}

.level-up-effect {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: grid;
  overflow: hidden;
  padding-top: clamp(56px, 13vh, 140px);
  place-items: start center;
  pointer-events: none;
}

.level-up-card {
  display: grid;
  margin: 0;
  padding: 18px 30px;
  animation: level-up-pop 320ms ease-out both;
  border: var(--line-heavy);
  border-radius: 20px;
  background: var(--yellow);
  box-shadow: var(--shadow-large);
  gap: 2px;
  justify-items: center;
  text-align: center;
}

.level-up-kicker {
  color: var(--purple-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.level-up-badge {
  font-size: clamp(1.7rem, 6vw, 2.3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.level-up-note {
  color: var(--navy-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.level-up-confetti span {
  position: absolute;
  top: -24px;
  width: 11px;
  height: 15px;
  animation: level-up-confetti 1.3s ease-in forwards;
  border: 2px solid var(--navy);
  border-radius: 3px;
}

.level-up-confetti span:nth-child(odd) {
  background: var(--orange);
}

.level-up-confetti span:nth-child(even) {
  background: var(--purple);
}

.level-up-confetti span:nth-child(3n) {
  background: var(--sky);
  border-radius: 50%;
}

.level-up-confetti span:nth-child(1) { left: 8%; animation-delay: 0ms; }
.level-up-confetti span:nth-child(2) { left: 17%; animation-delay: 120ms; }
.level-up-confetti span:nth-child(3) { left: 26%; animation-delay: 40ms; }
.level-up-confetti span:nth-child(4) { left: 35%; animation-delay: 200ms; }
.level-up-confetti span:nth-child(5) { left: 44%; animation-delay: 80ms; }
.level-up-confetti span:nth-child(6) { left: 53%; animation-delay: 240ms; }
.level-up-confetti span:nth-child(7) { left: 62%; animation-delay: 20ms; }
.level-up-confetti span:nth-child(8) { left: 71%; animation-delay: 160ms; }
.level-up-confetti span:nth-child(9) { left: 80%; animation-delay: 60ms; }
.level-up-confetti span:nth-child(10) { left: 89%; animation-delay: 220ms; }
.level-up-confetti span:nth-child(11) { left: 95%; animation-delay: 100ms; }
.level-up-confetti span:nth-child(12) { left: 3%; animation-delay: 180ms; }

@keyframes level-up-pop {
  0% {
    opacity: 0;
    transform: scale(0.62) translateY(16px);
  }

  60% {
    opacity: 1;
    transform: scale(1.07) translateY(0);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes level-up-confetti {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }

  100% {
    opacity: 0;
    transform: translateY(105vh) rotate(420deg);
  }
}

.checkin-dialog {
  width: min(calc(100% - 28px), 420px);
  text-align: center;
}

.checkin-medal {
  display: inline-flex;
  width: 88px;
  height: 88px;
}

.checkin-medal-art {
  width: 100%;
  height: 100%;
}

.checkin-medal-shadow {
  fill: var(--navy);
}

.checkin-medal-face {
  fill: var(--yellow);
  stroke: var(--navy);
  stroke-width: 2.6;
}

.checkin-medal-star {
  fill: var(--orange);
  stroke: var(--navy);
  stroke-linejoin: round;
  stroke-width: 2;
}

.checkin-dialog .eyebrow {
  margin-top: 6px;
}

.checkin-dialog h2 {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 4.6vw, 1.8rem);
  line-height: 1.2;
}

.checkin-message {
  margin: 12px 0 0;
  color: var(--navy-soft);
  font-weight: 700;
  line-height: 1.65;
}

.checkin-stats {
  margin: 16px 0 0;
  padding: 11px 13px;
  border: 2px solid var(--navy);
  border-radius: 12px;
  background: var(--yellow-soft);
  font-size: 0.86rem;
  font-weight: 850;
}

.checkin-dialog .action-button {
  width: 100%;
  margin-top: 18px;
}

.dialog-note {
  margin: 18px 0 0;
  padding: 13px 14px;
  border-left: 5px solid var(--purple);
  background: var(--purple-soft);
  font-size: 0.86rem;
}

.achievements-list {
  position: relative;
  min-height: 58px;
  margin: 0;
  padding: 16px 16px 16px 52px;
  border: 2px solid var(--navy);
  border-radius: 14px;
  background: var(--yellow-soft);
  box-shadow: 3px 3px 0 var(--navy);
  font-weight: 850;
  line-height: 1.45;
  list-style: none;
}

.achievements-list li + li {
  margin-top: 8px;
}

.achievements-list::before {
  position: absolute;
  top: 50%;
  left: 15px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 2px solid var(--navy);
  border-radius: 50%;
  background: var(--yellow);
  content: "★";
  font-size: 0.72rem;
  transform: translateY(-50%);
}

.install-steps {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.install-steps p:not(.dialog-note) {
  margin: 0;
  padding: 14px 16px;
  border: 2px solid var(--navy);
  border-radius: 14px;
  background: var(--yellow-soft);
  line-height: 1.6;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.progress-actions {
  display: grid;
  gap: 12px;
}

.data-action {
  display: flex;
  width: 100%;
  min-height: 68px;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 12px 15px;
  border: 2px solid var(--navy);
  border-radius: 14px;
  color: var(--navy);
  background: var(--surface-muted);
  box-shadow: 3px 3px 0 var(--navy);
  font-weight: 900;
  text-align: left;
}

button.data-action:not(:disabled):hover,
label.data-action:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--navy);
}

.data-action small {
  color: var(--ink-muted);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.4;
}

.data-action-export {
  background: var(--yellow-soft);
}

.data-action-import {
  cursor: pointer;
  background: var(--purple-soft);
}

.data-action-danger {
  color: var(--error);
  background: var(--error-bg);
}

.file-input {
  width: 100%;
  min-height: 50px;
  padding: 5px;
  border: 2px solid var(--navy);
  border-radius: 12px;
  color: var(--ink-muted);
  background: var(--surface);
}

.file-input::file-selector-button {
  min-height: 44px;
  margin-right: 10px;
  padding: 0 13px;
  border: 2px solid var(--navy);
  border-radius: 9px;
  color: var(--navy);
  background: var(--purple-soft);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes reveal-panel {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dialog-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-switch {
    justify-content: flex-start;
  }

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

@media (max-width: 700px) {
  .app-shell {
    width: min(calc(100% - 22px), 1120px);
    padding-top: 18px;
  }

  .app-header {
    gap: 15px;
    padding: 14px;
    border-radius: 18px;
    box-shadow: 5px 5px 0 var(--navy);
  }

  .brand-lockup {
    min-width: 0;
  }

  .mascot {
    --mascot-size: 42px;
  }

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

  .mode-button {
    min-width: 0;
    padding-inline: 9px;
    white-space: normal;
  }

  .utility-button {
    width: 100%;
    white-space: normal;
  }

  .stats-strip {
    gap: 8px;
    margin-top: 18px;
  }

  .stat-item,
  .xp-status {
    box-shadow: 3px 3px 0 var(--navy);
  }

  .question-card,
  .empty-state {
    border-radius: 22px;
    box-shadow: 7px 7px 0 var(--navy);
  }

  .question-header {
    align-items: flex-start;
  }

  .question-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .question-body {
    min-height: 195px;
  }

  .rating-controls {
    grid-template-columns: 1fr;
  }

  .rating-button {
    min-height: 64px;
  }

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

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

  .keyboard-hint {
    text-align: left;
  }
}

@media (max-width: 430px) {
  .app-shell {
    width: min(calc(100% - 16px), 1120px);
    padding-bottom: 34px;
  }

  .brand-lockup h1 {
    font-size: 1.18rem;
  }

  .brand-kicker {
    font-size: 0.66rem;
  }

  .stats-strip {
    grid-template-columns: 1fr;
  }

  .stat-item,
  .xp-status {
    min-height: 64px;
  }

  .question-card {
    padding: 20px 16px;
  }

  .question-header {
    gap: 10px;
  }

  .progress-text {
    max-width: 7.5rem;
    text-align: right;
  }

  .question-text {
    font-size: clamp(1.65rem, 9vw, 2.2rem);
  }

  .answer-panel,
  .rating-panel {
    padding: 17px 14px;
  }

  .answer-content pre,
  .prompt-content pre {
    padding: 14px;
  }

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

  .review-buttons {
    grid-template-columns: 1fr;
  }

  .empty-state {
    align-items: flex-start;
    flex-direction: column;
  }

  .empty-icon {
    width: 58px;
    height: 58px;
    border-radius: 17px;
    font-size: 1.45rem;
  }

  .app-dialog {
    width: min(calc(100% - 16px), 620px);
    padding: 18px 15px;
    border-radius: 20px;
  }

  .dialog-header {
    gap: 12px;
  }

  .dialog-footer .action-button {
    width: 100%;
  }

  .file-input::file-selector-button {
    display: block;
    width: 100%;
    min-height: 44px;
    margin: 0 0 6px;
  }
}

@media (max-width: 720px) {
  .notebook-item {
    align-items: stretch;
    flex-direction: column;
  }

  .calendar-toolbar {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .mascot-frantic {
    transform: none;
  }

  .level-up-confetti {
    display: none;
  }
}
