:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #15344b;
  background: #eaf7ff;
  font-synthesis: none;
  --sky-100: #eaf7ff;
  --sky-300: #b8e2f8;
  --sky-600: #2379a6;
  --ink: #15344b;
  --ink-soft: #557083;
  --coral: #ee6d5a;
  --coral-dark: #b74334;
  --cream: #fffdf7;
  --correct: #197147;
  --incorrect: #a83f33;
  --shadow: 0 14px 36px rgba(28, 81, 112, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--sky-100);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 85% 5%, rgba(255, 255, 255, 0.9) 0 8rem, transparent 8.1rem),
    linear-gradient(160deg, #dff3ff 0%, #f5fbff 60%, #fff7ef 100%);
}

button,
input {
  font: inherit;
}

audio {
  max-width: 100%;
}

button {
  min-height: 48px;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 3px solid #163f86;
  outline-offset: 3px;
}

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

.skip-link {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 1rem;
  padding: 0.75rem 1rem;
  color: white;
  background: var(--ink);
  transform: translateY(-120%);
}

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

.shell {
  width: min(100%, 760px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(1rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(1.5rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}

.shell:focus {
  outline: none;
}

.hero {
  padding: clamp(1.5rem, 7vw, 3.25rem) 0 1.25rem;
}

.eyebrow,
.quiz-header p,
.question-meta,
.helper,
.status {
  color: var(--ink-soft);
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--sky-600);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.75rem, 7vw, 2.75rem);
  line-height: 1.18;
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
}

.hero > p:last-child,
.summary-card > p {
  line-height: 1.65;
}

.card {
  border: 1px solid rgba(35, 121, 166, 0.13);
  border-radius: 24px;
  background: rgba(255, 253, 247, 0.96);
  box-shadow: var(--shadow);
}

.action-card,
.tools-card,
.question-card,
.summary-card {
  padding: clamp(1rem, 4vw, 1.75rem);
}

.tools-card {
  margin-top: 1rem;
}

.action-list {
  display: grid;
  gap: 0.75rem;
}

.action-button,
.primary-button,
.secondary-button,
.text-button,
.icon-button {
  border: 0;
  border-radius: 15px;
  font-weight: 800;
  cursor: pointer;
}

.action-button {
  display: grid;
  grid-template-columns: 2rem 1fr;
  align-items: center;
  width: 100%;
  min-height: 60px;
  padding: 0.8rem 1rem;
  color: var(--ink);
  text-align: left;
  background: #e6f5fc;
  border: 2px solid transparent;
}

.action-button__copy {
  display: grid;
  gap: 0.18rem;
}

.action-button__label,
.action-button__detail {
  display: block;
}

.action-button__detail {
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.78;
}

.action-button--focus {
  color: white;
  background: var(--sky-600);
}

.action-icon::before {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}

.action-icon--today::before { content: "☀"; }
.action-icon--mistakes::before { content: "↻"; }
.action-icon--free::before { content: "✦"; }

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 54px;
  padding: 0.75rem 1rem;
}

.primary-button {
  color: white;
  background: var(--coral);
  box-shadow: 0 8px 18px rgba(183, 67, 52, 0.22);
}

.secondary-button {
  color: var(--sky-600);
  background: #e4f4fb;
}

.text-button {
  display: block;
  margin: 0.5rem auto 0;
  padding: 0.5rem 0.75rem;
  color: var(--coral-dark);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.audio-player {
  display: block;
  width: 100%;
  margin: 0.75rem 0;
}

.audio-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.6rem;
}

.audio-sections {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr));
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.day-button {
  min-width: 0;
  min-height: 48px;
  padding: 0.55rem;
  color: var(--ink);
  font-weight: 750;
  border: 2px solid var(--sky-300);
  border-radius: 12px;
  background: white;
}

.day-button[aria-pressed="true"] {
  color: white;
  border-color: var(--sky-600);
  background: var(--sky-600);
}

.menu .quiz-header h1 {
  font-size: clamp(1.5rem, 6vw, 2.25rem);
}

.quiz-header {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.75rem;
  align-items: center;
  margin: 0.5rem 0 1rem;
}

.quiz-header p {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.icon-button {
  width: 48px;
  height: 48px;
  padding: 0;
  color: var(--ink);
  background: white;
  border: 1px solid var(--sky-300);
}

progress {
  display: block;
  width: 100%;
  height: 0.65rem;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: white;
  accent-color: var(--coral);
}

progress::-webkit-progress-bar {
  background: white;
  border-radius: 999px;
}

progress::-webkit-progress-value {
  background: var(--coral);
  border-radius: 999px;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.82rem;
}

.skill-badge {
  padding: 0.35rem 0.65rem;
  color: var(--sky-600);
  font-weight: 800;
  border-radius: 999px;
  background: #e7f5fc;
}

.prompt-row {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 0.75rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.prompt-row h1 {
  font-size: clamp(1.4rem, 6vw, 2rem);
  line-height: 1.4;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.answers {
  display: grid;
  gap: 0.7rem;
}

.choice {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: 0.75rem;
  align-items: center;
  min-height: 54px;
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--sky-300);
  border-radius: 16px;
  background: white;
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--sky-600);
  background: #e9f7fd;
  box-shadow: inset 0 0 0 1px var(--sky-600);
}

.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice__marker {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  font-weight: 800;
  border-radius: 50%;
  background: var(--sky-100);
}

.choice:has(input:focus-visible) {
  outline: 3px solid #163f86;
  outline-offset: 2px;
}

.typed-answer {
  display: grid;
  gap: 0.5rem;
  font-weight: 700;
}

.typed-answer input {
  min-height: 52px;
  padding: 0.65rem 0.8rem;
  color: var(--ink);
  border: 2px solid var(--sky-300);
  border-radius: 14px;
  background: white;
}

.answer-prompt {
  min-height: 1.5rem;
  margin: 0.65rem 0;
  color: var(--incorrect);
  font-weight: 700;
}

.feedback-space {
  min-height: 0;
}

.feedback {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 2px solid currentColor;
  border-radius: 15px;
}

.feedback p {
  margin: 0.4rem 0 0;
  line-height: 1.5;
}

.feedback--correct {
  color: var(--correct);
  background: #e8f7ef;
}

.feedback--incorrect {
  color: var(--incorrect);
  background: #fff0ed;
}

.summary {
  display: grid;
  align-items: center;
}

.summary-card {
  text-align: center;
}

.summary-icon {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto 1rem;
  color: #7f4c00;
  font-size: 2rem;
  border-radius: 50%;
  background: #ffe3a3;
}

.summary-card h2 {
  margin-top: 1.5rem;
  text-align: left;
}

.summary-list {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--sky-300);
}

.status,
.helper {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.5;
}

.question-status:not(:empty) {
  padding: 0.65rem 0.8rem;
  color: var(--ink);
  border: 1px solid var(--sky-300);
  border-radius: 12px;
  background: white;
}

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

@media (hover: hover) {
  button:not(:disabled) {
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
  }

  button:not(:disabled):hover {
    filter: brightness(1.03);
    transform: translateY(-2px);
  }
}

@media (max-width: 380px) {
  .shell {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .card {
    border-radius: 19px;
  }

  .question-card {
    padding: 0.9rem;
  }
}

@media (min-width: 700px) and (orientation: portrait) {
  .shell {
    padding-top: max(2.5rem, env(safe-area-inset-top));
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
  }

  .home {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1rem;
    align-content: center;
  }

  .hero {
    grid-column: 1 / -1;
  }

  .tools-card {
    align-self: stretch;
    margin-top: 0;
  }
}

@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;
  }
}
