/* かたちのにわ
   色は「あさがお」から。うすい藤色の地に、あさがおの青むらさき・葉のみどり・花のピンク・星のきいろ。
   古い iPad でも崩れないよう、flex の gap / aspect-ratio / inset / <dialog> は使っていない。 */

:root {
  --bg: #F1EFFA;
  --surface: #FFFFFF;
  --ink: #2A2748;
  --ink-soft: #625F87;
  --line: #DCD8F0;
  --asagao: #5750D6;
  --asagao-dark: #3F38B0;
  --asagao-tint: #E6E3FB;
  --leaf: #1F9D6B;
  --leaf-dark: #167A52;
  --leaf-tint: #DDF3E8;
  --sun: #FFC533;
  --sun-tint: #FFF3CC;
  --pink: #F2708B;
  --pink-tint: #FDE5EA;
  --radius: 20px;
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.7;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 96px; /* 下のタブバーのぶん */
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, strong { font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: var(--asagao); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--asagao); outline-offset: 3px; }
.icon { flex-shrink: 0; vertical-align: middle; }

/* ---------- 全体の枠 ---------- */

.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  max-width: 880px;
  margin: 0 auto;
  padding: 14px 20px 6px;
}
.brand {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: .04em;
}
.brand svg { margin-right: 8px; }
.parents-link {
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
}
.parents-link.is-active { background: var(--asagao-tint); color: var(--asagao-dark); }

.site-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface);
  border-top: 2px solid var(--line);
  padding: 6px 12px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
}
.site-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px 6px;
  border-radius: 16px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
.site-nav .icon { width: 28px; height: 28px; }
.site-nav a.is-active { color: var(--asagao); background: var(--asagao-tint); }

@media (min-width: 900px) {
  body { padding-bottom: 40px; }
  .site-header { grid-template-columns: 1fr auto 1fr; padding-top: 20px; }
  .parents-link { justify-self: end; }
  .site-nav {
    position: static;
    grid-template-columns: repeat(3, auto);
    grid-column-gap: 6px;
    background: none;
    border: 0;
    padding: 0;
  }
  .site-nav a { flex-direction: row; padding: 10px 18px; font-size: 16px; border-radius: 999px; }
  .site-nav .icon { width: 22px; height: 22px; margin-right: 8px; }
}

body[data-screen="play"] { padding-bottom: 24px; }
body[data-screen="play"] .site-header { display: none; }

.page { max-width: 760px; margin: 0 auto; padding: 12px 20px 24px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 16px; }
.page-head h1 { font-size: 28px; font-weight: 900; line-height: 1.3; }
.lead { color: var(--ink-soft); font-size: 15px; margin-bottom: 18px; }
.note { color: var(--ink-soft); font-size: 14px; }
.startup-note { max-width: 640px; margin: 40px auto; padding: 20px; text-align: center; }

/* ---------- ボタン ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 10px 22px;
  border: 0;
  border-radius: 16px;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.3;
  text-decoration: none;
  transition: transform .06s ease, box-shadow .06s ease;
}
.btn .icon { margin-right: 8px; }
.btn span + .icon { margin: 0 0 0 6px; }
.btn-primary { background: var(--asagao); color: #fff; box-shadow: 0 5px 0 var(--asagao-dark); }
.btn-soft { background: var(--asagao-tint); color: var(--asagao-dark); box-shadow: 0 4px 0 #C9C4F2; }
.btn-quiet { background: var(--surface); color: var(--ink-soft); box-shadow: inset 0 0 0 2px var(--line); }
.btn-danger { background: #D8455F; color: #fff; box-shadow: 0 4px 0 #A82C44; }
.btn-primary:active, .btn-soft:active, .btn-danger:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--asagao-dark); }
.btn-big { min-height: 68px; padding: 14px 32px; font-size: 22px; font-weight: 900; border-radius: 22px; }
.btn-wide { width: 100%; }
.btn-small { min-height: 44px; padding: 8px 16px; font-size: 15px; border-radius: 14px; }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; transform: none; }
.btn-quiet:disabled { box-shadow: inset 0 0 0 2px var(--line); }
.icon-btn {
  display: grid; place-items: center;
  width: 48px; height: 48px;
  border: 0; border-radius: 50%;
  background: var(--surface); color: var(--ink-soft);
  box-shadow: inset 0 0 0 2px var(--line);
}

.segment {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: #E2DFF5;
  border-radius: 16px;
  padding: 4px;
  max-width: 100%;
}
.segment button {
  min-height: 46px;
  padding: 6px 18px;
  border: 0; border-radius: 12px;
  background: none; color: var(--ink-soft);
  font-weight: 700; font-size: 16px; white-space: nowrap;
}
.segment button.is-active { background: var(--surface); color: var(--asagao-dark); box-shadow: 0 2px 0 #CFCBEA; }

.meter { display: block; height: 10px; border-radius: 999px; background: #E2DFF5; overflow: hidden; }
.meter > * { display: block; height: 100%; border-radius: 999px; background: var(--leaf); transition: width .3s ease; }

.star-gain {
  display: inline-flex; align-items: center;
  padding: 4px 14px 4px 8px; border-radius: 999px;
  background: var(--sun-tint); color: #7A5600; font-size: 20px;
}
.star-gain .icon { width: 28px; height: 28px; margin-right: 4px; }

/* ---------- ホーム ---------- */

