/* Hallmark · v2 · shape: app screen · genre: playful · theme: warm study room · signature: one animated study companion */
/* critique: the room supports a single study action, with topic and progress readable before decorative detail. */
:root {
  --paper: #fff9ed;
  --white: #fffefa;
  --ink: #17352e;
  --quiet: #476258;
  --teal: #14634d;
  --teal-dark: #104938;
  --mint: #e0f2e9;
  --line: #c5d9ce;
  --field-line: #728c7e;
  --gold: #f4dfa7;
  --error: #8d2c24;
  --inactive: #ecf2ec;
  --inactive-ink: #52645b;
  --error-wash: #fce9e4;
  --ground: #e6baa1;
  --shadow: #17352e18;
  --shadow-dark: #17352e38;
  --clear: transparent;
  --font: ui-rounded, 'Nunito', system-ui, sans-serif;
  --radius: 22px;
  --micro: 160ms;
}
* { box-sizing: border-box; }
html,body { margin: 0; min-height: 100%; overflow-x: clip; }
body { background: var(--paper); color: var(--ink); font-family: var(--font); line-height: 1.5; font-size: 16px; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
h1,h2,h3,p { margin: 0 0 .55em; }
h1,h2,h3 { min-width: 0; overflow-wrap: break-word; line-height: 1.16; letter-spacing: -.025em; text-wrap: balance; }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
button,input,select { font: inherit; }
button { padding: .55rem .92rem; color: var(--ink); background: var(--white); border: 1px solid var(--line);
  border-radius: 12px; min-height: 44px; cursor: pointer; font-weight: 720; line-height: 1.3;
  transition: background-color var(--micro),border-color var(--micro),color var(--micro),transform var(--micro); }
button:hover:not(:disabled) { background: var(--mint); border-color: var(--teal); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { background: var(--inactive); color: var(--inactive-ink); cursor: not-allowed; }
button[aria-current=page], button[aria-pressed=true] { background: var(--mint); border-color: var(--teal); color: var(--teal-dark); }
input,select { width: 100%; min-height: 44px; padding: .55rem .74rem; border: 1px solid var(--field-line); border-radius: 10px; background: var(--white); color: var(--ink); }
input::placeholder { color: var(--quiet); opacity: 1; }
label { display: grid; gap: .35rem; font-weight: 670; }
img { max-width: 100%; }
small,.muted { color: var(--quiet); }
summary { cursor: pointer; padding-block: .45rem; }
.topbar { background: var(--white); border-bottom: 1px solid var(--line); }
.topbar-inner,.container,.auth-layout { width: min(calc(100% - 40px),1050px); margin-inline: auto; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 66px; }
.wordmark { border: 0; background: var(--clear); padding: 0; display: inline-flex; align-items: center; gap: 0; font-size: 1.3rem; letter-spacing: -.05em; }
.wordmark:disabled { background: var(--clear); color: var(--ink); cursor: default; }
.wordmark span { color: var(--teal); }
.wordmark img { width: 35px; height: 35px; object-fit: contain; margin-right: 8px; border-radius: 9px; }
nav { display: flex; gap: .35rem; }
nav button { border-color: var(--clear); background: var(--clear); white-space: nowrap; }
.container,.auth-layout { padding-block: 32px 48px; }
.primary { color: var(--white); background: var(--teal); border-color: var(--teal); padding-inline: 1.15rem; }
.primary:hover:not(:disabled) { background: var(--teal-dark); color: var(--white); }
.primary:focus-visible { outline-offset: 4px; }
.text-button { background: var(--clear); border-color: var(--clear); color: var(--teal-dark); padding-inline: .55rem; }
.text-button:hover:not(:disabled) { border-color: var(--clear); }
.quiet { background: var(--white); }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
.error { color: var(--error); background: var(--error-wash); border-radius: 10px; padding: .7rem .9rem; margin-bottom: 1rem; }
.auth-layout { display: grid; grid-template-columns: minmax(0,1.42fr) minmax(0,1fr); gap: 36px; align-items: start; }
.welcome { padding-top: 24px; }
.welcome h1 { font-size: 2.75rem; }
.welcome p { max-width: 46ch; color: var(--quiet); }
.room { background: var(--ground) url('/art/room-home.webp') center 61%/cover no-repeat; overflow: clip; position: relative; isolation: isolate; }
.welcome-room { height: 345px; border-radius: var(--radius); margin-top: 24px; display: flex; justify-content: center; align-items: flex-end; padding: 32px 0; }
.welcome-room .pet-drawing { width: 190px; height: 190px; z-index: 1; }
.welcome-friend { width: 155px; height: 155px; object-fit: contain; margin-left: -16px; filter: drop-shadow(0 6px 4px var(--shadow-dark)); }
.auth-panel,.family-quick,.family-settings,.worksheet,.selection { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.auth-panel form { display: grid; gap: 12px; margin: .9rem 0 .2rem; }
.auth-panel .segments { margin-top: 1rem; }
.auth-panel .primary { width: 100%; }
.segments { display: flex; align-items: center; gap: .45rem; margin-bottom: .65rem; }
.segments.wrap { flex-wrap: wrap; }
.desk { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); min-height: 364px;
  background: var(--mint); border: 1px solid var(--line); border-radius: var(--radius); overflow: clip; }
.desk-copy { padding: clamp(24px,4vw,48px); align-content: center; }
.grade-label { color: var(--teal-dark); font-weight: 700; font-size: .875rem; }
.desk-copy > p:not(.grade-label) { color: var(--quiet); margin-bottom: 1rem; }
.desk-room { display: grid; min-height: 290px; align-items: end; justify-items: center; padding-bottom: 32px; }
.pet-button { background: var(--clear); padding: 0; border: 0; width: 160px; aspect-ratio: 1; align-self: end; }
.pet-button.large { width: min(57%,246px); }
.pet-button:hover:not(:disabled) { background: var(--clear); }
.pet-drawing { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 4px var(--shadow-dark)); transform-origin: 50% 91%; }
.pet-drawing.cheer { animation: rejoice 640ms cubic-bezier(.3,.1,.27,1) both; }
.pet-drawing.greet { animation: greet 460ms ease-out both; }
@keyframes rejoice { 0%,100% { transform: translateY(0); } 46% { transform: translateY(-11px); } }
@keyframes greet { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-5deg); } }
.pet-controls { position: absolute; inset: auto 12px 9px; display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.pet-controls span { background: var(--white); border-radius: 10px; padding: 4px 8px; font-weight: 750; font-size: .86rem; }
.pet-controls button { font-size: .8rem; }
.room-lamp { position: absolute; width: 88px; bottom: 47px; right: 8%; filter: drop-shadow(0 4px 3px var(--shadow-dark)); }
.featured { display: flex; align-items: center; margin-bottom: 1rem; gap: 12px; }
.featured img { width: 62px; height: 62px; object-fit: contain; }
.featured small,.featured strong,.report-list small { display: block; }
.desk-note { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 12px; color: var(--quiet); }
.page-head { margin-bottom: 20px; }
.page-head p { color: var(--quiet); }
.catalog { display: grid; gap: .65rem; }
.subject-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,124px),1fr)); gap: 8px; }
.subject-list button { display: grid; align-items: center; justify-items: center; align-content: center; gap: 4px; min-height: 92px; }
.subject-list img { width: 44px; height: 44px; object-fit: contain; }
.topic-list,.choices,.report-list { display: grid; gap: 8px; }
.topic-list button { display: flex; align-items: center; justify-content: space-between; text-align: left; gap: 8px; min-height: 52px; }
.topic-list small { white-space: nowrap; }
.topic-list span small { display: block; white-space: normal; }
.selection { margin-top: 16px; display: grid; gap: 12px; }
.selection button { justify-self: start; }
.study-wrap { max-width: 1050px; margin: 0 auto; }
.study-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-block: 8px 8px; }
.study-meta strong { white-space: nowrap; }
progress { display: block; width: 100%; height: 11px; margin-bottom: 20px; accent-color: var(--teal); }
.study-content { display: grid; grid-template-columns: minmax(0,1.76fr) minmax(0,1fr); gap: 20px; align-items: start; }
.prompt-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.prompt-line h1 { font-size: 1.45rem; overflow-wrap: anywhere; margin-bottom: 1rem; white-space: pre-line; }
.listen { display: grid; flex: none; justify-items: center; font-size: .71rem; gap: 0px; padding: .3rem .5rem; }
.listen img { width: 24px; height: 24px; }
.reading p { white-space: pre-wrap; overflow-wrap: anywhere; }
.reading { margin-bottom: 12px; }
.choices button,.matching button { min-height: 49px; text-align: left; display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.choices b,.matching b { color: var(--teal-dark); background: var(--mint); min-width: 24px; height: 24px; border-radius: 6px; text-align: center; flex: none; display: grid; place-items: center; }
.choices img { width: 30px; height: 30px; object-fit: contain; }
.matching { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; }
.matching > div { display: grid; grid-auto-rows: 1fr; gap: 8px; }
.check-actions,.hint-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.coach { background: var(--mint); border-radius: var(--radius); display: grid; justify-items: center; padding: 12px 16px 16px; }
.coach .pet-drawing { width: 126px; height: 126px; }
.coach-content { width: 100%; min-width: 0; }
.coach-content h2 { font-size: 1.12rem; }
.lesson-note { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--white); overflow-wrap: anywhere; }
.lesson-note p:last-child { margin-bottom: 0; }
.primary-count,.primary-count-group,.primary-cue { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.primary-count-group { background: var(--mint); padding: 4px; border-radius: 8px; }
.primary-count img,.primary-cue img { width: 37px; height: 37px; object-fit: contain; }
.study-rectangle { width: 31px; height: 15px; background: var(--teal); color: var(--white); align-self: center; }
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin-block: 12px; }
.stats div { background: var(--mint); padding: 8px; border-radius: 12px; }
.stats strong,.stats span { display: block; }
.stats strong { font-size: 1.5rem; color: var(--teal-dark); font-variant-numeric: tabular-nums; }
.stats span { font-variant-numeric: tabular-nums; font-size: .85rem; line-height: 1.2; }
.summary { display: grid; grid-template-columns: minmax(0,.63fr) minmax(0,1fr); gap: 16px; align-items: center; }
.summary .pet-drawing { max-width: 220px; justify-self: center; }
.family-grid { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); gap: 16px; align-items: start; }
.family-settings .text-button { margin-top: .5rem; }
.report-section,.pet-group { margin-top: 24px; }
.report-list { padding: 0; list-style: none; }
.report-list > li { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--white);
  border: 1px solid var(--line); border-radius: 12px; padding: .65rem .85rem; }
