:root {
  color-scheme: light;
  --ink: #24302f;
  --muted: #66726d;
  --paper: #f8f4ec;
  --panel: #fffdf8;
  --panel-2: #f0eadf;
  --line: #d9cab8;
  --accent: #d84f31;
  --accent-dark: #a73525;
  --green: #2f7c6b;
  --blue: #315f8f;
  --gold: #b78122;
  --shadow: 0 18px 50px rgba(55, 42, 27, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(36, 48, 47, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(36, 48, 47, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 16% 12%, rgba(216, 79, 49, 0.13), transparent 30%),
    radial-gradient(circle at 88% 8%, rgba(47, 124, 107, 0.12), transparent 28%),
    var(--paper);
  background-size: 28px 28px, 28px 28px, auto, auto, auto;
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(216, 79, 49, 0.35);
  outline-offset: 2px;
}

.app {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.hero {
  margin-bottom: 14px;
}

.hero-main {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 4vw, 54px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 253, 248, 0.94), rgba(240, 234, 223, 0.86)),
    repeating-linear-gradient(-8deg, transparent 0 18px, rgba(183, 129, 34, 0.08) 18px 20px);
  box-shadow: var(--shadow);
}

.hero-main::before {
  content: "";
  position: absolute;
  top: clamp(18px, 3vw, 34px);
  right: clamp(18px, 3vw, 34px);
  width: clamp(28px, 4vw, 48px);
  height: clamp(28px, 4vw, 48px);
  border-radius: 50%;
  background: rgba(216, 79, 49, 0.9);
  box-shadow: 0 0 0 6px rgba(216, 79, 49, 0.12);
  pointer-events: none;
}

.hero-main::after {
  content: "あ";
  position: absolute;
  right: clamp(14px, 5vw, 74px);
  bottom: -62px;
  color: rgba(216, 79, 49, 0.1);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(180px, 24vw, 330px);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 30px;
  height: 2px;
  background: var(--accent);
}

h1 {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0;
  font-family: "Songti SC", "STSong", "Hiragino Mincho ProN", serif;
  font-size: clamp(42px, 7vw, 104px);
  line-height: 0.98;
  letter-spacing: 0;
}

.study-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  border: 1px solid rgba(36, 48, 47, 0.14);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(240, 234, 223, 0.76)),
    var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.study-card-top {
  padding: 20px 20px 8px;
}

.study-tag {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.learn-timing {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(36, 48, 47, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.72);
}

.learn-timing-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.learn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.learn-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.kana-display {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.big-kana {
  display: grid;
  place-items: center;
  min-height: 166px;
  border: 1px solid rgba(36, 48, 47, 0.12);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 20%, rgba(216, 79, 49, 0.08), transparent 58%),
    #fffdf8;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(76px, 12vw, 132px);
  line-height: 1;
}

.card-summary {
  display: grid;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid rgba(36, 48, 47, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.72);
}

.summary-section {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-height: 82px;
  padding: 18px 20px;
  border-top: 1px solid rgba(36, 48, 47, 0.16);
}

.summary-section:first-child {
  border-top: 0;
}

.summary-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.3;
}

.summary-reading {
  position: relative;
  align-items: start;
  padding-right: 68px;
}

.reading {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  margin: 0;
  min-width: 0;
  padding-right: 4px;
}

.reading-romaji {
  flex: 0 0 auto;
  min-width: 32px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
}

.reading-pron {
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  flex: 1 1 auto;
  min-width: 0;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.75;
}

.example {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  color: var(--ink);
}

.example-label {
  flex: 0 0 auto;
  display: none;
}

.example-word {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  color: var(--blue);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}

.example-read {
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.example-meaning {
  margin-left: auto;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  overflow: hidden;
  border-top: 1px solid rgba(36, 48, 47, 0.12);
  border-radius: 0 0 var(--radius) var(--radius);
  background: rgba(36, 48, 47, 0.12);
}

.card-actions button {
  min-height: 56px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.84);
  font-weight: 800;
}

.card-actions button:hover {
  color: #fffaf0;
  background: var(--accent);
}

.module-tabs {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px;
  border: 1px solid rgba(36, 48, 47, 0.12);
  border-radius: var(--radius);
  background: rgba(248, 244, 236, 0.9);
  backdrop-filter: blur(18px);
}