.today {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-column-gap: 12px;
  align-items: center;
  margin-top: 8px;
}
.today-pal { align-self: end; }
.bubble {
  position: relative;
  display: inline-block;
  background: var(--surface);
  border-radius: 22px;
  padding: 14px 20px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
}
.bubble::before {
  content: "";
  position: absolute; left: -12px; top: 50%;
  margin-top: -10px;
  border: 10px solid transparent;
  border-right-color: var(--surface);
  border-left: 0;
}
.pots { display: flex; flex-wrap: wrap; align-items: flex-end; margin: 14px 0 16px; min-height: 84px; }
.pot { width: 60px; height: 80px; margin-right: 4px; }
.pots .pot-bloom { animation: bloom .5s ease-out both; }
.today .btn-big { width: 100%; max-width: 420px; }

.row-cards { display: grid; grid-row-gap: 12px; margin-top: 28px; }
.row-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  grid-column-gap: 14px;
  align-items: center;
  width: 100%;
  padding: 14px 18px;
  border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  text-align: left; text-decoration: none;
  box-shadow: 0 3px 0 var(--line);
}
.row-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; }
.row-icon .icon { width: 28px; height: 28px; }
.row-icon-book { background: var(--asagao-tint); color: var(--asagao); }
.row-icon-note { background: var(--pink-tint); color: #C7435F; }
.row-icon-star { background: var(--sun-tint); }
.row-text { display: block; min-width: 0; }
.row-text small { display: block; color: var(--ink-soft); font-size: 13px; line-height: 1.4; }
.row-text strong { display: block; font-size: 17px; line-height: 1.5; }
.row-text .meter { margin-top: 6px; max-width: 260px; }
.row-count { color: var(--ink-soft); font-weight: 700; font-size: 15px; white-space: nowrap; }

.week { margin-top: 32px; }
.week h2 { font-size: 17px; margin-bottom: 10px; }
.week h2 small { margin-left: 10px; font-weight: 500; font-size: 14px; color: var(--ink-soft); }
.week ul { display: grid; grid-template-columns: repeat(7, 1fr); grid-column-gap: 6px; }
.week li { text-align: center; }
.week-mark {
  display: grid; place-items: center;
  height: 64px;
  border-radius: 16px;
  background: #E7E4F6;
}
.week-mark .pot { width: 40px; height: 54px; margin: 0; }
.week li.is-bloomed .week-mark { background: var(--surface); box-shadow: inset 0 0 0 2px var(--leaf-tint); }
.week li.is-today .week-mark { box-shadow: inset 0 0 0 3px var(--asagao); }
.week small { font-size: 13px; color: var(--ink-soft); }
.week li.is-today small { color: var(--asagao-dark); font-weight: 700; }

.welcome { text-align: center; padding-top: 24px; }
.welcome-pals { display: grid; grid-template-columns: 150px 150px; justify-content: center; }
.welcome h1 { font-size: 28px; font-weight: 900; margin: 8px 0; }
.welcome p { font-size: 19px; }
.welcome-grades { display: grid; grid-template-columns: repeat(3, 1fr); grid-column-gap: 12px; max-width: 480px; margin: 24px auto 18px; }
.welcome-grades .btn { min-height: 76px; font-size: 24px; font-weight: 900; padding: 10px; }

@media (max-width: 560px) {
  .today { grid-template-columns: 1fr; text-align: center; }
  .today-pal { width: 150px; margin: 0 auto; }
  .bubble { font-size: 18px; margin-top: 6px; }
  .bubble::before { left: 50%; top: -10px; margin: 0 0 0 -10px; border: 10px solid transparent; border-bottom-color: var(--surface); border-top: 0; }
  .pots { justify-content: center; }
  .pot { width: 48px; height: 64px; }
  .pots { min-height: 68px; }
}

/* ---------- なかまの絵（3×2 のスプライト） ---------- */

.pal-sprite { display: block; width: 100%; background-size: 300% 200%; background-repeat: no-repeat; }
.pal-sprite::before { content: ""; display: block; padding-top: 100%; }
.capy-sprite { background-image: url("./assets/capy-friends.png"); }
.mara-sprite { background-image: url("./assets/mara-friends.png"); }

/* ---------- べんきょう（コース一覧） ---------- */

.pickers { display: grid; grid-row-gap: 10px; justify-items: start; margin-bottom: 8px; }
.subject { margin-top: 28px; }
.subject-head { display: grid; grid-template-columns: auto 1fr auto; grid-column-gap: 12px; align-items: center; margin-bottom: 12px; }
.subject-head h2 { font-size: 22px; font-weight: 900; padding-left: 14px; border-left: 8px solid var(--subject, var(--asagao)); line-height: 1.3; }
.subject-count { color: var(--ink-soft); font-size: 14px; }
.subject-shape { --subject: #F2A65A; }
.subject-math { --subject: #5750D6; }
.subject-japanese { --subject: #F2708B; }
.subject-english { --subject: #6FB5E0; }
.subject-science { --subject: #3DBE87; }
.subject-social { --subject: #E0A93B; }
.subject-thinking { --subject: #8E8AE0; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); grid-gap: 12px; }
.course {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 132px;
  padding: 16px 18px 14px;
  border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  text-align: left;
  box-shadow: 0 4px 0 var(--line);
}
.course:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.course strong { font-size: 18px; line-height: 1.4; }
.course small { color: var(--ink-soft); font-size: 13px; line-height: 1.5; margin-top: 2px; }
.course-progress { display: grid; grid-template-columns: 1fr auto; grid-column-gap: 10px; align-items: center; margin-top: 10px; }
.course-count { display: inline-flex; align-items: center; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.course-count .icon { width: 18px; height: 18px; margin-right: 2px; }
.course.is-complete .course-count { color: var(--leaf-dark); }
.course.is-last { box-shadow: 0 4px 0 var(--line), inset 0 0 0 3px var(--asagao); }

.dan-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 10px; margin-top: 16px; }
.dan {
  padding: 12px 6px; border: 0; border-radius: 16px;
  background: var(--asagao-tint); color: var(--asagao-dark);
  font-weight: 700; font-size: 15px; line-height: 1.4;
  box-shadow: 0 4px 0 #C9C4F2;
}
.dan strong { font-size: 28px; font-weight: 900; margin-right: 2px; }
.dan small { display: block; font-weight: 500; font-size: 13px; color: var(--ink-soft); }
.dan.is-complete { background: var(--leaf-tint); color: var(--leaf-dark); box-shadow: 0 4px 0 #B5E3CC; }

/* ---------- もんだい ---------- */

.player { max-width: 720px; margin: 0 auto; padding: 12px 16px 24px; }
.player-bar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 48px 1fr auto; grid-column-gap: 14px; align-items: center;
  padding: 8px 0 12px;
  background: var(--bg);
}
.player-progress strong { display: block; font-size: 15px; line-height: 1.4; margin-bottom: 4px; }
.player-progress .meter { height: 12px; }
.player-count { font-weight: 700; color: var(--ink-soft); min-width: 56px; text-align: right; }

.question { background: var(--surface); border-radius: 28px; padding: 24px 24px 20px; }
.question-course { font-size: 13px; color: var(--ink-soft); }
.question-title { font-size: 26px; font-weight: 900; line-height: 1.45; margin-top: 4px; }
.question-instruction { color: var(--ink-soft); font-size: 15px; margin-top: 6px; }
.activity { margin-top: 20px; }
.feedback { min-height: 30px; margin-top: 14px; font-weight: 700; color: var(--asagao-dark); font-size: 16px; }
.feedback:empty { min-height: 0; margin: 0; }
.feedback.is-nudge { color: #B0344F; animation: nudge .35s ease; }
.question-tools { display: flex; flex-wrap: wrap; margin: 14px -5px 0; }
.question-tools .btn { margin: 5px; min-height: 46px; padding: 8px 16px; font-size: 15px; }
#bookmark[aria-pressed="true"] { color: #C7435F; }
.question-nav { display: flex; justify-content: space-between; margin-top: 18px; padding-top: 16px; border-top: 2px dashed var(--line); }
.question-nav .btn { min-height: 44px; padding: 6px 14px; font-size: 15px; box-shadow: none; }

/* えらぶ */
.options { display: grid; grid-gap: 12px; }
.options-figure, .options-number { grid-template-columns: repeat(3, 1fr); }
.option {
  position: relative;
  border: 0; border-radius: 20px;
  background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 3px var(--line), 0 5px 0 var(--line);
  padding: 14px;
  font-weight: 700;
}
.option:active { transform: translateY(3px); box-shadow: inset 0 0 0 3px var(--line), 0 2px 0 var(--line); }
.options-figure .option svg { display: block; width: 100%; max-height: 130px; }
.options-number .option { min-height: 96px; font-size: 18px; }
.options-number .option strong { font-size: 40px; font-weight: 900; margin-right: 4px; }
.options-text .option { display: grid; grid-template-columns: 40px 1fr; grid-column-gap: 14px; align-items: center; text-align: left; font-size: 20px; line-height: 1.5; padding: 16px 18px; min-height: 72px; }
.option-letter {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--asagao-tint); color: var(--asagao-dark); font-size: 16px;
}
.options-figure .option-letter { margin: 6px auto 0; }
.option.is-correct { background: var(--leaf-tint); box-shadow: inset 0 0 0 4px var(--leaf); color: var(--leaf-dark); }
.option.is-correct .option-letter { background: var(--leaf); color: #fff; }
.option.is-wrong { opacity: .45; box-shadow: inset 0 0 0 3px var(--line); animation: nudge .35s ease; }
.option:disabled { cursor: default; transform: none; }

.match-reference { width: 200px; margin: 0 auto 18px; text-align: center; background: var(--bg); border-radius: 20px; padding: 10px 10px 8px; }
.match-reference svg { display: block; width: 100%; }
.match-reference span { font-size: 14px; color: var(--ink-soft); font-weight: 700; }
.count-scene { background: var(--bg); border-radius: 20px; padding: 12px; margin-bottom: 18px; }
.count-scene svg { display: block; width: 100%; max-height: 320px; }

.passage { background: var(--bg); border-radius: 18px; padding: 18px 20px; font-size: 19px; line-height: 2.1; white-space: pre-wrap; margin-bottom: 18px; }
.audio { background: var(--bg); border-radius: 18px; padding: 16px; margin-bottom: 18px; }
.audio .btn { margin: 0 8px 6px 0; }
.english-text { font-size: 28px; font-weight: 900; margin-top: 8px; }
.data-table { overflow-x: auto; margin-bottom: 18px; }
.data-table table { border-collapse: collapse; margin: 0 auto; font-size: 17px; background: var(--surface); }
.data-table caption { font-size: 13px; color: var(--ink-soft); padding-bottom: 6px; }
.data-table th, .data-table td { border: 2px solid var(--line); padding: 8px 18px; text-align: center; }
.data-table th { background: var(--asagao-tint); }

/* けいさん */
.story { background: var(--bg); border-radius: 18px; padding: 18px 20px; font-size: 21px; line-height: 2; }
.equation { text-align: center; font-size: 48px; font-weight: 900; letter-spacing: .04em; line-height: 1.4; }
.op { color: var(--asagao); }
.column-sum { width: 210px; margin: 0 auto; text-align: right; font-size: 44px; font-weight: 900; letter-spacing: .22em; line-height: 1.35; font-variant-numeric: tabular-nums; }
.column-sum .op { float: left; letter-spacing: 0; }
.column-line { border-top: 4px solid var(--ink); height: 8px; margin-right: -.22em; }
.calc { max-width: 340px; margin: 18px auto 0; }
.answer-fields { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; grid-column-gap: 10px; }
.answer-field {
  display: block; width: 100%; min-height: 84px;
  border: 0; border-radius: 18px;
  background: var(--bg);
  box-shadow: inset 0 0 0 3px var(--line);
  text-align: center; padding: 6px;
}
.answer-field small { display: block; font-size: 13px; color: var(--ink-soft); line-height: 1.4; }
.answer-field span { display: block; min-height: 48px; font-size: 38px; font-weight: 900; line-height: 48px; font-variant-numeric: tabular-nums; }
.answer-field.is-active { background: var(--surface); box-shadow: inset 0 0 0 4px var(--asagao); }
.answer-field.is-correct { background: var(--leaf-tint); box-shadow: inset 0 0 0 4px var(--leaf); color: var(--leaf-dark); }
.shake { animation: nudge .35s ease; }
.numberpad { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 8px; margin: 12px 0 14px; }
.key {
  min-height: 60px; border: 0; border-radius: 16px;
  background: var(--asagao-tint); color: var(--asagao-dark);
  font-size: 28px; font-weight: 900;
  box-shadow: 0 4px 0 #C9C4F2;
}
.key:active { transform: translateY(3px); box-shadow: 0 1px 0 #C9C4F2; }
.key-edit { background: var(--surface); color: var(--ink-soft); font-size: 17px; font-weight: 700; box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line); }
.key:disabled { opacity: .45; }

/* パズル */
.board { display: block; width: 100%; background: var(--bg); border-radius: 20px; -webkit-user-select: none; user-select: none; }
.board-label { fill: var(--ink-soft); font-size: 15px; font-weight: 700; }
.board-divider { stroke: #CFCBEA; stroke-width: 2; stroke-dasharray: 5 6; }
.shadow { fill: #D5D1EE; }
.shadow-outline { fill: none; stroke: #9C97CF; stroke-width: 2.5; stroke-linejoin: round; }
.slot { fill: none; stroke: #7A75B8; stroke-width: 1.5; stroke-dasharray: 5 4; }
.piece { stroke: #2A2748; stroke-opacity: .35; stroke-width: 2; stroke-linejoin: round; cursor: grab; touch-action: none; outline: none; }
.piece.is-selected { stroke: #2A2748; stroke-opacity: 1; stroke-width: 4; }
.piece.is-locked { cursor: default; stroke-opacity: .25; pointer-events: none; }
.piece:focus-visible { stroke: var(--asagao); stroke-opacity: 1; stroke-width: 5; }
.puzzle-tools { display: flex; flex-wrap: wrap; margin: 10px -5px 0; }
.puzzle-tools .btn { margin: 5px; }

/* きじゅつ */
.written-label { display: block; font-weight: 700; margin-bottom: 6px; }
.written-field { display: block; width: 100%; min-height: 160px; padding: 14px 16px; border: 3px solid var(--line); border-radius: 18px; font-size: 19px; line-height: 1.9; resize: vertical; margin-bottom: 14px; }
.written-field:focus { outline: none; border-color: var(--asagao); }
.rubric { margin-top: 20px; background: var(--bg); border-radius: 18px; padding: 18px; }
.rubric h3 { font-size: 17px; margin-bottom: 8px; }
.rubric-row { display: grid; grid-template-columns: 28px 1fr; grid-column-gap: 10px; align-items: start; padding: 8px 0; }
.rubric-row input { width: 26px; height: 26px; margin: 3px 0 0; accent-color: var(--leaf); }
.rubric .note { margin: 6px 0 14px; }

/* こたえ・けっか */
.solution { margin-top: 16px; background: var(--bg); border-radius: 18px; padding: 16px 20px; font-size: 16px; }
.solution h3, .solution summary { font-size: 15px; font-weight: 700; color: var(--asagao-dark); }
.solution summary { cursor: pointer; padding: 2px 0; }
.solution p { margin-top: 8px; line-height: 1.9; }
.solution-answer { font-weight: 700; font-size: 18px; }
.solution-diagram { max-width: 300px; margin: 10px auto 0; }
.solution-diagram svg, .explanation-figure { display: block; width: 100%; height: auto; max-height: 220px; }
.explanation-figure { max-width: 520px; margin: 10px auto; }
.explanation-figure text { fill: var(--ink); font-family: var(--font); }

.result { margin-top: 18px; padding: 20px; border-radius: 22px; background: var(--leaf-tint); animation: pop .3s ease-out; }
.result-head { display: flex; align-items: center; margin-bottom: 12px; }
.result-head h2 { font-size: 28px; font-weight: 900; color: var(--leaf-dark); line-height: 1.3; margin: 0 14px 0 12px; }
.result-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--leaf); color: #fff; }
.result-mark .icon { width: 30px; height: 30px; }
.result-news { margin-bottom: 14px; }
.result-news li { display: flex; align-items: center; padding: 3px 0; font-size: 16px; }
.result-news .pot { width: 30px; height: 40px; margin-right: 8px; }
.news-gift, .news-bloom { font-weight: 700; }
.result .btn-primary { background: var(--leaf); box-shadow: 0 5px 0 var(--leaf-dark); min-height: 60px; font-size: 20px; }
.result .btn-primary:active { box-shadow: 0 1px 0 var(--leaf-dark); }

.summary { background: var(--surface); border-radius: 28px; padding: 28px 24px; text-align: center; }
.summary-pal { width: 200px; margin: 0 auto; }
.summary h1 { font-size: 30px; font-weight: 900; }
.summary-count { font-size: 18px; margin-top: 4px; }
.summary-count strong { font-size: 34px; font-weight: 900; color: var(--asagao); }
.summary-stats { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; margin: 14px 0 22px; }
.summary-stats > * { margin: 4px 8px; }
.summary-bloom { display: inline-flex; align-items: center; font-weight: 700; }
.summary-bloom .pot { width: 36px; height: 48px; margin-right: 6px; }
.summary-actions { display: grid; grid-row-gap: 14px; max-width: 420px; margin: 0 auto; }

/* ---------- ごほうび ---------- */

.star-total { display: inline-flex; align-items: center; background: var(--sun-tint); color: #7A5600; border-radius: 999px; padding: 6px 18px 6px 10px; font-size: 16px; }
.star-total .icon { width: 30px; height: 30px; margin-right: 6px; }
.star-total strong { font-size: 26px; font-weight: 900; margin-right: 3px; }
.room { position: relative; }
.room-scene { display: block; width: 100%; height: auto; border-radius: 24px; }
.room-scene text { font-family: var(--font); font-weight: 700; }
.room-pal { position: absolute; left: 36%; bottom: 12%; width: 25%; }
.room-pal .pal-sprite { filter: drop-shadow(0 6px 3px rgba(42, 39, 72, .18)); }
.room-pal.stage-0 { width: 19%; left: 39%; }
.room-pal.stage-1 { width: 22%; left: 37.5%; }
.room-pal.stage-3, .room-pal.stage-4 { width: 28%; left: 34.5%; }
.room-caption { margin: 10px 2px 14px; font-size: 15px; color: var(--ink-soft); }
.room-caption strong { color: var(--ink); }
.ticket { background: var(--surface); border-radius: var(--radius); padding: 14px 18px; border-left: 10px solid var(--pink); margin-bottom: 20px; }
.ticket p { font-size: 14px; color: var(--ink-soft); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: #E2DFF5; border-radius: 16px; padding: 4px; }
.tab { min-height: 48px; border: 0; border-radius: 12px; background: none; color: var(--ink-soft); font-weight: 700; font-size: 17px; }
.tab.is-active { background: var(--surface); color: var(--asagao-dark); box-shadow: 0 2px 0 #CFCBEA; }
.tab-panel h2 { font-size: 19px; font-weight: 900; margin: 22px 0 6px; }
.tab-panel h2 small { font-size: 14px; font-weight: 700; color: var(--ink-soft); margin-left: 8px; }
.tab-panel .note { margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; margin: -4px; }
.chip {
  display: inline-flex; align-items: center;
  margin: 4px; min-height: 46px; padding: 6px 16px;
  border: 0; border-radius: 999px;
  background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--line);
  font-weight: 700; font-size: 15px;
}
.chip.is-active { background: var(--asagao); color: #fff; box-shadow: none; }
.chip:disabled { color: var(--ink-soft); background: none; }
.chip small { display: inline-flex; align-items: center; margin-left: 8px; font-size: 13px; }
.chip small .icon { width: 16px; height: 16px; margin-right: 2px; }

.furniture, .pals, .stickers { display: grid; grid-gap: 10px; }
.furniture { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.pals { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.stickers { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.furniture-item, .pal, .sticker {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 0; border-radius: 18px; padding: 12px 8px;
  background: var(--surface); color: var(--ink);
  text-align: center; line-height: 1.4;
  box-shadow: inset 0 0 0 2px var(--line);
}
.furniture-item strong, .pal strong, .sticker strong { font-size: 14px; }
.furniture-item small, .pal small, .sticker small { display: inline-flex; align-items: center; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.furniture-item small .icon { width: 14px; height: 14px; margin-right: 2px; }
.furniture-icon { font-size: 32px; line-height: 1.3; }
.furniture-item.is-shown { box-shadow: inset 0 0 0 3px var(--leaf); background: var(--leaf-tint); }
.furniture-item.is-shown small { color: var(--leaf-dark); font-weight: 700; }
.is-locked { background: none; box-shadow: inset 0 0 0 2px var(--line); color: var(--ink-soft); }
.furniture-item.is-locked .furniture-icon { filter: grayscale(1); opacity: .45; }
.pal-art, .sticker-art { display: block; width: 100%; max-width: 120px; }
.pal.is-active { box-shadow: inset 0 0 0 4px var(--asagao); background: var(--asagao-tint); }
.pal.is-locked .pal-art { filter: grayscale(1) brightness(1.15); opacity: .4; }
.pal:disabled { cursor: default; }
.sticker { min-height: 132px; padding: 8px 6px 10px; }
.sticker strong { font-size: 12px; }
.sticker.sparkle { background: linear-gradient(135deg, #FFF8D6, #FFE9A8 55%, #FFFBEA); box-shadow: inset 0 0 0 2px #E8C766; }
.sticker.special { background: #ECE9FC; box-shadow: inset 0 0 0 2px #B9B3EE; }
.sticker.rainbow { background: linear-gradient(130deg, #FDE5EA, #FFF3CC, #DDF3E8, #E6E3FB); box-shadow: inset 0 0 0 2px #B9B3EE; }
.sticker-lock { color: #B9B5DA; }
.sticker-lock .icon { width: 32px; height: 32px; }
.sticker-big { text-align: center; border-radius: 24px; padding: 20px; }
.sticker-big .sticker-art { max-width: 240px; margin: 0 auto; }
.sticker-big h2 { font-size: 24px; font-weight: 900; }
.sticker-big p { color: var(--ink-soft); font-size: 15px; }

/* ---------- ふくしゅうノート ---------- */

.notebook .segment { margin-bottom: 18px; }
.note-list { margin-top: 18px; }
.note-item { display: grid; grid-template-columns: 1fr auto; grid-column-gap: 14px; align-items: center; background: var(--surface); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 10px; }
.note-text small { display: block; font-size: 13px; color: var(--ink-soft); }
.note-text strong { display: block; font-size: 17px; line-height: 1.5; }
.note-status { display: inline-block; margin-top: 4px; padding: 1px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--pink-tint); color: #B0344F; }
.note-status.reviewed { background: var(--leaf-tint); color: var(--leaf-dark); }
.note-actions { display: grid; grid-row-gap: 8px; }
.empty { text-align: center; padding: 40px 20px; background: var(--surface); border-radius: var(--radius); }
.empty h2 { font-size: 20px; margin-bottom: 6px; }
.empty p { color: var(--ink-soft); font-size: 15px; }
@media (max-width: 560px) {
  .note-item { grid-template-columns: 1fr; grid-row-gap: 10px; }
  .note-actions { grid-auto-flow: column; grid-column-gap: 8px; justify-content: start; }
}

/* ---------- おうちの方へ ---------- */

.parents { font-size: 15px; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.panel h2 { font-size: 19px; margin-bottom: 8px; }
.panel p { margin-bottom: 12px; color: var(--ink-soft); }
.panel .btn { margin: 0 8px 8px 0; }
.panel-danger { background: none; box-shadow: inset 0 0 0 2px var(--line); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 10px; margin-bottom: 16px; }
.stats div { background: var(--bg); border-radius: 14px; padding: 10px 14px; }
.stats dt { font-size: 13px; color: var(--ink-soft); }
.stats dd { font-size: 26px; font-weight: 900; line-height: 1.3; }
.stats dd small { font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.record { border-top: 2px solid var(--line); padding: 10px 0; }
.record summary { cursor: pointer; font-weight: 700; font-size: 16px; padding: 4px 0; }
.record summary span { color: var(--ink-soft); font-weight: 500; font-size: 14px; margin-left: 6px; }
.table-scroll { overflow-x: auto; margin-top: 8px; }
.parents table { width: 100%; border-collapse: collapse; font-size: 14px; }
.parents th, .parents td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.parents th { font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.parents .num { text-align: right; font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: auto 1fr; grid-gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.form-grid label { font-weight: 700; }
.form-grid select, .form-grid input { min-height: 46px; width: 100%; max-width: 420px; padding: 6px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); }
.status { font-size: 14px; color: var(--leaf-dark); font-weight: 700; }
.ticket-row { margin-top: 16px; padding-top: 14px; border-top: 2px solid var(--line); }
.ticket-row p { color: var(--ink); }
.confirm { background: var(--sun-tint); border-radius: 14px; padding: 12px 14px; color: var(--ink) !important; }
.confirm .btn { margin: 6px 6px 0 0; }
.history { font-size: 14px; color: var(--ink-soft); margin-top: 6px; }
.file-button { position: relative; overflow: hidden; cursor: pointer; }
.file-button input { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; grid-row-gap: 4px; }
}

/* ---------- シート（モーダル） ---------- */

body.sheet-open { overflow: hidden; }
.sheet-shade {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(42, 39, 72, .5);
}
.sheet {
  position: relative;
  width: 100%; max-width: 440px; max-height: 90vh; overflow: auto;
  background: var(--surface); border-radius: 28px; padding: 26px 24px 24px;
  outline: none;
  animation: pop .2s ease-out;
}
.sheet-wide { max-width: 720px; }
.sheet h2 { font-size: 22px; font-weight: 900; padding-right: 48px; }
.sheet-close { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--bg); color: var(--ink-soft); }

/* ---------- 小さな画面 ---------- */

@media (max-width: 560px) {
  body { font-size: 16px; }
  .page { padding: 8px 16px 20px; }
  .page-head h1 { font-size: 24px; }
  .question { padding: 20px 16px 16px; border-radius: 24px; }
  .question-title { font-size: 21px; }
  .options-figure, .options-number { grid-gap: 8px; }
  .options-figure .option { padding: 8px; }
  .options-number .option strong { font-size: 32px; }
  .options-text .option { font-size: 18px; padding: 14px; }
  .equation { font-size: 38px; }
  .story, .passage { font-size: 18px; padding: 14px 16px; }
  .segment button { padding: 6px 12px; font-size: 15px; }
  .subject-head { grid-template-columns: 1fr auto; }
  .subject-head .btn { grid-column: 1 / -1; justify-self: start; margin-top: 8px; }
  .course-grid { grid-template-columns: 1fr 1fr; grid-gap: 10px; }
  .course { padding: 14px 14px 12px; min-height: 120px; }
  .course strong { font-size: 16px; }
  .result-head h2 { font-size: 24px; }
}
@media (max-width: 360px) {
  .course-grid { grid-template-columns: 1fr; }
}

/* ---------- うごき ---------- */

@keyframes nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
@keyframes pop {
  from { transform: scale(.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes bloom {
  from { transform: scale(.6) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- プリント ---------- */

#worksheet { display: none; }
body.is-previewing > *:not(#worksheet) { display: none !important; }
body.is-previewing { background: #8F8CAB; padding: 0; }
body.is-previewing #worksheet { display: block; }
.preview-bar {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr auto auto; grid-column-gap: 10px; align-items: center;
  padding: 10px 16px; background: var(--surface); border-bottom: 2px solid var(--line);
}
.paper {
  max-width: 210mm; margin: 16px auto; padding: 14mm;
  background: #fff; color: #000;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif; font-size: 13px; line-height: 1.7;
}
.paper h1 { font-size: 20px; margin-bottom: 8px; }
.paper h2 { font-size: 14px; margin-bottom: 6px; }
.paper-help { margin: 8px 0 12px; }
.paper-grid { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 5mm; }
.paper-problem { border: 1px solid #999; border-radius: 3mm; padding: 4mm; break-inside: avoid; page-break-inside: avoid; }
.paper-problem > svg { display: block; width: 100%; max-height: 180px; }
.paper-text { line-height: 1.8; white-space: pre-wrap; }
.paper-equation { font-size: 20px; text-align: center; margin: 14px 0; }
.paper-options p { margin: 6px 0; }
.paper-match { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; }
.paper-match svg { display: block; width: 100%; }
.paper-match polygon { fill: #fff; stroke: #000; }
.paper-target { margin: 2mm auto; }
.paper-target svg { display: block; width: 100%; height: 100%; }
.paper-tiles { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; }
.paper-tiles svg { margin: 2mm; overflow: visible; }
.paper-lines { height: 52mm; background: repeating-linear-gradient(to bottom, transparent 0, transparent 9mm, #bbb 9mm, #bbb 9.2mm); }
.paper .data-table table { font-size: 12px; }
.paper .data-table th { background: #eee; }
.paper .data-table th, .paper .data-table td { border: 1px solid #999; padding: 4px 10px; }
.paper-answers { margin-top: 10mm; padding-top: 6mm; border-top: 1px dashed #999; break-before: page; page-break-before: always; }
.paper-answer-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 3mm 6mm; margin-top: 4mm; }
.paper-answer-grid.is-wide { grid-template-columns: 1fr; }
.paper-answer { break-inside: avoid; page-break-inside: avoid; overflow-wrap: break-word; }
.paper-answer > svg { display: block; width: 100%; max-height: 28mm; }
.paper-answer .explanation-figure { max-height: 45mm; }
.paper-explanation { font-size: 12px; line-height: 1.8; }

@media print {
  @page { size: A4; margin: 12mm; }
  body, body.is-previewing { background: #fff; padding: 0; }
  body > *:not(#worksheet) { display: none !important; }
  #worksheet { display: block; }
  .preview-bar { display: none; }
  .paper { max-width: none; margin: 0; padding: 0; }
}