.report-list details { width: 100%; }
.pet-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 8px; }
.pet-grid button { display: grid; grid-template-rows: auto 1fr; align-items: center; justify-items: center; overflow-wrap: anywhere; padding: .45rem; }
.pet-grid img { width: 100%; height: 110px; object-fit: contain; }
@media (max-width: 740px) {
  .topbar-inner,.container,.auth-layout { width: min(calc(100% - 28px),560px); }
  .topbar-inner { flex-wrap: wrap; gap: 0; padding-top: 4px; min-height: 54px; }
  nav { width: 100%; justify-content: space-between; gap: 4px; padding-bottom: 4px; }
  nav button { font-size: .86rem; padding-inline: .5rem; }
  .container,.auth-layout { padding-top: 16px; }
  .auth-layout,.desk,.family-grid,.study-content { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .auth-layout { gap: 16px; }
  .welcome { padding: 0; }
  .welcome h1,h1 { font-size: 1.85rem; }
  .welcome-room { height: 158px; margin-top: 12px; padding-bottom: 4px; }
  .welcome-room .pet-drawing { width: 125px; height: 125px; }
  .welcome-friend { width: 104px; height: 104px; }
  .auth-panel,.worksheet,.family-quick,.family-settings,.selection { padding: 16px; }
  .desk { gap: 0; }
  .desk-copy { padding: 20px; }
  .desk-room { min-height: 225px; padding-bottom: 28px; }
  .pet-button.large { width: min(49%,180px); }
  .coach { padding: 12px; grid-template-columns: minmax(0,66px) minmax(0,1fr); gap: 8px; }
  .coach .pet-drawing { width: 66px; height: 66px; }
  .study-meta { font-size: .89rem; }
  .prompt-line h1 { font-size: 1.24rem; }
  .pet-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .pet-grid img { height: 75px; }
  .summary { grid-template-columns: minmax(0,1fr); }
  .summary .pet-drawing { width: 100px; height: 100px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.fraction-example { margin-top: 8px; }
.fraction-example summary { font-weight: 700; }
.fraction-bar { display: grid; border: 1px solid var(--teal); gap: 2px; border-radius: 8px; overflow: clip; margin-block: 8px; }
.fraction-bar.pieces-4 { grid-template-columns: repeat(4,minmax(0,1fr)); }
.fraction-bar.pieces-8 { grid-template-columns: repeat(8,minmax(0,1fr)); }
.fraction-bar span { height: 30px; background: var(--mint); }
.fraction-bar .filled { background: var(--teal); color: var(--white); }