.module-tabs button {
  min-height: 48px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.module-tabs button:hover {
  background: rgba(255, 253, 248, 0.76);
  color: var(--ink);
}

.module-tabs button.is-active {
  color: #fffaf0;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(36, 48, 47, 0.16);
}

.module-view {
  display: none;
}

[hidden] {
  display: none !important;
}

.module-view.is-active {
  display: block;
  animation: moduleIn 180ms ease both;
}

@keyframes moduleIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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

.learn-shell {
  display: grid;
  grid-template-columns: minmax(360px, 720px);
  gap: 18px;
  justify-content: center;
  align-items: stretch;
}

.learn-shell .study-card {
  min-height: 520px;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  margin: 0 0 20px;
  padding: 12px;
  border: 1px solid rgba(36, 48, 47, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.82);
}

.search {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}

.segmented,
.row-filter {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.row-filter {
  max-width: none;
  overflow-x: auto;
}

.segmented button,
.row-filter button,
.plain-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.segmented button.is-active,
.row-filter button.is-active,
.plain-btn.is-active {
  color: #fffaf0;
  background: var(--ink);
}

.primary-btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius);
  color: #fffaf0;
  background: var(--accent);
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(216, 79, 49, 0.22);
  white-space: nowrap;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 6px 0 12px;
}

.section-title h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", "Hiragino Mincho ProN", serif;
  font-size: 28px;
  letter-spacing: 0;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.kana-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(116px, 1fr));
  gap: 10px;
}

.kana-tile {
  position: relative;
  min-height: 168px;
  padding: 14px;
  border: 1px solid rgba(36, 48, 47, 0.14);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 10px 25px rgba(55, 42, 27, 0.07);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.kana-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(216, 79, 49, 0.45);
  box-shadow: 0 16px 34px rgba(55, 42, 27, 0.12);
}

.kana-tile.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(216, 79, 49, 0.16), 0 18px 34px rgba(55, 42, 27, 0.14);
}

.tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.row-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.mini-actions {
  display: inline-flex;
  gap: 4px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(36, 48, 47, 0.12);
  border-radius: 6px;
  background: rgba(240, 234, 223, 0.7);
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.icon-btn:hover {
  color: #fffaf0;
  background: var(--green);
}

.pronunciation-btn {
  position: absolute;
  top: 14px;
  right: 20px;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-color: rgba(216, 79, 49, 0.22);
  background: rgba(216, 79, 49, 0.1);
  color: var(--accent-dark);
}

.pronunciation-btn:hover {
  background: var(--accent);
  color: #fffaf0;
}

.pronunciation-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.tile-kana {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 10px;
  min-height: 70px;
}

.tile-main {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 66px;
  line-height: 1;
}

.tile-sub {
  color: var(--muted);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 34px;
  line-height: 1;
}

.romaji {
  margin: 2px 0 0;
  color: var(--accent-dark);
  font-size: 16px;
  font-weight: 900;
}

.mnemonic {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.tile-example {
  margin: 6px 0 0;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(49, 95, 143, 0.06);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.panel {
  border: 1px solid rgba(36, 48, 47, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.9);
  box-shadow: 0 12px 30px rgba(55, 42, 27, 0.08);
}

.panel-inner {
  padding: 16px;
}

.quiz-panel {
  overflow: hidden;
}

.quiz-module {
  display: grid;
  grid-template-columns: minmax(320px, 680px);
  gap: 18px;
  justify-content: center;
  align-items: start;
}

.quiz-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid rgba(36, 48, 47, 0.12);
}

.quiz-tabs button {
  min-height: 44px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.quiz-tabs button.is-active {
  color: var(--ink);
  background: rgba(240, 234, 223, 0.84);
}

.quiz-question {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
  place-items: center;
  min-height: 112px;
  margin: 0 0 12px;
  padding: 16px;
  border: 1px solid rgba(36, 48, 47, 0.1);
  border-radius: var(--radius);
  background: var(--panel-2);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 62px;
  line-height: 1;
}

.quiz-question.is-audio {
  cursor: pointer;
  font-family: inherit;
}

.quiz-question-main {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
}

.quiz-question-computer {
  padding-left: 18px;
  border-left: 1px solid rgba(36, 48, 47, 0.14);
  color: var(--muted);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 0.72em;
}

.quiz-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.toggle-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

#restartQuiz {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 5px 12px rgba(55, 42, 27, 0.07);
}

#restartQuiz:hover {
  border-color: rgba(47, 124, 107, 0.46);
  background: rgba(47, 124, 107, 0.1);
  color: var(--green);
}

#restartQuiz:active {
  transform: translateY(1px);
}

.quiz-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto 10px;
}

.quiz-metric {
  display: grid;
  place-items: center;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid rgba(36, 48, 47, 0.1);
  border-radius: var(--radius);
  background: rgba(240, 234, 223, 0.6);
  text-align: center;
}

.quiz-metric strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
  white-space: nowrap;
}

.quiz-metric span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quiz-progress {
  height: 8px;
  margin: 0 0 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(36, 48, 47, 0.1);
}

.quiz-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 180ms ease;
}

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

.quiz-options button {
  min-height: 42px;
  border: 1px solid rgba(36, 48, 47, 0.12);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fffdf8;
  font-weight: 900;
}

.quiz-options button.is-correct {
  color: #fffaf0;
  background: var(--green);
}

.quiz-options button.is-wrong {
  color: #fffaf0;
  background: var(--accent);
}

