:root {
  --ink: #173042;
  --muted: #647784;
  --blue: #176b87;
  --blue-dark: #11526b;
  --blue-soft: #e7f4f8;
  --green: #47a47a;
  --green-soft: #e8f5ee;
  --amber: #dda53a;
  --amber-soft: #fff4d9;
  --red: #ce6b60;
  --red-soft: #fbecea;
  --paper: #fffefb;
  --line: #dce7e9;
  --shadow: 0 14px 40px rgba(31, 74, 91, 0.1);
  --kanji-font: "UD Digi Kyokasho N-R", "UD デジタル 教科書体 N-R",
    YuKyokasho, "Yu Kyokasho", "Noto Sans JP", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(105, 187, 181, 0.12), transparent 24rem),
    linear-gradient(180deg, #f6fbfb 0%, #eef7f5 100%);
  font-family: "Noto Sans JP", sans-serif;
  min-height: 100vh;
}

button,
select,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: auto;
  padding: 0 34px 110px;
}

.topbar {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  border: 0;
  background: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  width: 48px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px 8px 14px 8px;
  color: white;
  background: var(--blue);
  font: 700 25px "Kaisei Decol", serif;
  box-shadow: 5px 5px 0 #b9dfe4;
}

.brand strong {
  display: block;
  font: 700 22px "Kaisei Decol", serif;
  letter-spacing: 0.08em;
}

.brand small {
  color: var(--muted);
  letter-spacing: 0.08em;
}

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

.hidden-selectors {
  display: none;
}

.selectors label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

