:root {
  --bg: #fff4e6;
  --ink: #243044;
  --coral: #ff5a3c;
  --coral-d: #c63d24;
  --line: #f0d2b6;
  --blue: #5b7cfa;
  --blue-d: #3148b8;
  --card: #fff;
  --ok: #2f9e6b;
  --shadow: 0 8px 0 var(--line);
  font-family: ui-rounded, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { overflow: hidden; user-select: none; -webkit-user-select: none; }
.parent, .parent input, .parent textarea, .ann textarea { user-select: text; -webkit-user-select: text; }
[data-swipe] { touch-action: none; }
button, [role="button"] { font: inherit; color: inherit; }
button {
  min-width: 64px;
  min-height: 64px;
  touch-action: manipulation;
}
img { max-width: 100%; }

.screen {
  height: 100dvh;
  display: grid;
  grid-template-rows: 76px minmax(0, 1fr) auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background:
    radial-gradient(900px 420px at 10% -10%, #ffe1c4 0%, transparent 60%),
    var(--bg);
}
.screen.no-dock { grid-template-rows: 76px minmax(0, 1fr); }
.top {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
}
.top-right { display: flex; gap: 16px; align-items: center; }
.dots { display: flex; gap: 10px; justify-content: center; }
.dots i {
  width: 14px; height: 14px; border-radius: 99px;
  background: #ead5c0; display: block;
}
.dots i.on, .dots i.now { background: var(--coral); }
.dots i.now { transform: scale(1.25); }
.stage {
  min-height: 0;
  overflow: auto;
  padding: 8px 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.dock {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 8px 16px calc(12px + env(safe-area-inset-bottom));
  min-height: 148px;
}
.nav, .btn-side {
  width: 72px; height: 72px;
  border-radius: 99px;
  border: 4px solid var(--line);
  background: #fff;
  font-size: 32px;
  display: grid; place-items: center;
  box-shadow: 0 4px 0 var(--line);
}
.btn-side { width: 80px; height: 80px; font-size: 36px; }
.btn-side.on { background: #ffe08a; }
.btn-go {
  width: 120px; height: 120px;
  border-radius: 99px;
  border: 0;
  background: var(--coral);
  color: #fff;
  font-size: 54px;
  display: grid; place-items: center;
  box-shadow: 0 8px 0 var(--coral-d);
}
.btn-go:active, .btn-side:active, .nav:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--coral-d); }
.btn-side:active, .nav:active { box-shadow: 0 1px 0 var(--line); }
.btn-go.is-wait { background: #e7c3b6; box-shadow: 0 8px 0 #c9a494; }
.btn-go.rec-on, .btn-go.is-playing, .btn-side.is-playing { animation: pulse 1s ease-in-out infinite; }
.nav.debug { background: #fff6cc; }
button:focus-visible, [role="button"]:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; }

.cards {
  width: min(100%, 980px);
  display: flex;
  gap: 20px;
  align-items: stretch;
  justify-content: center;
}
.task-card {
  flex: 0.82;
  min-height: 240px;
  border-radius: 32px;
  background: var(--card);
  border: 4px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
}
.task-card.is-primary {
  flex: 1.15;
  min-height: 300px;
  border-color: var(--coral);
  box-shadow: 0 10px 0 var(--coral);
  animation: glow 2.2s ease-in-out infinite;
}
.task-card.is-done { opacity: 0.78; }
.stamp {
  position: absolute; top: 12px; right: 12px;
  font-size: 36px;
}
.icons { display: flex; gap: 8px; align-items: center; justify-content: center; }
.icons .illu { width: 84px; height: 84px; }
.task-card.is-primary .icons .illu { width: 104px; height: 104px; }
.cover {
  width: min(46vw, 180px);
  height: 140px;
  object-fit: cover;
  border-radius: 16px;
  background: #ffe8d2;
}
.pips { display: flex; gap: 8px; }
.pips i { width: 12px; height: 12px; border-radius: 99px; background: #ead5c0; display: block; }
.pips i.on { background: var(--coral); }
.stack {
  width: 96px; height: 80px;
  border: 0; background: transparent;
  position: relative;
}
.stack i {
  position: absolute; inset: 10px 14px;
  border-radius: 10px;
  background: #fff;
  border: 3px solid var(--coral);
  box-shadow: 4px 4px 0 #ffd0c4;
}
.stack i:first-child { transform: rotate(-8deg) translate(-6px, 2px); }

.frame, .crop {
  width: min(100%, 520px);
  background: #fff;
  border: 4px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.frame {
  min-height: 240px;
  height: min(42vh, 380px);
  display: grid;
  place-items: center;
  position: relative;
}
.frame .illu { width: 180px; height: 180px; }
.crop {
  height: min(46vh, 440px);
  overflow: hidden;
  position: relative;
}
.crop img {
  width: 100%;
  height: 158%;
  object-fit: cover;
  object-position: top center;
  display: block;
  pointer-events: none;
}
.page {
  max-height: calc(100dvh - 320px);
  max-width: min(100%, 440px);
  width: auto;
  object-fit: contain;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}
.pagebar {
  width: min(100%, 280px);
  height: 8px;
  background: #ead5c0;
  border-radius: 99px;
  overflow: hidden;
}
.pagebar span { display: block; height: 100%; background: var(--coral); }
.sentence {
  display: flex; flex-wrap: wrap; gap: 16px;
  justify-content: center; align-items: center;
  max-width: 920px;
}
.sentence span {
  font-size: 34px; font-weight: 800;
  min-width: 64px; min-height: 64px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 8px;
}
.sentence.is-btn {
  background: #fff;
  border: 4px solid var(--line);
  border-radius: 24px;
  padding: 8px 12px;
  box-shadow: var(--shadow);
}
.sentence span.is-hard { background: #ffe08a; border-radius: 16px; }
.gloss { margin: 0; font-size: 40px; font-weight: 800; }
.word-big { font-size: clamp(56px, 8vw, 88px); font-weight: 800; margin: 0; line-height: 1; }
.pattern { font-size: clamp(32px, 5vw, 48px); font-weight: 800; text-align: center; line-height: 1.25; margin: 0; }
.letter-now { font-size: 96px; font-weight: 800; line-height: 1; min-width: 96px; text-align: center; }
.slots { display: flex; gap: 12px; }
.slot {
  width: 64px; height: 76px;
  border-bottom: 6px solid var(--ink);
  font-size: 42px; font-weight: 800;
  display: grid; place-items: center;
}
.q-pips { display: flex; gap: 10px; }
.q-pips i { width: 14px; height: 14px; border-radius: 99px; background: #ead5c0; display: block; }
.q-pips i.on { background: var(--ok); }
.q-pips i.now { background: var(--coral); }

.copy-list { width: min(100%, 640px); display: flex; flex-direction: column; gap: 14px; }
.copy-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px; align-items: center;
  background: #fff; border-radius: 20px; padding: 8px 12px;
  border: 4px solid var(--line);
}
.copy-row .illu { width: 64px; height: 64px; }
.copy-row b { font-size: 36px; }
.boxes { display: flex; gap: 8px; }
.boxes i {
  width: 28px; height: 36px; border: 3px solid #d9b89a; border-radius: 6px; display: block;
}
.paper-nums { display: flex; gap: 24px; }
.paper-nums b {
  font-size: 80px; background: #fff; border-radius: 24px;
  border: 4px solid var(--line); min-width: 140px; text-align: center;
  box-shadow: var(--shadow); line-height: 1.2;
}
.illu { display: block; }

.pair { display: flex; gap: 24px; }
.bubble {
  width: 140px; height: 160px; border-radius: 28px;
  background: #fff; border: 4px solid var(--line);
  display: grid; place-items: center;
  box-shadow: var(--shadow);
}
.bubble.on { border-color: var(--coral); transform: scale(1.05); }
.bubble .illu { width: 96px; height: 96px; }
.hero-card {
  width: min(100%, 420px);
  min-height: 280px;
  background: #fff;
  border-radius: 32px;
  border: 6px solid var(--coral);
  box-shadow: 0 12px 0 var(--coral-d);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 16px;
  animation: pop .45s ease;
}
.hero-card .illu { width: 104px; height: 104px; }
.hero-words { font-size: 36px; font-weight: 800; margin: 0; }
.confetti { position: relative; width: 100%; height: 0; }
.confetti i {
  position: absolute; width: 12px; height: 12px; border-radius: 99px;
  animation: fall 900ms ease-in forwards;
}
.vwrap { width: min(100%, 860px); position: relative; }
video {
  width: 100%; max-height: calc(100dvh - 280px);
  background: #1b1b1b; border-radius: 24px; display: block;
}
.vbar { height: 8px; background: #ead5c0; border-radius: 99px; margin-top: 10px; overflow: hidden; }
.vbar span { display: block; height: 100%; width: 0; background: var(--coral); }
.ring-box { width: min(280px, 60vw); position: relative; }
.ring-box svg { width: 100%; height: auto; display: block; }
.ring-time {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 48px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.shake { animation: shake .4s linear; }
.is-right { animation: pop .35s ease; }

.parent {
  height: 100dvh; overflow: auto;
  padding: calc(16px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  background: #f6f7fb; color: #1d2430;
}
.parent h1 { font-size: 28px; margin: 8px 0 16px; }
.parent h2 { font-size: 20px; margin: 18px 0 8px; }
.menu { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.row, .menu button, .parent .btn {
  min-height: 64px;
  border-radius: 16px;
  border: 2px solid #d5d9e6;
  background: #fff;
  text-align: left;
  padding: 12px 16px;
  font-size: 18px;
}
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row.on { border-color: var(--ok); background: #eefbf4; }
.timer {
  font-size: 56px; font-weight: 800; font-variant-numeric: tabular-nums;
  margin: 0;
}
.timer.over { color: var(--coral-d); }
.muted { color: #5c6b80; font-size: 15px; }
.parent label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; margin: 8px 0; }
.parent input, .parent textarea, .parent select {
  min-height: 64px; font: inherit; font-size: 18px;
  border-radius: 12px; border: 2px solid #d5d9e6; padding: 8px 12px;
}
.parent textarea { min-height: 96px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 860px; }
.log-item { background: #fff; border-radius: 16px; padding: 12px 14px; margin: 8px 0; border: 2px solid #e4e7f0; }
.ann {
  position: fixed; inset: 0; background: rgba(20, 24, 32, .45);
  display: grid; place-items: center; z-index: 5; padding: 20px;
}
.ann form {
  width: min(520px, 100%); background: #fff; border-radius: 20px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.dot {
  position: fixed; top: 8px; left: 50%; width: 14px; height: 14px; border-radius: 99px;
  background: #ff9f1c; transform: translateX(-50%); z-index: 4;
}
.hold {
  width: 180px; height: 180px; border-radius: 99px;
  border: 8px solid var(--ink); background: #fff;
  display: grid; place-items: center;
}
.hold.on { background: #ffe08a; }
.gate {
  height: 100dvh; display: grid; place-items: center; background: #f6f7fb; gap: 16px;
  padding: 20px; text-align: center;
}
.gate .back {
  position: fixed; top: 16px; left: 16px;
}

@media (orientation: landscape) {
  .screen:not(.no-dock) {
    grid-template-columns: minmax(0, 1fr) 168px;
    grid-template-rows: 76px minmax(0, 1fr);
  }
  .top { grid-column: 1 / -1; }
  .dock { flex-direction: column; justify-content: flex-end; min-height: 0; }
  .cards { flex-direction: row; }
  .page { max-height: calc(100dvh - 230px); }
}
@media (orientation: portrait) {
  .cards { flex-direction: column; width: min(100%, 560px); }
  .task-card { min-height: 180px; }
  .task-card.is-primary { min-height: 240px; }
  .grid2 { grid-template-columns: 1fr; }
  .paper-nums b { font-size: 64px; }
}

@keyframes glow {
  50% { box-shadow: 0 10px 0 var(--coral), 0 0 0 8px rgba(255, 90, 60, .22); }
}
@keyframes pulse {
  50% { transform: scale(1.05); }
}
@keyframes pop {
  from { transform: scale(.86); }
  to { transform: scale(1); }
}
@keyframes shake {
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
@keyframes fall {
  to { transform: translateY(80px); opacity: 0; }
}