.quiz-options .primary-btn {
  border-color: transparent;
  color: #fffaf0;
  background: var(--accent);
}

.quiz-options .primary-btn:hover {
  background: var(--accent-dark);
}

.quiz-result {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.quiz-input-answer {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.quiz-input-answer input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(36, 48, 47, 0.12);
  border-radius: var(--radius);
  background: #fffdf8;
  color: var(--ink);
}

.quiz-finished-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mistake-card {
  padding: 12px;
  border: 1px solid rgba(36, 48, 47, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.72);
}

.mistake-card strong {
  display: block;
  margin-bottom: 6px;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 24px;
  line-height: 1.1;
}

.mistake-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.mistake-title-row strong {
  margin-bottom: 0;
}

.mistake-title-row .icon-btn {
  flex: 0 0 auto;
}

.mistake-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.secondary-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  color: #fffaf0;
  background: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  transform: translateX(-50%) translateY(120px);
  max-width: min(92vw, 520px);
  padding: 12px 16px;
  border: 1px solid rgba(36, 48, 47, 0.14);
  border-radius: var(--radius);
  background: #263531;
  color: #fffaf0;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.empty {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 253, 248, 0.55);
  text-align: center;
}

@media (max-width: 1160px) {
  .learn-shell,
  .quiz-module {
    grid-template-columns: 1fr;
  }

  .row-filter {
    grid-column: 1 / -1;
    flex-wrap: wrap;
    overflow: visible;
  }
}

@media (max-width: 860px) {
  .app {
    padding: 16px;
  }

  .control-band {
    grid-template-columns: 1fr;
  }

  .row-filter {
    max-width: none;
    flex-wrap: wrap;
    overflow: visible;
  }

  .module-tabs {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 560px) {
  .app {
    padding: 16px;
  }

  .hero-main,
  .study-card-top {
    padding: 18px;
  }

  h1 {
    font-size: clamp(30px, 9.2vw, 38px);
    line-height: 1.05;
    overflow-wrap: anywhere;
  }

  .hero-main::after {
    right: 10px;
    bottom: -34px;
    font-size: 172px;
  }

  .module-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 18px;
  }

  .module-tabs button {
    min-width: 0;
    min-height: 42px;
    padding: 0 8px;
    font-size: 14px;
  }

  .learn-shell .study-card {
    min-height: auto;
  }

  .learn-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .study-card,
  .study-card-top,
  .learn-timing,
  .kana-display {
    min-width: 0;
  }

  .learn-toggle {
    white-space: normal;
  }

  .kana-display {
    grid-template-columns: 1fr 1fr;
  }

  .big-kana {
    min-width: 0;
    min-height: 112px;
    font-size: 76px;
  }

  .reading {
    align-items: center;
    gap: 8px;
  }

  .reading-pron {
    flex: 1 1 auto;
  }

  .summary-section {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: auto;
    padding: 14px 16px;
  }

  .summary-reading {
    padding-right: 58px;
  }

  .summary-label {
    font-size: 16px;
  }

  .reading {
    flex-wrap: nowrap;
  }

  .reading-romaji {
    font-size: 22px;
  }

  .reading-pron,
  .hint {
    font-size: 15px;
  }

  .pronunciation-btn {
    top: 12px;
    right: 16px;
  }

  .example-meaning {
    margin-left: 0;
  }

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

  .card-actions button {
    min-width: 0;
    min-height: 48px;
    padding: 0 8px;
  }

  .quiz-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    max-width: 100%;
  }

  .quiz-metric {
    min-height: 50px;
    padding: 7px 6px;
  }

  .quiz-metric strong {
    font-size: 15px;
  }

  .quiz-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .quiz-controls .segmented {
    display: grid;
    width: 100%;
  }

  .quiz-controls > .quiz-prompt-scripts {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .quiz-controls #listenAnswerMode {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quiz-controls .segmented button,
  .quiz-controls .toggle-label,
  .quiz-controls .plain-btn {
    justify-content: center;
    min-height: 42px;
    width: 100%;
    padding: 0 8px;
    text-align: center;
    white-space: normal;
  }

  .quiz-question {
    gap: 12px;
    font-size: 54px;
  }

  .quiz-question-computer {
    padding-left: 12px;
  }

  .quiz-input-answer {
    grid-template-columns: 1fr;
  }

  .kana-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .kana-tile {
    min-height: 154px;
    padding: 12px;
  }

  .tile-kana {
    gap: 6px;
    min-height: 58px;
  }

  .tile-main {
    font-size: 54px;
  }

  .tile-sub {
    font-size: 26px;
  }

  .mnemonic {
    font-size: 12px;
  }

  .section-title {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 360px) {
  .app {
    padding: 12px;
  }

  .hero-main,
  .study-card-top,
  .panel-inner {
    padding: 14px;
  }

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

  .quiz-metrics {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .module-view.is-active {
    animation: none;
  }

  .kana-tile:hover {
    transform: none;
  }
}