select {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  border-radius: 10px;
  padding: 9px 30px 9px 12px;
  color: var(--ink);
  cursor: pointer;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 36px;
  align-items: center;
  padding: 48px;
  border: 1px solid rgba(23, 107, 135, 0.1);
  border-radius: 28px;
  color: white;
  background: linear-gradient(125deg, #176b87 0%, #237e91 58%, #4b9d8a 100%);
  box-shadow: var(--shadow);
}

.home-test-card {
  width: min(720px, 100%);
  margin: 32px auto 0;
  padding: clamp(26px, 5vw, 46px);
  text-align: center;
}

.study-home {
  display: grid;
  gap: 18px;
  width: min(760px, 100%);
  margin: 24px auto 0;
}

.study-home > .eyebrow {
  color: var(--blue);
  justify-self: center;
}

.study-summary-card {
  padding: clamp(24px, 5vw, 38px);
  text-align: center;
}

.study-summary-card > span {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.study-summary-card h1 {
  margin: 0;
  font: 700 clamp(28px, 6vw, 42px)/1.35 "Kaisei Decol", serif;
}

.study-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.study-summary-grid div {
  display: grid;
  gap: 6px;
  padding: 18px 12px;
  border-radius: 18px;
  background: #f8fbfa;
}

.study-summary-grid small {
  color: var(--muted);
  font-weight: 700;
}

.study-summary-grid strong {
  color: var(--blue);
  font: 700 clamp(28px, 7vw, 42px) "Kaisei Decol", serif;
}

.home-test-card .eyebrow {
  color: var(--blue);
}

.home-test-card h1 {
  margin: 0;
  font: 700 clamp(30px, 7vw, 48px)/1.35 "Kaisei Decol", serif;
  letter-spacing: 0.03em;
}

.home-completion {
  display: grid;
  gap: 4px;
  margin: 28px auto 22px;
  padding: 22px;
  border-radius: 22px;
  background: var(--blue-soft);
}

.home-completion span,
.home-completion small {
  color: var(--muted);
  font-weight: 700;
}

.home-completion strong {
  color: var(--blue);
  font: 700 clamp(52px, 13vw, 84px) "Kaisei Decol", serif;
}

.home-score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.home-score {
  display: grid;
  gap: 4px;
  padding: 16px 10px;
  border-radius: 18px;
  background: #f8fbfa;
}

.home-score span {
  font-size: 24px;
  font-weight: 800;
}

.home-score strong {
  font: 700 30px "Kaisei Decol", serif;
}

.home-score.good span,
.home-score.good strong { color: var(--green); }
.home-score.close span,
.home-score.close strong { color: var(--amber); }
.home-score.miss span,
.home-score.miss strong { color: var(--red); }

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

.home-start-button,
.home-review-button {
  width: 100%;
  min-height: 62px;
  font-size: 18px;
}

.home-start-button.primary-button {
  color: white;
  background: var(--blue);
}

.home-empty-note {
  margin: 16px 0 0;
  color: var(--muted);
}

.hero::after {
  content: "学";
  position: absolute;
  right: 5%;
  top: -75px;
  font: 700 260px "Kaisei Decol", serif;
  color: rgba(255, 255, 255, 0.055);
  transform: rotate(9deg);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: currentColor;
  opacity: 0.6;
}

.hero h1 {
  margin: 0;
  max-width: 580px;
  font: 700 clamp(30px, 4vw, 44px)/1.45 "Kaisei Decol", serif;
  letter-spacing: 0.025em;
}

.hero p:not(.eyebrow) {
  margin: 14px 0 26px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.8;
}

.primary-button,
.secondary-button,
.outline-button {
  border: 0;
  border-radius: 13px;
  padding: 14px 22px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.primary-button {
  color: var(--blue-dark);
  background: white;
  box-shadow: 0 8px 18px rgba(8, 57, 70, 0.2);
}

.secondary-button {
  color: white;
  background: var(--blue);
}

.outline-button {
  color: var(--blue);
  border: 1px solid var(--blue);
  background: white;
}

.primary-button:hover,
.secondary-button:hover,
.outline-button:hover,
.filter-button:hover,
.score-button:hover {
  transform: translateY(-2px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none !important;
}

.progress-plate {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring {
  width: 210px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(#d2f6d6 var(--progress), rgba(255, 255, 255, 0.16) 0);
  box-shadow: inset 0 0 0 16px rgba(255, 255, 255, 0.08);
}

.progress-ring::before {
  content: "";
  position: absolute;
  width: 158px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #247b89;
  box-shadow: 0 8px 22px rgba(14, 63, 75, 0.25);
}

.ring-copy {
  position: relative;
  z-index: 1;
  text-align: center;
}

.ring-copy strong {
  display: block;
  font: 700 42px "Kaisei Decol", serif;
}

.ring-copy span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 22px;
  margin-top: 22px;
}

.parent-settings-panel {
  margin-bottom: 18px;
  padding: 24px;
}

.parent-current-test {
  max-width: 720px;
  margin: 22px auto 0;
  padding: clamp(24px, 5vw, 42px);
  text-align: center;
}

.parent-current-test .eyebrow {
  color: var(--blue);
}

.parent-current-test h2 {
  margin: 0;
  font: 700 clamp(30px, 6vw, 44px)/1.35 "Kaisei Decol", serif;
}

.parent-progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0 22px;
}

.parent-progress-grid div {
  display: grid;
  gap: 7px;
  padding: 20px 14px;
  border-radius: 20px;
  background: #f8fbfa;
}

.parent-progress-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.parent-progress-grid strong {
  color: var(--blue);
  font: 700 clamp(30px, 8vw, 48px) "Kaisei Decol", serif;
}

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

.parent-main-actions button {
  min-height: 58px;
  font-size: 17px;
}

.test-prep-current {
  background: linear-gradient(135deg, rgba(231, 244, 248, 0.9), rgba(255, 254, 251, 0.95));
}

.test-list-section {
  margin-top: 18px;
}

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

.test-prep-card {
  display: grid;
  gap: 8px;
  padding: 22px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.test-prep-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.test-prep-card strong {
  font: 700 24px "Kaisei Decol", serif;
}

.test-prep-card span:not(.range-label) {
  color: var(--blue);
  font-weight: 700;
}

.test-prep-card small {
  color: var(--muted);
}

.admin-fold {
  margin: 18px 0 0;
  text-align: center;
}

.settings-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-controls label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.settings-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-menu-item {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(23, 107, 135, 0.1);
  padding: 18px;
  text-align: left;
  cursor: pointer;
}

.settings-menu-item strong {
  color: var(--blue);
}

.settings-menu-item span {
  color: var(--muted);
  font-size: 13px;
}

.compact-range-list {
  grid-template-columns: 1fr;
}

.parent-test-overview {
  margin-top: 0;
}

.parent-test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding: 18px;
}

.parent-question-form {
  margin-bottom: 18px;
  padding: 24px;
}

.simple-question-form {
  display: grid;
  grid-template-columns: 2fr 0.7fr 1fr;
  gap: 14px;
}

.simple-question-form label {
  display: grid;
  align-content: start;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.simple-question-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
  background: white;
}

.simple-question-form input:focus {
  border-color: var(--blue);
  outline: 3px solid var(--blue-soft);
}

.simple-question-form small {
  color: var(--muted);
  font-size: 12px;
}

.parent-question-list {
  padding: 24px;
}

.render-diagnostic-panel {
  border-color: rgba(244, 153, 26, 0.35);
  margin-bottom: 18px;
  padding: 18px 24px;
}

.render-diagnostic-panel > strong {
  display: block;
  margin-bottom: 10px;
}

.render-diagnostic-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.render-diagnostic-list div {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(150px, 0.8fr) 1.2fr;
}

.render-diagnostic-list dt {
  color: var(--muted);
  font-weight: 700;
}

.render-diagnostic-list dd {
  font-weight: 800;
  margin: 0;
  overflow-wrap: anywhere;
}

.parent-question-row {
  display: grid;
  width: 100%;
  grid-template-columns: 34px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 0;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.parent-question-row:last-child {
  border-bottom: 0;
}

.parent-question-row strong {
  font-size: 15px;
}

.parent-question-row small {
  color: var(--muted);
}

.parent-question-row:hover strong {
  color: var(--blue);
}

.weakness-ranking {
  max-width: 720px;
  margin: 18px auto 0;
  padding: 24px;
}

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

.ranking-row:last-child {
  border-bottom: 0;
}

.ranking-row span {
  color: var(--muted);
  font-weight: 700;
}

.ranking-row strong {
  font: 700 30px var(--kanji-font);
}

.ranking-row b {
  color: var(--red);
}

.empty-mini {
  margin: 0;
  color: var(--muted);
}

.diagnostic-entry {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 18px auto 0;
  max-width: 720px;
  padding: 20px 24px;
}

.diagnostic-entry div {
  display: grid;
  gap: 4px;
}

.diagnostic-entry span {
  color: var(--muted);
  font-size: 14px;
}

.diagnostic-list {
  display: grid;
  margin: 0;
}

.diagnostic-list div {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(140px, 0.8fr) 1.2fr;
  padding: 12px 0;
}

.diagnostic-list div:last-child {
  border-bottom: 0;
}

.diagnostic-list dt {
  color: var(--muted);
  font-weight: 700;
}

.diagnostic-list dd {
  font-weight: 800;
  margin: 0;
  overflow-wrap: anywhere;
}

.diagnostic-code {
  background: #f5fbff;
  border: 1px solid rgba(23, 107, 135, 0.14);
  border-radius: 16px;
  color: #24445a;
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
}

.candidate-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.candidate-panel > strong {
  display: block;
  margin-bottom: 10px;
}

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

.candidate-grid button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  font: 700 24px var(--kanji-font);
  cursor: pointer;
}

.candidate-grid button:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.panel {
  border: 1px solid rgba(23, 107, 135, 0.1);
  border-radius: 22px;
  background: rgba(255, 254, 251, 0.9);
  box-shadow: 0 8px 28px rgba(31, 74, 91, 0.06);
}

.panel-inner {
  padding: 25px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 0;
  font: 700 20px "Kaisei Decol", serif;
}

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

.text-button {
  border: 0;
  padding: 6px;
  color: var(--blue);
  background: none;
  font-weight: 700;
  cursor: pointer;
}

.status-list {
  display: grid;
  gap: 12px;
}

.status-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: #f8fbfa;
}

.status-symbol {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-weight: 800;
}

.status-symbol.good { color: var(--green); background: var(--green-soft); }
.status-symbol.close { color: var(--amber); background: var(--amber-soft); }
.status-symbol.miss { color: var(--red); background: var(--red-soft); }
.status-symbol.new { color: #7a8991; background: #edf1f2; }

.status-row strong {
  font-size: 14px;
}

.status-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.status-count {
  font: 700 18px "Kaisei Decol", serif;
}

.completion-list {
  display: grid;
  gap: 15px;
}

.completion-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px 18px;
  padding: 17px;
  border-radius: 16px;
  background: #f8fbfa;
}

.completion-row div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.completion-row strong {
  font-size: 14px;
}

.completion-row span {
  color: var(--muted);
  font-size: 13px;
}

.completion-row b {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  color: var(--blue);
  font: 700 25px "Kaisei Decol", serif;
}

.completion-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #dfeaea;
}

.completion-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

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

.round {
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdfc;
}

.round.complete {
  background: var(--green-soft);
  border-color: #c6e8d5;
}

.round-number {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.round strong {
  display: block;
  margin: 20px 0 7px;
  font: 700 22px "Kaisei Decol", serif;
}

.round small {
  color: var(--muted);
}

.collection-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding: 28px 0 22px;
}

.collection-header h1 {
  margin: 5px 0 0;
  font: 700 36px "Kaisei Decol", serif;
}

.collection-summary {
  text-align: right;
}

.collection-summary strong {
  font: 700 28px "Kaisei Decol", serif;
}

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

.page-description {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  margin-bottom: 18px;
}

.filter-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  background: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.16s ease;
}

.filter-button.active {
  color: white;
  border-color: var(--blue);
  background: var(--blue);
}

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

.kanji-card {
  position: relative;
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px;
  text-align: left;
  background:
    linear-gradient(rgba(23, 107, 135, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 107, 135, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 22px 22px;
  cursor: pointer;
  transition: 0.18s ease;
}

.kanji-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(31, 74, 91, 0.1);
}

.kanji-card.display-only {
  cursor: default;
}

.kanji-card.display-only:hover {
  transform: none;
  box-shadow: none;
}

.kanji-character {
  display: block;
  margin-top: 10px;
  text-align: center;
  font: 700 52px var(--kanji-font);
  font-feature-settings: "jp04" 1;
}

.kanji-reading {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.stars {
  display: block;
  margin-top: 8px;
  color: var(--amber);
  font-size: 13px;
  letter-spacing: 2px;
  text-align: center;
}

.attempt-count {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.card-status {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.study-screen {
  max-width: 780px;
  margin: 24px auto 0;
}

.study-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.study-top button {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.study-progress {
  flex: 1;
  max-width: 420px;
  height: 8px;
  margin: 0 20px;
  overflow: hidden;
  border-radius: 99px;
  background: #dce8e9;
}

.study-progress span {
  display: block;
  width: var(--study-progress);
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.3s ease;
}

.question-card {
  min-height: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 30px;
  text-align: center;
  background:
    linear-gradient(rgba(23, 107, 135, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 107, 135, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 34px 34px;
}

.question-card .label {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.question-reading {
  margin: 30px 0 12px;
  font: 700 clamp(40px, 7vw, 66px) var(--kanji-font);
}

.question-reading-type {
  margin: 26px 0 10px;
  border-radius: 999px;
  padding: 7px 13px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 700;
}

.question-hint {
  max-width: 680px;
  margin: 0 0 28px;
  color: var(--ink);
  font-size: clamp(24px, 5vw, 30px);
  font-weight: 600;
  line-height: 1.65;
  font-family: var(--kanji-font);
  font-feature-settings: "jp04" 1;
}

.paper-instruction {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
}

.paper-instruction-icon {
  width: 28px;
  height: 28px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--blue);
  font-size: 14px;
}

.reveal-button {
  min-width: 210px;
  font-size: 16px;
}

.answer-box {
  width: min(360px, 100%);
  margin: 0 auto 28px;
  padding: 18px;
  border: 2px solid var(--blue);
  border-radius: 18px;
  background: var(--blue-soft);
  animation: appear 0.25s ease;
}

.answer-kanji {
  display: block;
  font: 700 74px var(--kanji-font);
  font-feature-settings: "jp04" 1;
}

.answer-example {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
  font-family: var(--kanji-font);
  font-feature-settings: "jp04" 1;
}

.question-coverage {
  display: grid;
  gap: 3px;
  text-align: right;
}

.question-coverage strong {
  font: 700 24px "Kaisei Decol", serif;
}

.question-coverage span,
.admin-note,
.question-form small,
.no-question {
  color: var(--muted);
  font-size: 12px;
}

.question-download {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.question-editor {
  margin-bottom: 18px;
  padding: 24px;
}

.question-form {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr 1fr;
  gap: 14px;
}

.question-form label {
  display: grid;
  align-content: start;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.question-form input,
.question-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  background: white;
}

.question-form input:focus,
.question-form select:focus {
  border-color: var(--blue);
  outline: 3px solid var(--blue-soft);
}

.question-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

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

.admin-note {
  margin: 18px 0 0;
}

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

.question-search-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 18px;
}

.question-search-panel > label {
  font-weight: 700;
}

.question-search-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.question-search-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 14px;
  background: white;
}

.question-search-row span,
.question-search-panel small {
  color: var(--muted);
  font-size: 12px;
}

.question-admin-card {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 16px;
  padding: 16px;
}

.question-admin-kanji {
  display: grid;
  min-height: 70px;
  place-items: center;
  border-radius: 14px;
  background: var(--blue-soft);
  font: 700 38px var(--kanji-font);
}

.question-row {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 34px 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  text-align: left;
  background: white;
  cursor: pointer;
}

.question-number {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.question-row-copy {
  display: grid;
  gap: 3px;
}

.question-row-copy strong {
  font-size: 14px;
}

.question-edit-label {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.question-row small {
  color: var(--muted);
}

.reading-type {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.reading-type.on {
  color: var(--blue);
  background: var(--blue-soft);
}

.reading-type.kun {
  color: var(--green);
  background: var(--green-soft);
}

.score-title {
  margin: 0 0 13px;
  font-weight: 700;
}

.score-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.score-button {
  width: 110px;
  border: 0;
  border-radius: 14px;
  padding: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease;
}

.score-button.good { color: #287353; background: var(--green-soft); }
.score-button.close { color: #956c15; background: var(--amber-soft); }
.score-button.miss { color: #9a4f48; background: var(--red-soft); }

.history-list {
  display: grid;
  gap: 12px;
}

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

.history-date {
  color: var(--muted);
  font-size: 12px;
}

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

.range-empty strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font: 700 22px "Kaisei Decol", serif;
}

.range-empty p {
  margin: 0 0 22px;
}

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

.range-card {
  width: 100%;
  padding: 22px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.range-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.range-card-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.range-card h2 {
  margin: 6px 0 0;
  font: 700 22px "Kaisei Decol", serif;
}

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

.range-percentage {
  color: var(--blue);
  font: 700 30px "Kaisei Decol", serif;
}

.range-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-top: 15px;
  font-size: 13px;
  font-weight: 700;
}

.range-stats .good { color: var(--green); }
.range-stats .close { color: #a87818; }
.range-stats .miss { color: var(--red); }
.range-stats .new { color: var(--muted); }

.range-rounds {
  margin-left: auto;
  color: var(--blue);
}

.range-name-panel {
  padding: 20px;
  margin-bottom: 16px;
}

.range-name-panel label {
  display: block;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 700;
}

.range-name-row {
  display: flex;
  gap: 10px;
}

.range-name-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
  color: var(--ink);
  background: white;
}

.range-name-row input:focus {
  border-color: var(--blue);
  outline: 3px solid var(--blue-soft);
}

.selection-toolbar {
  position: sticky;
  z-index: 4;
  top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 7px 22px rgba(31, 74, 91, 0.08);
  backdrop-filter: blur(12px);
}

.selection-toolbar span {
  color: var(--blue);
  font-weight: 700;
}

.selection-toolbar .text-button {
  margin-left: auto;
}

.kanji-card.selectable {
  min-height: 135px;
}

.kanji-card.selectable.selected {
  border: 2px solid var(--blue);
  background-color: var(--blue-soft);
  box-shadow: 0 8px 22px rgba(23, 107, 135, 0.13);
}

.selection-check {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: white;
  background: white;
  font-weight: 800;
}

.selected .selection-check {
  border-color: var(--blue);
  background: var(--blue);
}

.back-button {
  border: 0;
  padding: 0;
  color: var(--muted);
  background: none;
  cursor: pointer;
  font-weight: 700;
}

.range-actions {
  display: flex;
  gap: 9px;
}

.range-overview {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
  padding: 22px;
}

.range-completion {
  display: grid;
  place-items: center;
  min-height: 190px;
  align-content: center;
  border-radius: 18px;
  background: var(--blue-soft);
}

.range-completion span,
.range-completion small {
  color: var(--muted);
}

.range-completion strong {
  margin: 5px 0;
  color: var(--blue);
  font: 700 52px "Kaisei Decol", serif;
}

.range-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.group-note {
  display: flex;
  gap: 12px 24px;
  align-items: center;
  margin-bottom: 18px;
  padding: 16px 20px;
}

.group-note strong {
  color: var(--blue);
}

.group-note span {
  color: var(--muted);
  font-size: 13px;
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(23, 107, 135, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 12px 40px rgba(31, 74, 91, 0.16);
  backdrop-filter: blur(15px);
}

.nav-item {
  min-width: 82px;
  border: 0;
  border-radius: 13px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.nav-icon {
  display: block;
  margin-bottom: 2px;
  font-size: 19px;
}

.nav-item.active {
  color: var(--blue);
  background: var(--blue-soft);
}

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

@media (max-width: 800px) {
  .question-form {
    grid-template-columns: 1fr 1fr;
  }

  .question-prompt-field {
    grid-column: 1 / -1;
  }
  .app-shell {
    padding: 0 18px 105px;
  }

  .topbar {
    min-height: 84px;
  }

  .brand small,
  .selectors label > span {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 34px 26px;
  }

  .progress-plate {
    display: none;
  }

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

  .settings-menu,
  .settings-controls,
  .test-prep-list {
    grid-template-columns: 1fr;
  }

  .simple-question-form {
    grid-template-columns: 1fr;
  }

  .parent-question-row {
    grid-template-columns: 28px 1fr auto;
  }

  .parent-question-row small {
    grid-column: 2 / -1;
  }

  .parent-progress-grid {
    grid-template-columns: 1fr;
  }

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

  .candidate-grid {
    grid-template-columns: repeat(5, 1fr);
  }

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

  .range-list {
    grid-template-columns: 1fr;
  }

  .range-overview {
    grid-template-columns: 1fr;
  }

  .bottom-nav .nav-item {
    min-width: 58px;
  }
}

@media (max-width: 520px) {
  .question-form {
    grid-template-columns: 1fr;
  }

  .question-prompt-field {
    grid-column: auto;
  }

  .question-admin-card {
    grid-template-columns: 52px 1fr;
    padding: 12px;
  }

  .question-admin-kanji {
    min-height: 52px;
    font-size: 30px;
  }

  .question-row {
    grid-template-columns: 24px 30px 1fr;
  }

  .question-edit-label {
    display: none;
  }
  .app-shell {
    padding-inline: 12px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
  }

  .selectors {
    width: 100%;
    justify-content: stretch;
  }

  .selectors label {
    flex: 1;
  }

  .brand strong {
    font-size: 17px;
  }

  .brand-mark {
    width: 40px;
    height: 43px;
  }

  .selectors {
    gap: 4px;
  }

  select {
    width: 100%;
    max-width: none;
    padding: 8px 5px;
    font-size: 12px;
  }

  .hero {
    border-radius: 20px;
  }

  .hero h1 {
    font-size: 29px;
  }

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

  .kanji-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .kanji-card {
    min-height: 150px;
    padding: 9px;
  }

  .kanji-character {
    font-size: 42px;
  }

  .bottom-nav {
    bottom: 8px;
    width: calc(100% - 20px);
    justify-content: space-around;
  }

  .nav-item {
    min-width: 0;
    flex: 1;
    padding-inline: 5px;
  }

  .question-card {
    min-height: 430px;
    padding: 36px 20px;
  }

  .question-reading {
    margin-top: 24px;
  }

  .question-hint {
    font-size: clamp(24px, 7vw, 28px);
    line-height: 1.55;
  }

  .score-actions {
    gap: 7px;
  }

  .score-button {
    width: 86px;
  }

  .range-name-row,
  .range-actions {
    width: 100%;
    flex-direction: column;
  }

  .range-name-row .secondary-button,
  .range-actions .secondary-button,
  .range-actions .outline-button {
    width: 100%;
  }

  .selection-toolbar .text-button {
    width: 100%;
    margin-left: 0;
    text-align: left;
  }

  .range-counts {
    grid-template-columns: 1fr;
  }

  .group-note {
    align-items: flex-start;
    flex-direction: column;
  }

  .collection-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .collection-header h1 {
    font-size: 29px;
  }

  .collection-summary {
    text-align: left;
  }

  .completion-row {
    gap: 8px 12px;
    padding: 14px;
  }

  .diagnostic-entry,
  .diagnostic-list div,
  .render-diagnostic-list div {
    grid-template-columns: 1fr;
  }

  .diagnostic-entry {
    align-items: stretch;
    flex-direction: column;
  }
}
