@font-face { font-family: "Dela Gothic One"; src: url("fonts/dela-gothic-one.woff2") format("woff2"); font-display: block; }
@font-face { font-family: "Zen Maru Gothic"; src: url("fonts/zen-maru-gothic-bold.woff2") format("woff2"); font-weight: 700; font-display: block; }
@font-face { font-family: "Zen Maru Gothic"; src: url("fonts/zen-maru-gothic-black.woff2") format("woff2"); font-weight: 900; font-display: block; }

:root {
  --ink: #1b1d4d;
  --paper: #fff8ec;
  --blue: #3b6bff;
  --pink: #ff7ab6;
  --pink-soft: #ffd0e4;
  --blue-soft: #d9e4ff;
  --yellow: #ffd23f;
  --mint: #3fdcb0;
  --violet: #a77bff;
  --red: #ff4f6d;
  --E: 0;
  --kick: 0;
  --round: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  --chunky: "Dela Gothic One", "Zen Maru Gothic", sans-serif;
  --kyoka: "Klee One", "UD Digi Kyokasho N-R", "YuKyokasho", "Zen Maru Gothic", serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--round);
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }

#paper {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 122, 182, .16) 0 120px, transparent 121px),
    radial-gradient(circle at 88% 78%, rgba(59, 107, 255, .12) 0 160px, transparent 161px),
    linear-gradient(rgba(59, 107, 255, .11) 1.5px, transparent 1.5px) 0 0 / 26px 26px,
    linear-gradient(90deg, rgba(59, 107, 255, .11) 1.5px, transparent 1.5px) 0 0 / 26px 26px,
    var(--paper);
}
#rays-fallback {
  display: none; position: fixed; inset: -50vmax; z-index: 1; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg at 50% 50%, #3b6bff 0 9deg, #ff7ab6 9deg 18deg);
}
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
#fx-back { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; }
#actors { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; overflow: visible; }
#cutins { position: fixed; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
#flash { position: fixed; inset: 0; z-index: 7; pointer-events: none; background: #fff; opacity: 0; }
.dk-digit { font-family: var(--round); font-weight: 900; fill: var(--ink); stroke: #fff; stroke-width: 6px; paint-order: stroke; }

#app {
  position: relative; z-index: 2;
  width: min(100vw, 460px); height: 100dvh; max-height: 980px;
  margin: 0 auto;
}
@media (min-height: 980px) { #app { top: calc((100dvh - 980px) / 2); } }
.screen { position: absolute; inset: 0; display: none; }
.screen.is-active { display: flex; }

/* ------------------------------------------------------------ title */
#screen-title { flex-direction: column; align-items: center; justify-content: flex-start; gap: 14px; padding: calc(28px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
#screen-title > * { flex: none; }
/* Logo: layered paper cut-outs. A spinning burst sits behind "ドパ",
   "ドリル" rides on a folded ribbon, operator scraps float around. */
.logo { position: relative; margin: calc(var(--fs) * 0.62) 0 calc(var(--fs) * 0.2); display: grid; justify-items: center; font-family: var(--chunky); font-weight: 400; line-height: 1; --fs: clamp(64px, 21vw, 96px); }
.logo-burst { position: absolute; left: 50%; top: calc(var(--fs) * 0.52); width: calc(var(--fs) * 2.7); height: calc(var(--fs) * 2.7); transform: translate(-50%, -50%) rotate(calc(var(--spin, 0) * 1deg)); z-index: -1; filter: drop-shadow(0 6px 0 rgba(27, 29, 77, .9)); }
.logo-top { display: flex; gap: .02em; font-size: var(--fs); letter-spacing: -.04em; }
.logo i { font-style: normal; display: inline-block; position: relative; }
.logo-top i {
  color: #fff;
  /* white paper edge, ink outline, then an offset second sheet */
  text-shadow:
    0 0 0 #fff,
    3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink),
    2.5px 2.5px 0 var(--ink), -2.5px 2.5px 0 var(--ink), 2.5px -2.5px 0 var(--ink), -2.5px -2.5px 0 var(--ink),
    6px 7px 0 var(--pink), 8px 9px 0 var(--ink), 4px 10px 0 var(--ink);
  transform: rotate(var(--r, -6deg)) translateY(var(--dy, 0));
  animation: logo-hop 1.6s cubic-bezier(.3, 1.6, .5, 1) infinite;
}
.logo-top i:nth-child(1) { --r: -9deg; color: #fff; }
.logo-top i:nth-child(2) { --r: 7deg; --dy: -6px; animation-delay: -.8s; }
.logo-top i::after { content: attr(data-c); position: absolute; inset: 0; color: var(--blue); clip-path: polygon(0 62%, 100% 50%, 100% 100%, 0 100%); text-shadow: none; }
.logo-top i:nth-child(2)::after { color: var(--pink); }
.logo-ribbon { position: relative; display: flex; justify-content: center; gap: .1em; margin-top: calc(var(--fs) * 0.04); padding: .12em .9em .2em; font-size: calc(var(--fs) * 0.52); color: #fff; transform: rotate(-3deg); }
.ribbon-bg { position: absolute; inset: -6% -14% -10%; width: 128%; height: 116%; z-index: -1; filter: drop-shadow(0 5px 0 var(--ink)); }
.logo-ribbon i { text-shadow: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink), 0 4px 0 var(--ink); animation: logo-wave 1.6s ease-in-out infinite; }
.logo-ribbon i:nth-child(3) { animation-delay: -.25s; }
.logo-ribbon i:nth-child(4) { animation-delay: -.5s; }
.logo-bits { position: absolute; inset: 0; pointer-events: none; }
.logo-bits b { position: absolute; left: calc(50% + var(--x)); top: var(--y); font-size: calc(var(--fs) * 0.4); color: var(--c); transform: translate(-50%, -50%) rotate(var(--r)); text-shadow: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink), 3px 4px 0 var(--ink); animation: logo-float 2.4s ease-in-out infinite; }
.logo-bits b:nth-child(2) { animation-delay: -.6s; }
.logo-bits b:nth-child(3) { animation-delay: -1.2s; }
.logo-bits b:nth-child(4) { animation-delay: -1.8s; }
@keyframes logo-hop { 0%, 100% { transform: rotate(var(--r)) translateY(var(--dy, 0)) scale(1); } 12% { transform: rotate(var(--r)) translateY(calc(var(--dy, 0px) + 4px)) scale(1.08, .9); } 30% { transform: rotate(calc(var(--r) * -0.4)) translateY(calc(var(--dy, 0px) - 10px)) scale(.96, 1.06); } 55% { transform: rotate(var(--r)) translateY(var(--dy, 0)) scale(1); } }
@keyframes logo-wave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes logo-float { 0%, 100% { margin-top: 0; } 50% { margin-top: -8px; } }
body.reduced .logo *, body.reduced .logo-burst { animation: none !important; }
.settings-btn { display: grid; place-items: center; position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 14px; width: 48px; height: 48px; padding: 4px; background: #fff; box-shadow: 0 4px 0 var(--ink); z-index: 3; }
.settings-btn svg { display: block; width: 100%; height: 100%; transition: transform .4s; }
#open-settings:active svg { transform: rotate(90deg); }
.modes { display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* ------------------------------------------------------------ settings */
.modal { position: fixed; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(27, 29, 77, .45); }
.modal[hidden] { display: none; }
.modal-card { width: min(100%, 420px); max-height: 100%; overflow: auto; display: flex; flex-direction: column; align-items: stretch; gap: 16px; padding: 22px 18px 20px; border: 3.5px solid var(--ink); border-radius: 26px; background: var(--paper); box-shadow: 0 8px 0 var(--ink); }
.modal-card .chip { align-self: center; margin: 0; font-size: 18px; }
.modal-card .big-btn { align-self: center; min-width: 200px; height: 58px; font-size: 24px; }
.set-row { display: flex; flex-direction: column; gap: 8px; }
.set-label { font-weight: 900; font-size: 16px; }
.set-label b { font-family: var(--chunky); font-weight: 400; color: var(--blue); margin-left: 6px; }
.set-inline { display: flex; align-items: center; gap: 12px; }
.set-inline .slider { flex: 1; }
.set-note { margin: 0; font-size: 12px; opacity: .7; }
.reset-btn { align-self: center; min-width: 230px; font-weight: 900; }
.modal .pick { justify-content: center; }
.modal .pick button { width: 30%; max-width: 96px; }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 34px; background: transparent; margin: 0; --v: 1; }
.slider::-webkit-slider-runnable-track { height: 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: linear-gradient(90deg, var(--pink) 0 calc(var(--v) * 100%), #fff calc(var(--v) * 100%)); }
.slider::-moz-range-track { height: 10px; border: 2.5px solid var(--ink); border-radius: 999px; background: linear-gradient(90deg, var(--pink) 0 calc(var(--v) * 100%), #fff calc(var(--v) * 100%)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 32px; height: 32px; margin-top: -11px; border: 3px solid var(--ink); border-radius: 50%; background: var(--yellow); box-shadow: 0 3px 0 var(--ink); }
.slider::-moz-range-thumb { width: 26px; height: 26px; border: 3px solid var(--ink); border-radius: 50%; background: var(--yellow); box-shadow: 0 3px 0 var(--ink); }
.slider.motion::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--blue-soft), var(--pink) 50%, var(--yellow)) 0 0 / calc(var(--v) * 100%) 100% no-repeat, #fff; }
.slider.motion::-moz-range-track { background: linear-gradient(90deg, var(--blue-soft), var(--pink) 50%, var(--yellow)) 0 0 / calc(var(--v) * 100%) 100% no-repeat, #fff; }
.title-stage { width: 100%; height: min(26vh, 200px); }
.pick { display: flex; gap: 10px; }
.pick button {
  width: 84px; height: 56px; border: 3px solid var(--ink); border-radius: 16px; background: #fff;
  font-family: var(--chunky); font-size: 26px; box-shadow: 0 5px 0 var(--ink); transition: transform .08s;
}
.pick button small { font-family: var(--round); font-size: 14px; margin-left: 2px; }
.pick button[aria-checked="true"] { background: var(--yellow); transform: translateY(-3px) rotate(-2deg); }
.big-btn {
  min-width: 240px; height: 68px; padding: 0 28px; border: 3.5px solid var(--ink); border-radius: 22px;
  background: var(--blue); color: #fff; font-family: var(--chunky); font-size: 28px; letter-spacing: .06em;
  box-shadow: 0 7px 0 var(--ink); text-shadow: 0 3px 0 rgba(27, 29, 77, .55);
}
.big-btn small { font-family: var(--round); font-size: 16px; }
.big-btn:active, .sub-btn:active, .pick button:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink); }
.sub-btn { min-width: 160px; height: 52px; border: 3px solid var(--ink); border-radius: 18px; background: #fff; font-size: 18px; box-shadow: 0 5px 0 var(--ink); }
.toggles { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.toggle { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: #fff; font-size: 14px; }
.toggle i { font-style: normal; font-size: 16px; }
.toggle b { font-weight: 900; color: var(--blue); }
.toggle[aria-pressed="true"][data-toggle="motion"] b { color: var(--pink); }
.hint { margin: 0; font-size: 12px; opacity: .6; }

/* ------------------------------------------------------------ play */
#screen-play { flex-direction: column; padding: 8px 0 calc(10px + env(safe-area-inset-bottom)); }
.hud { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px; }
.pips { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; align-items: center; }
.pip { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--ink); background: #fff; }
.pips.many .pip { width: 11px; height: 11px; border-width: 2px; }
.pip.now { background: var(--yellow); animation: pip 0.8s ease-in-out infinite; }
.pip.done { background: var(--c, var(--blue)); }
.pip.rainbow { background: conic-gradient(#ff7ab6, #ffd23f, #3fdcb0, #3b6bff, #a77bff, #ff7ab6); }
@keyframes pip { 50% { transform: scale(1.3); } }
.clock { display: flex; align-items: baseline; gap: 8px; padding: 4px 12px; border: 2.5px solid var(--ink); border-radius: 999px; background: #fff; font-size: 12px; white-space: nowrap; }
.clock b { font-family: var(--chunky); font-weight: 400; font-size: 18px; font-variant-numeric: tabular-nums; }
.clock.over #clock-label { color: var(--red); }
.clock.extra { background: var(--ink); color: #fff; }
.clock.extra b { color: var(--yellow); font-size: 20px; }
.clock.hurry b { color: var(--red); animation: hurry .5s steps(2) infinite; }
@keyframes hurry { 50% { color: #fff; } }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 2.5px solid var(--ink); background: #fff; font-size: 18px; flex: none; }
.icon-btn[aria-pressed="true"] { background: var(--ink); color: #fff; text-decoration: line-through; }

.hud2 { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 40px; padding: 0 14px; }
.tally { display: flex; gap: 6px; font-size: 13px; }
.tally span { padding: 3px 10px; border-radius: 999px; background: #fff; border: 2px solid var(--ink); }
.tally b { font-family: var(--chunky); font-weight: 400; font-size: 16px; }
.tally small { font-size: 11px; opacity: .6; }
.tally .ng b { color: var(--violet); }
.dopa {
  display: flex; align-items: baseline; gap: 6px; max-width: 62%;
  padding: 3px 12px 4px; border: 2.5px solid var(--ink); border-radius: 12px; background: var(--yellow);
  box-shadow: 0 3px 0 var(--ink); transform-origin: right center; white-space: nowrap; overflow: hidden;
}
.dopa small { font-size: 11px; }
.dopa b { font-family: var(--chunky); font-weight: 400; font-size: 20px; letter-spacing: .01em; }
body.lv6 .dopa { background: linear-gradient(90deg, #ffd23f, #ff9ccc, #9fd0ff, #ffd23f); background-size: 300% 100%; animation: dopa-sheen 2s linear infinite; }
@keyframes dopa-sheen { to { background-position: 300% 0; } }
/* Combo (id032): floats under the tally, over the stage's top-left corner. */
.combo {
  position: absolute; left: 14px; top: calc(100% + 2px); display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 4px;
  padding: 2px 10px 10px; border: 2.5px solid var(--ink); border-radius: 12px; background: #fff; box-shadow: 0 3px 0 var(--ink);
  transform-origin: left center; opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s; pointer-events: none;
}
.combo.on { opacity: 1; visibility: visible; }
.combo b { font-family: var(--chunky); font-weight: 400; font-size: 22px; line-height: 1.1; color: var(--pink); }
.combo small { font-size: 11px; font-weight: 900; }
.combo-mult { grid-column: 1 / -1; font-size: 10px; font-weight: 900; opacity: .7; }
.combo-track { position: absolute; left: 6px; right: 6px; bottom: 3px; height: 4px; border-radius: 2px; background: #e6e4f0; overflow: hidden; }
.combo-track i { position: absolute; inset: 0; background: var(--blue); transform-origin: left center; }
.combo.hot { background: #fff4c4; }
.combo.hot b { color: var(--red); }
.combo.hot .combo-mult { opacity: 1; color: var(--red); }
.combo.hurry .combo-track i { background: var(--red); }

.stage { position: relative; flex: 1 1 auto; min-height: 118px; margin: 0 14px; }
.ground { position: absolute; left: 6%; right: 6%; bottom: 6px; width: 88%; height: 14px; }
.bunting { position: absolute; left: -2%; right: -2%; top: 0; width: 104%; height: 34px; opacity: 0; transform: translateY(-20px); transition: opacity .5s, transform .5s cubic-bezier(.3, 1.6, .5, 1); }
body.lv3 .bunting { opacity: 1; transform: none; }
.spot { position: absolute; top: -30px; width: 140px; height: 190px; opacity: 0; transition: opacity .6s; mix-blend-mode: screen; filter: blur(2px);
  background: linear-gradient(to bottom, rgba(255, 246, 200, .95), rgba(255, 246, 200, 0)); clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%); }
.spot-l { left: 0; transform-origin: 50% 0; animation: spot-l 3s ease-in-out infinite; }
.spot-r { right: 0; transform-origin: 50% 0; animation: spot-r 3.4s ease-in-out infinite; }
body.lv5 .spot { opacity: .7; }
@keyframes spot-l { 0%, 100% { transform: rotate(-24deg); } 50% { transform: rotate(10deg); } }
@keyframes spot-r { 0%, 100% { transform: rotate(24deg); } 50% { transform: rotate(-12deg); } }

.card {
  position: relative; margin: 0 14px 12px; padding: 10px 12px 10px;
  background: #fff; border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 7px 0 var(--ink);
  transform-origin: 50% 100%;
}
.card-top { display: flex; justify-content: space-between; align-items: center; }
.chip { display: inline-block; margin: 0; padding: 3px 12px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 13px; letter-spacing: .08em; }
.qno { font-family: var(--round); font-weight: 900; font-size: 15px; }
.sheet-wrap { display: flex; justify-content: center; align-items: center; min-height: 208px; padding: 4px 0 2px; }
.sheet { position: relative; display: grid; grid-template-columns: repeat(var(--cols), var(--cw)); grid-template-rows: repeat(var(--rows), var(--ch)); --cw: 54px; --ch: 52px; font-family: var(--round); font-weight: 900; }
.cell { position: relative; display: grid; place-items: center; font-size: calc(var(--ch) * .82); line-height: 1; font-variant-numeric: tabular-nums; }
.sheet.div .cell { font-size: calc(var(--ch) * .88); }
.cell.op { color: var(--blue); font-size: calc(var(--ch) * .7); }
.cell.small { align-self: end; font-size: clamp(12px, calc(var(--ch) * .38), 19px); color: var(--pink); height: calc(var(--ch) * .46); }
.cell.mark { color: var(--blue); font-size: clamp(11px, calc(var(--ch) * .34), 17px); letter-spacing: -.04em; }
.cell.struck::after { content: ""; position: absolute; left: 18%; right: 18%; top: 50%; height: 3.5px; background: var(--blue); border-radius: 2px; transform: rotate(-32deg); }
.cell.hidden { visibility: hidden; }
.cell.input { margin: 3px; border-radius: 12px; }
.cell.input.active { background: var(--blue-soft); outline: 3px dashed var(--blue); outline-offset: -3px; animation: active-cell 1s ease-in-out infinite; }
.cell.input.active::before { content: "?"; color: rgba(59, 107, 255, .35); }
.cell.input.active.has::before { content: none; }
.cell.input.ok { color: var(--ink); }
.cell.input.bad { color: #7a4bff; background: #efe8ff; outline: 3px dashed #a77bff; outline-offset: -3px; animation: none; }
.cell.hint-glow { border-radius: 8px; background: #fff3b8; box-shadow: 0 0 0 3px var(--yellow); animation: hint-glow .9s ease-in-out infinite; }
@keyframes hint-glow { 50% { box-shadow: 0 0 0 6px rgba(255, 210, 63, .5); } }
body.reduced .cell.hint-glow { animation: none; }
.help-text { display: inline-block; margin-left: 8px; padding: 1px 10px; border-radius: 999px; background: var(--yellow); color: var(--ink); font-weight: 900; }
.cell.input.pending { color: transparent; }
@keyframes active-cell { 50% { background: #c4d5ff; } }
.cell.auto { color: #5a5f93; }
.hline { position: relative; align-self: end; height: 3.5px; background: var(--ink); border-radius: 2px; margin-bottom: -2px; transform-origin: left center; }
.hline.hidden { visibility: hidden; }
.bracket { position: relative; border-top: 3.5px solid var(--ink); margin-left: 4px; }
.bracket::before { content: ""; position: absolute; left: -14px; top: -3.5px; width: 14px; height: calc(100% + 4px); border-right: 3.5px solid var(--ink); border-radius: 0 70% 70% 0 / 0 50% 50% 0; }
.step-label { margin: 2px 0 0; text-align: center; font-size: 14px; min-height: 20px; }
.step-label b { color: var(--blue); }

.stamp {
  position: absolute; right: 14px; top: 34px; width: 110px; height: 110px; border-radius: 50%; border: 9px solid var(--red); opacity: 0;
  box-shadow: inset 0 0 0 3px rgba(255, 79, 109, .3); pointer-events: none;
}
.reach-tag {
  position: absolute; left: 50%; bottom: -20px; transform: translateX(-50%) scale(0); z-index: 3; padding: 4px 16px; border-radius: 999px;
  background: var(--ink); color: var(--yellow); font-family: var(--chunky); font-size: 18px; letter-spacing: .1em; white-space: nowrap; border: 3px solid var(--yellow);
}
body.reach .reach-tag { animation: reach-blink .3s steps(2) infinite; }
@keyframes reach-blink { 50% { color: #fff; border-color: var(--pink); } }
body.reach .cell.input.active { outline: 4px solid var(--yellow); background: #fff3b8; animation: reach-cell .25s steps(2) infinite; box-shadow: 0 0 0 6px var(--pink), 0 0 24px 8px rgba(255, 210, 63, .9); z-index: 2; }
@keyframes reach-cell { 50% { box-shadow: 0 0 0 6px var(--blue), 0 0 30px 12px rgba(255, 122, 182, .9); } }
body.reach .card { z-index: 3; }

.marquee { position: absolute; inset: -9px; border-radius: 30px; pointer-events: none; opacity: 0; transition: opacity .6s; padding: 5px;
  background: radial-gradient(circle, #fff 0 2.5px, var(--yellow) 3px 4.5px, transparent 5px) 0 0 / 16px 16px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  animation: marquee .5s linear infinite; }
body.lv6 .marquee { opacity: 1; }
body.lv8 .marquee { background: radial-gradient(circle, #fff 0 2.5px, var(--pink) 3px 4.5px, transparent 5px) 0 0 / 16px 16px, radial-gradient(circle, #fff 0 2.5px, var(--yellow) 3px 4.5px, transparent 5px) 8px 8px / 16px 16px; }
@keyframes marquee { to { background-position: 16px 0, 24px 8px; } }
body.lv9 .card { box-shadow: 0 7px 0 var(--ink), 0 0 0 5px var(--pink), 0 0 40px 10px rgba(255, 210, 63, calc(.4 + var(--kick) * .6)); }

.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding: 0 14px; }
.pad button {
  position: relative; height: clamp(50px, 7.4dvh, 62px); border: 3px solid var(--ink); border-radius: 18px; background: #fff;
  font-family: var(--round); font-weight: 900; font-size: 30px; box-shadow: 0 5px 0 var(--ink);
  transform: translateY(calc(var(--kick) * -2px * var(--bounce, 0)));
}
.pad button.zero { grid-column: span 2; }
.pad button.del { background: var(--pink-soft); font-size: 24px; }
.pad button.press { transform: translateY(4px) scale(.97); box-shadow: 0 1px 0 var(--ink); }
body.lv4 .pad button { --bounce: 1; }
body.lv4 .pad button[data-key="7"], body.lv4 .pad button[data-key="3"] { background: #ffe3ef; }
body.lv4 .pad button[data-key="8"], body.lv4 .pad button[data-key="4"] { background: #fff4c7; }
body.lv4 .pad button[data-key="9"], body.lv4 .pad button[data-key="5"], body.lv4 .pad button[data-key="1"] { background: #e3ebff; }
body.lv4 .pad button[data-key="6"], body.lv4 .pad button[data-key="2"], body.lv4 .pad button[data-key="0"] { background: #dcfaef; }
body.lv8 .pad button { box-shadow: 0 5px 0 var(--ink), 0 0 calc(var(--kick) * 18px) rgba(255, 210, 63, .9); }
.pad button:disabled { opacity: .5; }

/* ------------------------------------------------------------ results */
#screen-result, #screen-final { align-items: safe center; justify-content: center; padding: 20px 16px; overflow-y: auto; }
#screen-result .result-card, #screen-final .result-card { margin: auto 0; flex: none; }
.actions .review-btn { font-size: 16px; white-space: nowrap; padding: 0 16px; }
.result-card {
  width: 100%; padding: 22px 20px 20px; text-align: center; background: #fff; border: 3.5px solid var(--ink); border-radius: 28px; box-shadow: 0 9px 0 var(--ink);
}
.score { margin: 8px 0 0; font-family: var(--chunky); line-height: 1; }
.score b { font-weight: 400; font-size: 92px; color: var(--pink); text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 0 8px 0 var(--ink); }
.score span { font-size: 28px; margin-left: 4px; font-family: var(--round); font-weight: 900; }
.stats dd small { font-family: var(--round); font-weight: 900; font-size: 14px; margin-left: 2px; }
.breakdown { margin: 8px 0 0; font-size: 15px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0 10px; }
.stats div { padding: 8px; border: 2.5px solid var(--ink); border-radius: 14px; background: var(--paper); }
.stats dt { font-size: 12px; opacity: .7; }
.stats dd { margin: 2px 0 0; font-family: var(--chunky); font-size: 22px; }
.dopa-final { margin: 6px 0 0; }
.dopa-final small { font-size: 12px; margin-right: 6px; }
.dopa-final b { font-family: var(--chunky); font-weight: 400; font-size: 24px; color: var(--blue); }
.unlock { min-height: 20px; font-size: 14px; margin: 10px 0 12px; }
.unlock.yes { color: var(--pink); }
.actions { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 8px; }

/* ------------------------------------------------------------ cut-ins */
.cutin-band { position: absolute; left: -20%; width: 140%; display: flex; align-items: center; justify-content: center; transform-origin: center; }
.cutin-band .band-bg { position: absolute; inset: 0; border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink);
  background: repeating-linear-gradient(-45deg, var(--c1) 0 22px, var(--c2) 22px 44px); }
.cutin-band .band-text { position: relative; font-family: var(--chunky); color: #fff; font-size: 44px; letter-spacing: .08em; white-space: nowrap;
  text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 0 7px 0 var(--ink); }
.unit-slam { position: absolute; font-family: var(--chunky); color: var(--yellow); white-space: nowrap; transform-origin: center;
  text-shadow: 4px 0 0 var(--ink), -4px 0 0 var(--ink), 0 4px 0 var(--ink), 0 -4px 0 var(--ink), 3px 3px 0 var(--ink), -3px 3px 0 var(--ink), 3px -3px 0 var(--ink), -3px -3px 0 var(--ink), 0 10px 0 var(--pink); }
.big-stamp { position: absolute; font-family: var(--chunky); color: var(--red); white-space: nowrap; transform-origin: center; }

body.reduced .logo span, body.reduced .spot, body.reduced .marquee, body.reduced .pip.now, body.reduced .cell.input.active { animation: none !important; }
@media (max-height: 840px) {
  /* Include toolbar-reduced phone heights and leave room for the bottom safe area. */
  .sheet-wrap { min-height: clamp(96px, calc(100dvh - 490px - env(safe-area-inset-bottom)), 176px); }
  #screen-play .card { padding-block: 8px; margin-bottom: 10px; }
  .pad { gap: 6px; }
  .pad button { height: 48px; }
  .stage { min-height: 80px; }
}
@media (max-height: 600px) {
  .stage { min-height: 48px; }
  .step-label { font-size: 12px; }
}

/* ------------------------------------------------------------ calendar */
.cal-card { width: 100%; max-width: 420px; padding: 12px 12px 14px; border: 3px solid var(--ink); border-radius: 22px; background: #fff; box-shadow: 0 6px 0 var(--ink); }
.cal-head { display: flex; align-items: center; justify-content: space-between; }
.cal-head h2 { margin: 0; font-family: var(--chunky); font-weight: 400; font-size: 20px; }
.cal-nav { width: 40px; height: 40px; border: 2.5px solid var(--ink); border-radius: 50%; background: var(--paper); font-size: 24px; line-height: 1; font-weight: 900; }
.cal-nav:disabled { opacity: .3; }
.cal-streak { margin: 4px 0 6px; min-height: 1.2em; text-align: center; font-size: 14px; font-weight: 900; color: var(--pink); }
.cal-streak b { font-family: var(--chunky); font-weight: 400; font-size: 20px; margin: 0 2px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-week span { text-align: center; font-size: 11px; font-weight: 900; opacity: .6; }
.cal-week span:first-child { color: var(--red); }
.cal-week span:last-child { color: var(--blue); }
.cal-day { position: relative; aspect-ratio: 1 / 1.08; min-height: 40px; padding: 0; border: 0; border-radius: 10px; background: var(--paper); font-size: 11px; font-weight: 900; color: var(--ink); }
.cal-day .n { position: absolute; left: 4px; top: 2px; opacity: .55; }
.cal-day.blank { background: transparent; }
.cal-day.today { box-shadow: inset 0 0 0 2.5px var(--blue); }
.cal-day.played { background: #fff0f6; cursor: pointer; }
.cal-day.played svg { position: absolute; inset: 8% 6% 2%; width: 88%; height: 90%; }
.cal-day .sc { position: absolute; left: 0; right: 0; bottom: 18%; text-align: center; font-family: var(--chunky); font-weight: 400; font-size: 12px; color: var(--red); letter-spacing: -.03em; text-shadow: 1.5px 0 0 #fff, -1.5px 0 0 #fff, 0 1.5px 0 #fff, 0 -1.5px 0 #fff; }
.cal-day .sc.big { font-size: 10px; }
.cal-day.pop { animation: cal-pop .7s cubic-bezier(.3, 1.8, .5, 1) both; }
@keyframes cal-pop { 0% { transform: scale(0) rotate(-30deg); } 100% { transform: scale(1) rotate(0); } }
.day-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.day-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 10px; padding: 8px 12px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; font-size: 13px; }
.day-list .t { font-weight: 900; opacity: .6; }
.day-list .m { font-weight: 900; }
.day-list .s { font-family: var(--chunky); font-weight: 400; font-size: 20px; color: var(--red); grid-row: span 2; }
.day-list .d { grid-column: 1 / 3; font-size: 12px; opacity: .75; }

/* ------------------------------------------------------------ expression layouts */
.cell.word { font-size: calc(var(--ch) * .46); white-space: nowrap; color: #4a4f86; }
.sheet.h .cell.op { font-size: calc(var(--ch) * .62); }
.cell.dot { justify-self: end; align-self: end; width: 0; overflow: visible; font-size: calc(var(--ch) * .82); line-height: .9; color: var(--ink); pointer-events: none; z-index: 1; display: flex; justify-content: center; }
.cell.dot.hidden { visibility: hidden; }
.cell.frac-n { align-self: end; }
.cell.frac-d { align-self: start; }
.cell.input.frac-n, .cell.input.frac-d { margin: 2px 3px; }
.hline.fbar { margin: 0 4px -2px; }

/* ------------------------------------------------------------ modes */
.level-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 78px; gap: 2px; background: var(--pink); }
.level-btn small { font-size: 13px; letter-spacing: 0; }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(100%, 340px); }
.grades button { height: 52px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; font-family: var(--chunky); font-size: 24px; box-shadow: 0 4px 0 var(--ink); }
.grades button small { font-family: var(--round); font-weight: 900; font-size: 12px; margin-left: 2px; }
.grades button:nth-child(6n+1) { background: #ffe3ef; } .grades button:nth-child(6n+2) { background: #e3ebff; } .grades button:nth-child(6n+3) { background: #fff4c4; }
.grades button:nth-child(6n+4) { background: #d9fbef; } .grades button:nth-child(6n+5) { background: #efe6ff; } .grades button:nth-child(6n+6) { background: #ffe6dc; }
.grades button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.mode-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.mode-row .sub-btn { min-width: 150px; font-weight: 900; }
.mode-row .sub-btn b, .review-btn b { font-family: var(--chunky); font-weight: 400; color: var(--pink); margin-left: 4px; }
.review-btn { background: #fff4c4; }

/* ------------------------------------------------------------ skill tree */
#screen-tree { flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 0 0; }
.tree-head { display: flex; align-items: center; gap: 10px; padding: 0 14px 6px; }
.tree-head h2 { margin: 0; flex: 1; font-family: var(--chunky); font-weight: 400; font-size: 22px; }
.tree-head .icon-btn { font-size: 26px; font-weight: 900; line-height: 1; }
.tree-count { font-family: var(--chunky); font-size: 16px; padding: 4px 10px; border: 2.5px solid var(--ink); border-radius: 999px; background: #fff; }
.tree-lanes { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 3px 4px; background: var(--paper); box-sizing: border-box; }
.tree-lanes span { text-align: center; font-size: 11px; font-weight: 900; padding: 3px 0; border-radius: 999px; background: var(--ink); color: #fff; }
.tree-scroll { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 0 6px calc(40px + env(safe-area-inset-bottom)); }
.tree { position: relative; }
.tree-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tree-links path { fill: none; stroke: #c9cbe8; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.tree-links path.on { stroke: var(--ink); }
.tree-links path.grow { stroke: var(--pink); stroke-width: 5; }
.node { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 3px 3px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--ink); font-size: 10.5px; font-weight: 900; line-height: 1.15; text-align: center; color: var(--ink); word-break: keep-all; overflow-wrap: anywhere; }
.node .g { font-size: 9px; opacity: .6; }
.node .ring { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 4px; border-radius: 3px; background: linear-gradient(90deg, var(--pink) calc(var(--p) * 100%), #eee calc(var(--p) * 100%)); }
.node.locked { background: #eceaf3; color: #8a8cb0; border-color: #a9abc9; box-shadow: 0 3px 0 #a9abc9; }
.node.locked::before { content: ""; position: absolute; top: -8px; right: -6px; width: 16px; height: 13px; border-radius: 3px; background: #a9abc9; box-shadow: inset 0 0 0 2px #8a8cb0; }
.node.locked::after { content: ""; position: absolute; top: -15px; right: -2px; width: 8px; height: 9px; border: 2.5px solid #8a8cb0; border-bottom: 0; border-radius: 6px 6px 0 0; }
.node.new { background: #fff4c4; animation: node-new 1.1s ease-in-out infinite; }
.node.new::after { content: "NEW"; position: absolute; top: -10px; right: -8px; padding: 1px 5px; border-radius: 999px; background: var(--pink); color: #fff; font-family: var(--chunky); font-weight: 400; font-size: 10px; border: 2px solid var(--ink); }
.node.learning { background: #e3ebff; }
.node.mastered { background: linear-gradient(160deg, #fff6c8, #ffd23f); }
.node.mastered::after { content: "★"; position: absolute; top: -12px; right: -6px; font-size: 20px; color: #ffb000; -webkit-text-stroke: 1.5px var(--ink); }
.node.just { animation: node-pop .8s cubic-bezier(.3, 1.8, .5, 1) both; }
@keyframes node-new { 50% { transform: translateY(-3px); } }
@keyframes node-pop { 0% { transform: scale(0) rotate(-20deg); } 100% { transform: scale(1); } }
body.reduced .node { animation: none !important; }
/* Long press to erase (id031): a pink fill rises while held. */
.node { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; overflow: visible; }
.node .hold { position: absolute; inset: 0; border-radius: 11px; background: rgba(255, 79, 109, .35); transform-origin: bottom; transform: scaleY(0); pointer-events: none; }
.node.holding .hold { transform: scaleY(1); transition: transform var(--hold-ms, 600ms) linear; }
.node.holding { transform: scale(.94); transition: transform .12s; }
.node.erased { animation: node-erase .6s ease-out both; }
@keyframes node-erase { 0% { transform: scale(1.12) rotate(4deg); filter: brightness(1.4); } 40% { transform: scale(.9) rotate(-3deg); } 100% { transform: none; } }
.tree-note { margin: 0 0 4px; text-align: center; font-size: 11px; font-weight: 900; opacity: .6; }
.confirm-msg { margin: 0; word-break: keep-all; overflow-wrap: anywhere; font-size: 15px; font-weight: 900; line-height: 1.6; text-align: center; }
.confirm-msg b { color: var(--red); }
.confirm-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.confirm-list li { padding: 3px 9px; border: 2px solid var(--ink); border-radius: 999px; background: #fff; font-size: 12px; font-weight: 900; }
.confirm-list li.more { border-style: dashed; background: transparent; }
.confirm-actions { display: flex; justify-content: center; gap: 12px; }
.confirm-actions .sub-btn { min-width: 120px; font-weight: 900; }
.sub-btn.danger { background: var(--red); color: #fff; text-shadow: 0 2px 0 rgba(27, 29, 77, .45); }
.toast { position: absolute; left: 16px; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); margin: 0; padding: 10px 14px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 5px 0 var(--ink); font-weight: 900; font-size: 14px; text-align: center; z-index: 3; pointer-events: none; }
.skill-news { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.skill-news:empty { display: none; }
.skill-news p { margin: 0; padding: 6px 10px; border: 2.5px solid var(--ink); border-radius: 12px; background: #fff4c4; font-size: 13px; font-weight: 900; text-align: center; }
.skill-news p.mastered { background: linear-gradient(160deg, #fff6c8, #ffd23f); }

/* ------------------------------------------------------------ demo play */
.demo-btn { align-self: center; min-width: 230px; font-weight: 900; background: #e3ebff; }
.demo-tag { display: none; padding: 3px 10px; border-radius: 999px; background: var(--red); color: #fff; font-family: var(--chunky); font-size: 13px; letter-spacing: .08em; border: 2.5px solid var(--ink); animation: demo-blink 1.2s steps(2) infinite; }
body.demo .demo-tag { display: inline-block; }
@keyframes demo-blink { 50% { opacity: .45; } }
body.reduced .demo-tag { animation: none; }

/* ------------------------------------------------------------ streak & login bonus */
.cal-badges { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 8px; min-height: 30px; }
.cal-badge { display: inline-flex; align-items: baseline; gap: 3px; padding: 3px 12px; border: 2.5px solid var(--ink); border-radius: 999px; background: #fff; font-size: 12px; font-weight: 900; }
.cal-badge b { font-family: var(--chunky); font-weight: 400; font-size: 20px; color: var(--pink); }
.cal-badge.hot { background: linear-gradient(90deg, #ffd23f, #ff9a3c); }
.cal-badge.hot b { color: var(--ink); }
.cal-badge.best b { color: var(--blue); }
.cal-badge.stk b { color: #ffb000; }
.cal-day .stk { position: absolute; top: 1px; right: 1px; width: 44%; height: 44%; pointer-events: none; }
.cal-day .stk svg { position: static; width: 100%; height: 100%; inset: auto; }
.bonus-card { align-items: center; text-align: center; }
.bonus-run { margin: 0; font-weight: 900; font-size: 15px; }
.bonus-run b { font-family: var(--chunky); font-weight: 400; font-size: 30px; color: var(--pink); margin: 0 4px; }
.bonus-card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; }
.bonus-slot { position: relative; min-width: 0; aspect-ratio: 1; overflow: hidden; display: grid; place-items: center; border: 2.5px dashed #b9bbd8; border-radius: 16px; background: #fff; font-family: var(--chunky); font-size: 18px; color: #c4c6de; }
.bonus-slot.got { border-style: solid; border-color: var(--ink); background: #fff4c4; }
.bonus-slot.today { border-color: var(--pink); box-shadow: 0 0 0 4px rgba(255, 122, 182, .35); }
.bonus-slot.big { background: linear-gradient(160deg, #fff6c8, #ffd23f); color: var(--ink); border-style: solid; border-color: #ffb000; }
.bonus-slot .d { position: absolute; left: 6px; top: 3px; font-size: 11px; color: #8a8cb0; font-family: var(--round); font-weight: 900; }
.bonus-slot svg { display: block; width: 72%; height: 72%; }
.bonus-slot.big svg { width: 86%; height: 86%; }
.bonus-slot.stamping svg { animation: stamp-in .6s cubic-bezier(.3, 1.8, .5, 1) both .35s; }
@keyframes stamp-in { 0% { transform: scale(2.6) rotate(-25deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(0); } }
body.reduced .bonus-slot.stamping svg { animation: none; }
.bonus-note { margin: 0; font-size: 13px; font-weight: 900; opacity: .75; }

/* ------------------------------------------------------------ no-count hammer (id034) */
.hammer-card { align-items: center; text-align: center; }
.hammer-art { width: 110px; height: 110px; transform: rotate(-24deg); filter: drop-shadow(0 5px 0 rgba(27, 29, 77, .85)); }
.hammer-art svg { width: 100%; height: 100%; }
.hammer-msg { margin: 0; font-size: 16px; font-weight: 900; line-height: 1.7; word-break: keep-all; }
.hammer-msg b { font-family: var(--chunky); font-weight: 400; color: var(--pink); font-size: 1.25em; margin: 0 2px; }
.hammer-have { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 0; font-size: 13px; font-weight: 900; }
.hammer-have i { display: inline-block; width: 30px; height: 30px; opacity: .22; filter: grayscale(1); }
.hammer-have i.on { opacity: 1; filter: none; }
.hammer-have svg, .cal-badge.hmr svg { width: 100%; height: 100%; display: block; }
.sub-btn.hammer-yes { background: var(--pink); color: #fff; text-shadow: 0 2px 0 rgba(27, 29, 77, .45); }
.cal-badge.hmr { align-items: center; }
.cal-badge.hmr i { width: 22px; height: 22px; margin-right: 2px; transform: rotate(-20deg); }
.cal-badge.hmr b { color: var(--blue); }
.cal-day.nocount { background: #efe8ff; }
.cal-day .nc { position: absolute; left: 50%; top: 56%; transform: translate(-50%, -50%) rotate(-14deg); padding: 1px 3px; border: 2px solid #7a4bff; border-radius: 5px; color: #7a4bff; font-size: 9px; font-weight: 900; letter-spacing: -.04em; white-space: nowrap; background: rgba(255, 255, 255, .7); }
.cal-day.stamped .nc { animation: nc-stamp .5s cubic-bezier(.3, 1.8, .5, 1) both; }
@keyframes nc-stamp { 0% { transform: translate(-50%, -50%) rotate(-30deg) scale(2.6); opacity: 0; } 100% { transform: translate(-50%, -50%) rotate(-14deg) scale(1); opacity: 1; } }
.hammer-fx { position: absolute; width: 100px; height: 100px; transform-origin: 50px 94px; filter: drop-shadow(0 4px 0 rgba(27, 29, 77, .8)); }
.hammer-fx svg { width: 100%; height: 100%; display: block; }

/* ------------------------------------------------------------ daily quests (id035) */
.quest-card { width: 100%; max-width: 420px; padding: 10px 12px 12px; border: 3px solid var(--ink); border-radius: 22px; background: #fff; box-shadow: 0 6px 0 var(--ink); }
.quest-card.complete { background: linear-gradient(160deg, #fffbe6, #fff2b8); }
.quest-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.quest-head h2 { margin: 0; font-family: var(--chunky); font-weight: 400; font-size: 18px; }
.quest-reward, .qm-head span { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 900; white-space: nowrap; }
.qham { display: inline-block; width: 22px; height: 22px; transform: rotate(-20deg); vertical-align: middle; }
.qham svg { width: 100%; height: 100%; display: block; }
.qdone { color: var(--pink); font-family: var(--chunky); font-weight: 400; font-size: 15px; }
.quest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.quest-list li { position: relative; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; padding: 6px 10px 9px 6px; border: 2.5px solid var(--ink); border-radius: 14px; background: var(--paper); font-size: 14px; font-weight: 900; overflow: hidden; }
.quest-list li.done { background: #dff8ec; }
.quest-list li.go { cursor: pointer; background: #fff4c4; box-shadow: 0 3px 0 var(--ink); }
.quest-list li.go::after { content: "▶"; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 10px; opacity: .55; }
.quest-list li.go .qp { margin-right: 12px; }
.qchk { width: 24px; height: 24px; border: 2.5px solid var(--ink); border-radius: 50%; background: #fff; color: #fff; display: grid; place-items: center; }
.qchk svg { width: 17px; height: 17px; }
li.done .qchk { background: var(--mint); }
.qt { word-break: keep-all; overflow-wrap: anywhere; line-height: 1.3; }
.qp { font-family: var(--chunky); font-weight: 400; font-size: 14px; color: var(--blue); }
li.done .qp { color: #1f9e76; }
.qbar { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--pink) calc(var(--p) * 100%), rgba(27, 29, 77, .12) calc(var(--p) * 100%)); }
li.done .qbar { background: var(--mint); }
.quest-mini { width: 100%; margin: 4px 0 10px; text-align: left; }
.quest-mini:empty { display: none; }
.qm-head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 5px; font-size: 13px; font-weight: 900; }
.quest-mini .quest-list li { font-size: 12.5px; padding: 4px 8px 7px 5px; grid-template-columns: 22px 1fr auto; }
.quest-mini .qchk { width: 20px; height: 20px; }
.qm-got { margin: 8px 0 0; padding: 6px 10px; border: 2.5px solid var(--ink); border-radius: 12px; background: linear-gradient(160deg, #fff6c8, #ffd23f); font-size: 13px; font-weight: 900; text-align: center; }
.quest-pop { position: absolute; left: 50%; display: flex; flex-direction: column; align-items: center; padding: 6px 16px 7px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 5px 0 var(--ink); font-size: 13px; font-weight: 900; white-space: nowrap; transform: translate(-50%, 0); opacity: 0; }
.quest-pop b { font-family: var(--chunky); font-weight: 400; font-size: 16px; color: var(--pink); }
.quest-pop.all { background: linear-gradient(160deg, #fff6c8, #ffd23f); }
.quest-pop.all b { color: var(--ink); font-size: 20px; }
.cal-day .qd { position: absolute; left: 2px; bottom: 1px; width: 15px; height: 15px; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--yellow); color: #fff; font-size: 9px; line-height: 12px; text-align: center; -webkit-text-stroke: .6px var(--ink); }

/* ------------------------------------------------------------ trophies (id036) */
.trophy-card { align-items: center; text-align: center; }
.tg-sub { margin: 0; font-size: 15px; font-weight: 900; }
.tg-sub:empty { display: none; }
.tg-sub b { font-family: var(--chunky); font-weight: 400; font-size: 24px; color: var(--pink); margin: 0 2px; }
.tg-list { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 7px; }
.tg-list li { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; text-align: left; transition: opacity .15s; }
.tg-list li i { width: 44px; height: 44px; }
.tg-list li svg, .tr-icon svg, .tr-series li i svg { width: 100%; height: 100%; display: block; }
.tg-list li b { display: block; font-size: 15px; font-weight: 900; }
.tg-list li small { display: block; font-size: 11.5px; opacity: .72; line-height: 1.35; }
.tg-list li.r-gold { background: #fff6cf; } .tg-list li.r-rainbow { background: linear-gradient(120deg, #ffe3ef, #fff4c4, #dcfaef, #e3ebff); } .tg-list li.r-secret { background: #efe6ff; }
.tg-list li.more { display: block; text-align: center; border-style: dashed; font-size: 13px; font-weight: 900; }
#screen-trophy { flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 0 0; }
.tr-filter { display: flex; justify-content: center; gap: 8px; padding: 0 14px 8px; }
.tr-filter button { height: 34px; padding: 0 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: #fff; font-size: 13px; font-weight: 900; }
.tr-filter button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tr-scroll { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 0 14px calc(40px + env(safe-area-inset-bottom)); }
.tr-cat { margin: 14px 0 6px; font-family: var(--chunky); font-weight: 400; font-size: 16px; }
.tr-cat:first-child { margin-top: 2px; }
.tr-series { margin-bottom: 8px; border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 3px 0 var(--ink); overflow: hidden; }
.tr-series summary { list-style: none; display: grid; grid-template-columns: 40px 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 10px; padding: 7px 12px 8px 7px; cursor: pointer; }
.tr-series summary::-webkit-details-marker { display: none; }
.tr-icon { grid-row: span 2; width: 40px; height: 40px; }
.tr-t { display: flex; flex-direction: column; min-width: 0; }
.tr-t b { font-size: 14px; font-weight: 900; }
.tr-next { font-size: 11.5px; opacity: .75; word-break: keep-all; overflow-wrap: anywhere; line-height: 1.35; }
.tr-next.done { color: var(--pink); opacity: 1; font-weight: 900; }
.tr-n { font-family: var(--chunky); font-size: 15px; color: var(--blue); }
.tr-dots { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.tr-dots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #b9bbd8; background: #fff; }
.tr-dots i.on { border-color: var(--ink); background: #eea36b; }
.tr-dots i.on.r-silver { background: #dde3ee; } .tr-dots i.on.r-gold { background: var(--yellow); } .tr-dots i.on.r-rainbow { background: conic-gradient(#ff7ab6, #ffd23f, #3fdcb0, #3b6bff, #ff7ab6); } .tr-dots i.on.r-secret { background: var(--violet); }
.tr-series[open] summary { border-bottom: 2px dashed #c9cbe8; }
.tr-series ul { list-style: none; margin: 0; padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 4px; }
.tr-series li { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 10px; font-size: 12px; }
.tr-series li i { width: 30px; height: 30px; }
.tr-series li b { display: block; font-weight: 900; }
.tr-series li small { display: block; font-size: 10.5px; opacity: .7; }
.tr-series li:not(.got) { opacity: .6; }
.tr-series li.got { background: #fffbe6; }
.tr-series li em { font-style: normal; font-size: 11px; font-weight: 900; color: var(--blue); }
.tr-empty { text-align: center; font-weight: 900; opacity: .6; }

/* ------------------------------------------------------------ skill stars (id037) */
.star-row path { fill: #fff; stroke: #b9bbd8; stroke-width: 1.8; stroke-linejoin: round; }
.star-row path.on { fill: var(--yellow); stroke: var(--ink); }
.node.mastered::after { content: none; }
.node .stars { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%); display: block; width: 50px; height: 11px; padding: 1px 3px; border: 1.5px solid var(--ink); border-radius: 999px; background: #fff; line-height: 0; box-sizing: content-box; }
.node .stars .star-row { width: 100%; height: 100%; }
.node .stars.s5 { background: linear-gradient(90deg, #ffe3ef, #fff4c4, #dcfaef, #e3ebff); }
.node.star-up .stars { animation: star-pop .8s cubic-bezier(.3, 1.8, .5, 1) both .3s; }
@keyframes star-pop { 0% { transform: translateX(-50%) scale(.2); } 100% { transform: translateX(-50%) scale(1); } }
.tree { padding-top: 6px; }
.tree-stars { display: flex; align-items: center; justify-content: center; gap: 4px; margin: -2px 0 2px; font-size: 12px; font-weight: 900; }
.tree-stars .star-row { width: 16px; height: 16px; }
.tree-stars b { font-family: var(--chunky); font-weight: 400; font-size: 16px; color: #d99400; }
.skill-news p.star-up { display: flex; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(90deg, #fff6c8, #ffe3ef); }
.skill-news p.star-up .star-row { width: 70px; height: 14px; flex: none; }
.si-card { align-items: center; text-align: center; gap: 10px; }
.si-grade { margin: 0; font-size: 12px; font-weight: 900; opacity: .65; }
.si-title { margin: 0; font-family: var(--chunky); font-weight: 400; font-size: 24px; line-height: 1.2; word-break: keep-all; overflow-wrap: anywhere; }
.si-stars { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; font-weight: 900; font-size: 13px; }
.si-stars .star-row { width: 190px; height: 38px; }
.si-next { width: 100%; padding: 10px 12px; border: 2.5px dashed var(--ink); border-radius: 16px; background: #fff; }
.si-next p { margin: 0; }
.si-label { font-family: var(--chunky); font-size: 15px; color: #d99400; }
.si-text { font-size: 15px; font-weight: 900; line-height: 1.5; word-break: keep-all; overflow-wrap: anywhere; }
.si-text.done { color: var(--pink); }
.si-now { margin-top: 4px !important; font-size: 13px; font-weight: 900; color: var(--blue); }
.si-note { margin: 0; font-size: 12px; font-weight: 900; opacity: .7; }
.sub-btn.si-go { background: var(--blue); color: #fff; text-shadow: 0 2px 0 rgba(27, 29, 77, .45); }

/* ------------------------------------------------------------ compared with before (id038) */
.growth-box { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 0; padding: 8px 10px 10px; border: 2.5px solid var(--ink); border-radius: 16px; background: linear-gradient(160deg, #e3ebff, #dcfaef); }
.growth-box:empty { display: none; }
.gb-head { margin: 0; font-family: var(--chunky); font-weight: 400; font-size: 18px; color: var(--blue); }
.gb-line { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 6px; border-radius: 12px; background: #fff; }
.gb-line > b { font-size: 13px; font-weight: 900; }
.gb-row { display: flex; align-items: flex-end; justify-content: center; gap: 8px; }
.gb-what { font-size: 11px; font-weight: 900; opacity: .7; padding-bottom: 3px; }
.gb-old, .gb-new { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.gb-old small, .gb-new small { font-size: 10px; font-weight: 900; opacity: .6; }
.gb-old { font-size: 14px; font-weight: 900; color: #8a8cb0; }
.gb-arrow { font-weight: 900; color: var(--pink); padding-bottom: 2px; }
.gb-new em { font-style: normal; font-family: var(--chunky); font-size: 22px; color: var(--pink); display: inline-block; }
/* The result screens grew (growth, quests): keep the next actions on screen (id038). */
.result-card .actions { position: sticky; bottom: -20px; z-index: 2; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 10px -20px -20px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 2.5px dashed #c9cbe8; border-radius: 0 0 25px 25px; background: #fff; }
.result-card .actions .big-btn { flex: 1 0 100%; max-width: 360px; height: 62px; }
.result-card .actions .sub-btn { flex: 1 1 auto; min-width: 0; height: 46px; padding: 0 12px; font-size: 15px; }
.result-card .actions .sub-btn[hidden] { display: none; }

/* ------------------------------------------------------------ time capsule (id039) */
.card.capsule { background: #fffaf0; box-shadow: 0 7px 0 var(--ink), 0 0 0 5px #ffb86b; }
.capsule-intro { position: absolute; width: 0; height: 0; }
.ci-env { position: absolute; left: 0; top: 0; width: 230px; transform: translate(-50%, -50%); opacity: 0; filter: drop-shadow(0 6px 0 rgba(27, 29, 77, .85)); }
.ci-env svg { width: 100%; display: block; overflow: visible; }
.env-flap { transform-origin: 110px 40px; transform-box: view-box; }
.ci-letter { position: absolute; left: 50%; top: 50%; width: 190px; padding: 10px 8px 12px; border: 3px solid var(--ink); border-radius: 12px; background: #fff; text-align: center; transform: translate(-50%, -50%) scale(.8); opacity: 0; z-index: 1; }
.ci-letter small { display: block; font-size: 11px; font-weight: 900; color: #e08a2a; letter-spacing: .1em; }
.ci-letter b { display: block; font-family: var(--chunky); font-weight: 400; font-size: 20px; }
.ci-letter span { display: block; font-size: 11px; font-weight: 900; opacity: .7; }
.capsule-result { position: absolute; display: flex; flex-direction: column; align-items: center; padding: 8px 16px 10px; border: 3px solid var(--ink); border-radius: 18px; background: #fffaf0; box-shadow: 0 5px 0 var(--ink), 0 0 0 4px #ffb86b; transform: translate(-50%, 0); opacity: 0; white-space: nowrap; }
.capsule-result small { font-size: 11px; font-weight: 900; color: #e08a2a; letter-spacing: .1em; }
.capsule-result b { font-family: var(--chunky); font-weight: 400; font-size: 20px; }
.capsule-result > span { font-size: 13px; font-weight: 900; }
.cr-row { display: flex; align-items: flex-end; gap: 10px; }
.cr-old, .cr-new { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.cr-old i, .cr-new i { font-style: normal; font-size: 10px; font-weight: 900; opacity: .6; }
.cr-old { font-size: 16px; font-weight: 900; color: #8a8cb0; }
.cr-new { font-family: var(--chunky); font-size: 26px; color: var(--pink); }
.cr-arrow { font-weight: 900; color: #e08a2a; padding-bottom: 4px; }
.skill-news p.capsule-news { background: #fffaf0; box-shadow: inset 0 0 0 2px #ffb86b; }
.skill-news p.capsule-news b { margin-right: 8px; color: #e08a2a; }
.cr-new i, .gb-new small { font-family: var(--round); line-height: 1.3; margin-bottom: 1px; }
.cr-new, .gb-new em { line-height: 1; }
/* id050: review sits right under じぶんレベル. */
.modes > .review-main { min-width: 240px; font-weight: 900; }
.modes > .review-main[hidden] { display: none; }

/* ------------------------------------------------------------ rust (id040) */
.node.rusty { background: linear-gradient(160deg, #fff1cc, #e7c88a); }
.node.rusty::before { content: ""; position: absolute; inset: 3px; border-radius: 11px; pointer-events: none;
  background: radial-gradient(circle at 18% 26%, rgba(168, 98, 40, .45) 0 3px, transparent 3.5px), radial-gradient(circle at 78% 72%, rgba(168, 98, 40, .4) 0 4px, transparent 4.5px), radial-gradient(circle at 64% 20%, rgba(168, 98, 40, .35) 0 2px, transparent 2.5px), radial-gradient(circle at 30% 80%, rgba(168, 98, 40, .3) 0 2.5px, transparent 3px); }
.node .rust { position: absolute; top: -9px; left: -6px; padding: 0 4px; border: 1.5px solid var(--ink); border-radius: 6px; background: #c9772f; color: #fff; font-style: normal; font-size: 9px; line-height: 14px; transform: rotate(-10deg); }
.skill-news p.polish-news { background: linear-gradient(90deg, #fff, #fff6c8, #fff); }

/* ------------------------------------------------------------ collection (id041) */
#screen-collect { flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 0 0; }
.co-preview { position: relative; flex: none; height: min(28vh, 220px); margin: 0 14px 8px; border: 3px solid var(--ink); border-radius: 22px; background: rgba(255, 255, 255, .35); box-shadow: 0 5px 0 var(--ink); overflow: hidden; }
.co-preview .co-mark { left: 50%; top: 50%; right: auto !important; transform-origin: center; translate: -50% -58%; }
.co-now { position: absolute; left: 10px; top: 8px; margin: 0; padding: 2px 10px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 900; }
.co-tabs { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 2px 14px 8px; scrollbar-width: none; }
.co-tabs::-webkit-scrollbar { display: none; }
.co-tabs button { flex: none; display: flex; flex-direction: column; align-items: center; padding: 4px 12px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; font-size: 12px; font-weight: 900; line-height: 1.2; }
.co-tabs button small { font-size: 10px; opacity: .6; }
.co-tabs button[aria-pressed="true"] { background: var(--yellow); box-shadow: 0 3px 0 var(--ink); }
.co-scroll { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 0 14px calc(40px + env(safe-area-inset-bottom)); }
.co-note { margin: 0 0 8px; font-size: 12px; font-weight: 900; opacity: .7; text-align: center; }
.co-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.co-item { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; padding: 8px 4px 8px; border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 3px 0 var(--ink); }
.co-item.on { background: #fff4c4; box-shadow: 0 0 0 4px var(--pink), 0 3px 0 var(--ink); }
.co-item.locked { background: #eceaf3; color: #8a8cb0; border-color: #a9abc9; box-shadow: 0 3px 0 #a9abc9; }
.co-item.locked .co-th { filter: grayscale(1) brightness(.6) contrast(.6); opacity: .45; }
.co-th { display: grid; place-items: center; width: 64px; height: 64px; }
.co-th > svg, .co-th .th-crowd svg { width: 100%; height: 100%; display: block; }
.co-th b { font-family: var(--chunky); font-weight: 400; font-size: 34px; color: var(--pink); }
.co-item.auto .co-th { border: 2.5px dashed var(--ink); border-radius: 50%; width: 56px; height: 56px; margin: 4px; }
.th-bg { display: block; width: 58px; height: 58px; border: 2.5px solid var(--ink); border-radius: 14px; }
.th-music { display: grid; place-items: center; width: 58px; height: 58px; border: 2.5px solid var(--ink); border-radius: 50%; background: #fff; }
.th-music svg { width: 40px; height: 40px; }
.th-crowd { display: flex; width: 70px; height: 64px; align-items: flex-end; }
.th-crowd svg { width: 34% !important; height: auto !important; margin: 0 -2%; }
.co-name { font-size: 12.5px; font-weight: 900; word-break: keep-all; overflow-wrap: anywhere; text-align: center; line-height: 1.25; }
.co-item small { font-size: 9.5px; opacity: .75; text-align: center; line-height: 1.25; word-break: keep-all; overflow-wrap: anywhere; }
.tg-list li.reward { background: linear-gradient(120deg, #fff4c4, #ffe3ef); border-style: dashed; }
.tg-list li.reward i { display: grid; place-items: center; overflow: hidden; }
.tg-list li.reward i > * { max-width: 44px; max-height: 44px; }
.tg-list li.reward .th-bg, .tg-list li.reward .th-music { width: 40px; height: 40px; }
.tr-series li small.rw { color: #d97a00; opacity: 1; }
.finale-rocket { position: absolute; left: 0; top: 0; width: 180px; height: 120px; transform-origin: 90px 60px; filter: drop-shadow(0 6px 0 rgba(27, 29, 77, .8)); }
.finale-rocket svg { width: 100%; height: 100%; }
.finale-banner { position: absolute; left: 0; top: 0; width: 180px; padding: 8px 0; border: 4px solid var(--ink); border-radius: 12px; background: #fff; color: var(--pink); font-family: var(--chunky); font-size: 30px; text-align: center; box-shadow: 0 6px 0 var(--ink); }
/* id045: "もうすぐ" — the closest next steps. */
.tr-soon { display: grid; grid-template-columns: 40px 1fr 56px; align-items: center; gap: 10px; margin-bottom: 8px; padding: 7px 10px 7px 7px; border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 3px 0 var(--ink); }
.tr-pct { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: conic-gradient(var(--pink) calc(var(--p) * 360deg), #eceaf3 0); }
.tr-pct b { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #fff; font-family: var(--chunky); font-weight: 400; font-size: 12px; }
.tr-filter { flex-wrap: wrap; }

/* ------------------------------------------------------------ title guide (id052) */
.help-btn { top: calc(72px + env(safe-area-inset-top)); }
#guide { position: fixed; inset: 0; z-index: 10; touch-action: none; }
#guide[hidden] { display: none; }
.guide-shade, #guide-actor { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#guide-actor { overflow: visible; }
#guide-skip { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 16px; min-width: 90px; min-height: 44px; background: var(--paper); }
#guide-card { position: absolute; left: 50%; transform: translateX(-50%); width: min(360px, calc(100% - 32px)); padding: 16px; border: 3px solid var(--ink); border-radius: 22px 18px 24px 16px; box-shadow: 0 6px 0 var(--ink); background: var(--paper); text-align: center; }
#guide-heading { margin: 0 0 8px; font-size: 20px; line-height: 1.4; }
#guide-text { margin: 0; white-space: pre-line; font-size: 15px; line-height: 1.7; }
#guide-dots { display: flex; justify-content: center; gap: 9px; margin: 14px 0; }
#guide-dots i { width: 10px; height: 10px; border: 2px solid var(--ink); border-radius: 50%; background: #fff; }
#guide-dots .current { background: var(--pink); transform: scale(1.25); }
.guide-actions { display: flex; gap: 12px; }
.guide-actions button { flex: 1; min-width: 0; height: 48px; font-size: 18px; padding: 0 8px; }
#guide-back:disabled { opacity: .4; cursor: default; }
#guide-recommend { position: absolute; padding: 2px 8px; border: 2px solid var(--ink); border-radius: 6px; background: var(--yellow); font-size: 13px; font-weight: 900; transform: rotate(-4deg); }
body.guide-open .logo *, body.guide-open .logo-burst { animation: none !important; }
@media (max-height: 680px) {
  #guide-card { padding: 12px; }
  #guide-heading { font-size: 18px; }
  #guide-text { font-size: 14px; }
  #guide-dots { margin: 12px 0; }
}
/* Keep the real help button clear of Skip when both targets fit. */
#guide.guide-last #guide-skip { left: 16px; right: auto; }
#guide-help-ring { animation: guide-help-pulse 1.4s ease-in-out infinite; }
.guide-help-icon { position: relative; display: inline-grid; place-items: center; vertical-align: middle; width: 32px; height: 32px; padding: 3px; margin: 4px 3px; background: #fff; box-shadow: 0 3px 0 var(--ink); cursor: default; }
.guide-help-icon svg { display: block; width: 100%; height: 100%; }
.guide-help-fallback::after { content: ''; position: absolute; inset: -5px; border: 2px solid var(--yellow); border-radius: 14px; animation: guide-help-pulse 1.4s ease-in-out infinite; }
@keyframes guide-help-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
body.reduced #guide-help-ring, body.reduced .guide-help-fallback::after { animation: none; }

/* ---------------------------------------------------------------- ドパにゃん！ 漢字編 */
.logo-ribbon { font-size: calc(var(--fs) * 0.46); }
.logo-ribbon i:nth-child(5) { animation-delay: -.75s; }
.logo-kanji { margin-top: calc(var(--fs) * 0.08); padding: .08em .6em .12em; font-family: var(--kyoka); font-weight: 600; font-size: calc(var(--fs) * 0.3); color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 10px; transform: rotate(2deg); box-shadow: 0 4px 0 var(--ink); letter-spacing: .12em; }
.credit { margin: 4px 12px 0; font-size: 10px; line-height: 1.5; opacity: .5; text-align: center; }
.mode-row { flex-wrap: wrap; }
.zukan-btn { background: #fff4c7; }

/* word + furigana cells */
.sheet.kanji { font-family: var(--round); }
.cell.kanji { font-family: var(--kyoka); font-weight: 600; font-size: calc(var(--ch) * 1.55); line-height: 1; color: var(--ink); align-self: center; }
.cell.kanji.kana { font-family: var(--round); font-weight: 700; font-size: calc(var(--ch) * 1.05); color: #4a4f86; }
.cell.kanji.ul { background: linear-gradient(transparent 88%, var(--pink) 88%, var(--pink) 96%, transparent 96%); }
.cell.kanji.target { color: #1b1d4d; }
.sheet.kanji .cell.input { font-size: calc(var(--ch) * .74); margin: 2px 1px; border-radius: 9px; background: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 2px rgba(27, 29, 77, .18); }
.sheet.kanji .cell.input.ok { background: transparent; box-shadow: none; }
.cell.input.shown { color: var(--pink); background: #ffe8f3; box-shadow: inset 0 0 0 2px var(--pink); }
.yomi-tag { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 11px; vertical-align: 2px; }
.card.revenge { outline: 4px dashed #23242f; outline-offset: -8px; }
.card.revenge .qno { color: #e0453a; }

/* pass button */
.card-top { gap: 8px; }
.card-top .qno { margin-left: auto; }
.pass-btn { font: inherit; font-family: var(--round); font-weight: 900; font-size: 14px; padding: 5px 14px; border-radius: 999px; border: 2.5px solid var(--ink); background: #23242f; color: #fff; box-shadow: 0 3px 0 var(--ink); cursor: pointer; touch-action: manipulation; }
.pass-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.pass-btn:disabled { opacity: .45; }
.pass-btn[hidden] { display: none; }
.tally .pn b { color: #23242f; }

/* kana pad */
.kana-pad button { font-family: var(--round); font-weight: 900; font-size: 26px; }
.kana-pad button:disabled { visibility: hidden; }
.kana-pad button.dim { opacity: .28; pointer-events: none; }
.kana-pad button.hint-glow, .kana-pad button.trace { background: #fff3b8; box-shadow: 0 5px 0 var(--ink), 0 0 0 4px var(--yellow); animation: hint-glow .9s ease-in-out infinite; }
body.reduced .kana-pad button.hint-glow, body.reduced .kana-pad button.trace { animation: none; }

/* result: passed words */
.passed-box { margin: 6px 0; padding: 8px 12px; border-radius: 14px; background: #f1f0ff; border: 2px dashed #23242f; text-align: left; }
.passed-box .pl-head { margin: 0 0 4px; font-weight: 900; font-size: 13px; }
.passed-box .pl-head small { font-weight: 700; opacity: .7; margin-left: 6px; }
.passed-box ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 12px; }
.passed-box li b { font-family: var(--kyoka); font-weight: 600; font-size: 18px; margin-right: 4px; }
.passed-box li span { font-size: 12px; color: #e0453a; }

/* zukan */
.zk-tabs { flex-wrap: wrap; justify-content: center; }
.zk-tabs button small { display: block; font-size: 10px; opacity: .7; }
.zk-detail { display: flex; gap: 12px; align-items: flex-start; margin: 6px 14px; padding: 10px 12px; min-height: 92px; border-radius: 16px; background: #fff; border: 2.5px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
.zk-empty { margin: auto; font-size: 13px; opacity: .6; }
.zk-big { flex: none; width: 74px; height: 74px; display: grid; place-items: center; font-family: var(--kyoka); font-weight: 600; font-size: 58px; line-height: 1; border-radius: 12px; background: #fff8ec; border: 2px solid var(--ink); }
.zk-info { flex: 1; min-width: 0; font-size: 13px; }
.zk-info p { margin: 0 0 4px; font-weight: 900; }
.zk-info p small { font-weight: 700; opacity: .7; }
.zk-info ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.zk-info li { opacity: .55; }
.zk-info li.ok { opacity: 1; }
.zk-info li span { margin-left: 4px; font-family: var(--kyoka); font-weight: 600; font-size: 12px; opacity: .8; }
.zk-scroll { padding-bottom: 24px; }
.zk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; padding: 4px 14px 20px; }
.zk-k { aspect-ratio: 1; font-family: var(--kyoka); font-weight: 600; font-size: 26px; border-radius: 10px; border: 2px solid rgba(27, 29, 77, .25); background: rgba(255, 255, 255, .55); color: rgba(27, 29, 77, .35); cursor: pointer; padding: 0; }
.zk-k.got { color: var(--ink); background: #fff; border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
#screen-zukan { flex-direction: column; padding: calc(10px + env(safe-area-inset-top)) 0 0; }
.zk-scroll { padding-left: 0; padding-right: 0; }

/* ---------------------------------------------------------------- 脳汁タイピング */
.logo-nou { font-family: var(--chunky); font-weight: 400; font-size: calc(var(--fs) * 0.36); background: #ff4f6d; color: #fff; letter-spacing: .04em; padding: .18em .5em .1em; text-shadow: 2px 2px 0 var(--ink); }
.logo-nou ruby rt { font-family: var(--round); font-weight: 900; font-size: .32em; color: #fff; letter-spacing: .2em; }
.logo-catch { margin-top: 6px; font-family: var(--round); font-weight: 900; font-size: calc(var(--fs) * 0.17); color: var(--ink); transform: rotate(-2deg); }
.mode-chip { align-self: center; font: inherit; font-family: var(--round); font-weight: 900; font-size: 14px; padding: 6px 16px; border-radius: 999px; border: 2.5px solid var(--ink); background: #fff; box-shadow: 0 3px 0 var(--ink); cursor: pointer; }
.grades button small { display: block; font-size: 10px; opacity: .7; }
.grades button { font-size: 15px; }
.pass-btn { display: none !important; }
.tally .kps b { color: #ff4f6d; }

/* problem card */
.sheet.type { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 0 8px; font-family: var(--round); text-align: center; }
.tp-text { font-weight: 900; font-size: clamp(20px, 6.2vw, 30px); line-height: 1.35; color: var(--ink); word-break: keep-all; overflow-wrap: anywhere; }
.tp-text.solo { display: none; }
.tp-yomi { font-weight: 900; font-size: clamp(16px, 4.6vw, 22px); line-height: 1.5; color: #9a9cc4; letter-spacing: .02em; word-break: break-all; }
.tp-yomi.solo { font-size: clamp(26px, 8vw, 40px); }
.tp-yomi span { display: inline-block; transition: color .08s; }
.tp-yomi span.ok { color: #ff4f6d; }
.tp-yomi span.now { color: var(--ink); border-bottom: 3px solid var(--blue); }
.tp-yomi span.half { color: #3b6bff; }
.tp-roma { font-family: "Dela Gothic One", var(--round); font-size: clamp(14px, 4vw, 19px); letter-spacing: .06em; color: #b9bbd8; word-break: break-all; min-height: 1.3em; }
.tp-roma .d { color: #ff4f6d; }
.tp-roma .n { color: #fff; background: var(--blue); border-radius: 5px; padding: 0 3px; }
.tp-roma.blind .n { background: none; color: transparent; }
.sheet-wrap { min-height: 150px; }

/* keyboards */
.pad.tpad { display: block; padding: 0 6px; position: relative; }
.pad.tpad .kr { display: flex; gap: 4px; justify-content: center; margin-bottom: 5px; }
.pad.tpad .kr.r1 { padding-left: 3%; }
.pad.tpad .kr.r2 { padding-left: 8%; padding-right: 8%; }
.pad.tpad.roma .tk { flex: 1 1 0; min-width: 0; height: 52px; padding: 0; font-family: "Dela Gothic One", var(--round); font-size: 18px; border-radius: 9px; }
.tk.home::after { content: ""; position: absolute; left: 35%; right: 35%; bottom: 7px; height: 3px; border-radius: 2px; background: currentColor; opacity: .5; }
.tk { position: relative; }
.tk.f1, .tk.f8 { background: #ffe0ec; } .tk.f2, .tk.f7 { background: #fff1c2; } .tk.f3, .tk.f6 { background: #dff7ea; } .tk.f4, .tk.f5 { background: #e2ebff; }
.tk.next { background: var(--yellow) !important; box-shadow: 0 5px 0 var(--ink), 0 0 0 4px #fff, 0 0 18px 6px rgba(255, 122, 182, .9) !important; transform: translateY(-2px); z-index: 2; }
.tk.alt { outline: 3px dashed var(--pink); outline-offset: -4px; }
.pad.tpad.flick { display: grid; grid-template-columns: repeat(3, 1fr) .8fr; gap: 6px; padding: 0 10px; }
.pad.tpad.flick .tk { height: 58px; font-family: var(--round); font-weight: 900; font-size: 24px; border-radius: 12px; background: #fff; touch-action: none; }
.pad.tpad.flick .tk.fn { font-size: 15px; background: #e8e9f5; }
.pad.tpad.flick .tk[data-k=""] { visibility: hidden; }
.fl-dir { position: absolute; top: -14px; right: -6px; font-style: normal; font-size: 16px; line-height: 1; padding: 3px 6px; border-radius: 999px; background: #ff4f6d; color: #fff; border: 2px solid var(--ink); }
.fl-pop { position: absolute; transform: translate(-50%, -100%); min-width: 56px; padding: 6px 10px; border-radius: 14px; background: var(--ink); color: #fff; font-family: var(--round); font-weight: 900; font-size: 30px; text-align: center; pointer-events: none; z-index: 5; }
@media (max-height: 700px) { .pad.tpad.roma .tk { height: 46px; } .pad.tpad.flick .tk { height: 50px; } }

/* rank box on the result */
.rank-box { margin: 6px 0; padding: 10px 12px; border-radius: 18px; background: linear-gradient(135deg, #fff1c2, #ffe0ec); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
.rk-name { margin: 0; display: flex; flex-direction: column; align-items: center; }
.rk-name small { font-size: 12px; opacity: .7; }
.rk-name b { display: inline-block; font-family: var(--chunky); font-weight: 400; font-size: 38px; color: #ff4f6d; text-shadow: 2px 2px 0 var(--ink); }
.rk-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 6px 0; }
.rk-nums span { display: flex; flex-direction: column; align-items: center; }
.rk-nums small { font-size: 10px; opacity: .7; }
.rk-nums b { font-family: var(--chunky); font-weight: 400; font-size: 20px; }
.rk-weak { margin: 0 0 6px; font-size: 12px; }
.rk-weak b { color: #7a4bff; font-size: 16px; letter-spacing: .2em; }
.share-btn { width: 100%; }
.ipick { display: flex; gap: 8px; } .ipick button { flex: 1; font: inherit; font-family: var(--round); font-weight: 900; font-size: 14px; padding: 10px; border-radius: 12px; border: 2.5px solid var(--ink); background: #fff; box-shadow: 0 3px 0 var(--ink); } .ipick button[aria-pressed="true"] { background: var(--yellow); }

/* rotate notice (phones in landscape) */
.rotate { display: none; position: fixed; inset: 0; z-index: 999; background: var(--paper); place-items: center; text-align: center; font-family: var(--round); font-weight: 900; font-size: 22px; color: var(--ink); }
.rot-cat { font-size: 56px; margin: 0; animation: rot-wiggle 1.2s ease-in-out infinite; }
@keyframes rot-wiggle { 50% { transform: rotate(-90deg); } }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) { .rotate { display: grid; } }
/* FEVER */
body.fever .card { box-shadow: 0 0 0 5px #fff, 0 0 0 10px #ff4f6d, 0 0 40px 12px rgba(255, 122, 182, .9); animation: fever-card .5s linear infinite; }
body.fever .pad.tpad .tk { animation: fever-key 1s linear infinite; }
body.fever #combo-box { background: linear-gradient(90deg, #ff4f6d, #ffd23f, #3fdcb0, #3b6bff, #a77bff); color: #fff; }
@keyframes fever-card { 50% { box-shadow: 0 0 0 5px #fff, 0 0 0 10px #3b6bff, 0 0 48px 16px rgba(255, 210, 63, .95); } }
@keyframes fever-key { to { filter: hue-rotate(360deg); } }
body.reduced.fever .card, body.reduced.fever .pad.tpad .tk { animation: none; }

/* ---------------------------------------------------------------- cute cat logo */
.logo-cat { --fs: clamp(58px, 18vw, 88px); margin-top: calc(var(--fs) * 0.35); padding: calc(var(--fs) * .22) calc(var(--fs) * .3) calc(var(--fs) * .18); }
.logo-cat .logo-burst { display: none; }
.lc-cloud { position: absolute; inset: 0 -4% -4%; width: 108%; height: 104%; z-index: -1; filter: drop-shadow(0 6px 0 rgba(27, 29, 77, .85)); animation: lc-breathe 3.2s ease-in-out infinite; }
@keyframes lc-breathe { 50% { transform: scale(1.025, .985); } }
.lc-top { display: flex; align-items: flex-end; font-family: var(--chunky); font-size: var(--fs); line-height: 1; letter-spacing: -.02em; }
.lc-top i { font-style: normal; position: relative; display: inline-block; color: #ff7ab6; text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 0 7px 0 var(--ink); animation: lc-bounce 1.8s ease-in-out infinite; }
.lc-top i:nth-child(2) { color: #8fe3c4; animation-delay: -.2s; } .lc-top i:nth-child(3) { color: #ffd23f; animation-delay: -.4s; font-size: .82em; }
.lc-top i:nth-child(4) { color: #b8a6ff; animation-delay: -.6s; font-size: .6em; } .lc-top i:nth-child(5) { color: #8fd3ff; animation-delay: -.8s; font-size: .82em; }
.lc-top i.ear::before, .lc-top i.ear::after { content: ""; position: absolute; top: -.2em; width: .26em; height: .3em; background: inherit; background: currentColor; border: 3px solid var(--ink); border-bottom: none; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.lc-top i.ear::before { left: .08em; transform: rotate(-12deg); } .lc-top i.ear::after { right: .08em; transform: rotate(12deg); }
.lc-top i.ear::before, .lc-top i.ear::after { border: none; filter: drop-shadow(0 -2px 0 var(--ink)) drop-shadow(2px 0 0 var(--ink)) drop-shadow(-2px 0 0 var(--ink)); }
.lc-top i.paw-bang { width: .36em; height: .9em; margin-left: .04em; text-shadow: none; }
.lc-top i.paw-bang svg { width: 100%; height: 100%; }
@keyframes lc-bounce { 50% { transform: translateY(-6%) rotate(-3deg); } }
.lc-drop { position: relative; margin-top: calc(var(--fs) * .12); padding: .12em .5em .06em; font-family: var(--chunky); font-size: calc(var(--fs) * .42); color: #fff; background: radial-gradient(circle at 30% 30%, #ffb3d6, #ff4f9a 60%, #c93a86); border: 4px solid var(--ink); border-radius: 50% 50% 46% 46% / 62% 62% 40% 40%; box-shadow: 0 5px 0 var(--ink), inset 6px 6px 0 rgba(255, 255, 255, .35); text-shadow: 2px 2px 0 var(--ink); animation: lc-drip 2.4s ease-in-out infinite; }
.lc-drop::after { content: ""; position: absolute; left: 50%; bottom: -.34em; width: .28em; height: .36em; transform: translateX(-50%); background: #ff4f9a; border: 4px solid var(--ink); border-top: none; border-radius: 0 0 50% 50%; }
.lc-drop ruby rt { font-family: var(--round); font-weight: 900; font-size: .3em; letter-spacing: .25em; color: var(--ink); text-shadow: none; }
@keyframes lc-drip { 50% { transform: scale(1.05, .96) translateY(3%); } }
.lc-sub { margin-top: calc(var(--fs) * .14); font-family: var(--chunky); font-size: calc(var(--fs) * .38); color: #fff; letter-spacing: .06em; text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 0 5px 0 var(--ink); background: linear-gradient(90deg, #ff9ccc, #ffd23f, #8fe3c4, #8fd3ff, #b8a6ff); -webkit-background-clip: text; background-clip: text; }
.lc-sub { color: #8fd3ff; }
.lc-peek { position: absolute; width: calc(var(--fs) * 1.05); top: calc(var(--fs) * -.42); z-index: -1; animation: lc-peek 3.6s ease-in-out infinite; }
.lc-gin { left: -2%; transform: rotate(-16deg); } .lc-sumi { right: -2%; transform: rotate(14deg); animation-delay: -1.8s; }
@keyframes lc-peek { 0%, 70%, 100% { translate: 0 0; } 80% { translate: 0 -12%; } }
.lc-bits b { width: calc(var(--fs) * .42); height: calc(var(--fs) * .42); background-size: contain; background-repeat: no-repeat; text-shadow: none; }
.bit-paw { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-14 -14 28 28'%3E%3Cg fill='%23ff9ccc' stroke='%231b1d4d' stroke-width='2'%3E%3Cellipse cx='0' cy='4' rx='7' ry='6'/%3E%3Ccircle cx='-8' cy='-3' r='3.2'/%3E%3Ccircle cx='-3' cy='-8' r='3.2'/%3E%3Ccircle cx='3' cy='-8' r='3.2'/%3E%3Ccircle cx='8' cy='-3' r='3.2'/%3E%3C/g%3E%3C/svg%3E"); }
.bit-fish { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-15 -10 30 20'%3E%3Cg fill='%23c9d3e6' stroke='%231b1d4d' stroke-width='2' stroke-linejoin='round'%3E%3Cellipse cx='-2' cy='0' rx='10' ry='5'/%3E%3Cpath d='M7 0 L13 -5 L13 5Z'/%3E%3C/g%3E%3Ccircle cx='-7' cy='-1' r='1.4' fill='%231b1d4d'/%3E%3C/svg%3E"); }
.bit-yarn { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-14 -14 30 30'%3E%3Ccircle r='10' fill='%23b8a6ff' stroke='%231b1d4d' stroke-width='2'/%3E%3Cg fill='none' stroke='%231b1d4d' stroke-width='1.4'%3E%3Cpath d='M-8 -4 Q0 -10 8 -2'/%3E%3Cpath d='M-9 3 Q0 -3 9 5'/%3E%3Cpath d='M9 5 Q15 9 13 14'/%3E%3C/g%3E%3C/svg%3E"); }
.bit-neko { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-14 -16 28 28'%3E%3Cpath d='M-10 -2 L-9 -13 L-3 -8 L3 -8 L9 -13 L10 -2 A10.5 9 0 0 1 -10 -2Z' fill='%23ffd23f' stroke='%231b1d4d' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='-4' cy='0' r='1.7' fill='%231b1d4d'/%3E%3Ccircle cx='4' cy='0' r='1.7' fill='%231b1d4d'/%3E%3C/svg%3E"); }
.logo-cat .logo-catch { margin-top: calc(var(--fs) * .12); }

/* quit + secret */
.quit-btn { font: inherit; font-family: var(--round); font-weight: 900; font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 2.5px solid var(--ink); background: #fff; box-shadow: 0 2px 0 var(--ink); cursor: pointer; }
.chihaya { font: inherit; padding: 0 2px; border: none; background: none; color: inherit; text-decoration: underline dotted; cursor: pointer; }
.secret-card { text-align: center; background: linear-gradient(135deg, #fff4fa, #eef9ff); }
.secret-title { font-family: var(--chunky); font-size: 20px; margin: 0 0 8px; }
.secret-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.secret-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; }
.secret-dots i.on { background: #ff7ab6; }
.secret-pad { display: flex; justify-content: space-around; align-items: center; margin-bottom: 12px; }
.dpad { display: grid; grid-template: 44px 44px 44px / 44px 44px 44px; }
.dpad .up { grid-area: 1 / 2; } .dpad .left { grid-area: 2 / 1; } .dpad .right { grid-area: 2 / 3; } .dpad .down { grid-area: 3 / 2; }
.dpad button, .ab button { font: inherit; font-weight: 900; font-size: 18px; border: 2.5px solid var(--ink); border-radius: 10px; background: #fff; box-shadow: 0 3px 0 var(--ink); touch-action: manipulation; }
.ab { display: flex; gap: 10px; } .ab button { width: 54px; height: 54px; border-radius: 50%; background: #ffd23f; font-family: var(--chunky); font-size: 22px; }
.logo-cat { --fs: clamp(48px, 14.5vw, 78px); }
.lc-peek { width: calc(var(--fs) * .85); top: 34%; }
.lc-gin { left: -13%; } .lc-sumi { right: -13%; }
.lc-top i.paw-bang { flex: none; }

/* ---- fixes: buttons never wrap vertically, text never leaves the screen */
button, .quit-btn, .big-btn, .sub-btn, .icon-btn, .mode-chip { white-space: nowrap; }
.quit-btn, .icon-btn, #mute { flex: none; }
.cutin-band .band-text { max-width: 100vw; }

/* ================= layout fixes (PC + phone) ================= */
.hud { gap: 6px; min-width: 0; }
.hud .pips { flex: 1 1 0; min-width: 0; overflow: hidden; }
.hud .clock { flex: none; }
.demo-tag { flex: none; }
.step-label { white-space: normal; overflow-wrap: anywhere; padding: 0 10px; line-height: 1.35; font-size: clamp(11px, 3.4vw, 14px); }
.guide-actions button { white-space: nowrap; min-width: 84px; }
.co-tabs { flex-wrap: wrap; justify-content: center; overflow: visible; padding: 2px 10px 8px; }
.co-tabs button { padding: 3px 10px; }
.co-lock { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }

/* ---- logo (re-laid out so nothing is clipped and the catch-phrase is readable) ---- */
.logo-cat { --fs: clamp(44px, 13vw, 70px); width: min(100%, 420px); display: flex; flex-direction: column; align-items: center; margin-top: calc(var(--fs) * .3); padding: calc(var(--fs) * .5) calc(var(--fs) * .3) calc(var(--fs) * .62); box-sizing: border-box; }
.lc-cloud { inset: 0; width: 100%; height: 100%; }
.lc-peek { width: calc(var(--fs) * .8); top: calc(var(--fs) * -.42); z-index: 0; }
.lc-gin { left: 3%; } .lc-sumi { right: 3%; }
.lc-cloud { z-index: 1; }
.lc-top, .lc-drop, .lc-sub, .logo-cat .logo-catch, .lc-bits { position: relative; z-index: 2; }
.lc-drop { font-size: calc(var(--fs) * .66); margin-top: calc(var(--fs) * .1); padding: .1em .55em .04em; }
.lc-drop ruby rt { font-size: .26em; }
.lc-sub { font-size: calc(var(--fs) * .4); margin-top: calc(var(--fs) * .2); }
.logo-cat .logo-catch { margin-top: calc(var(--fs) * .2); padding: .12em .9em .16em; font-size: calc(var(--fs) * .3); background: #ffd23f; color: var(--ink); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 3px 0 var(--ink); transform: rotate(-2deg); white-space: nowrap; }
.lc-bits { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.logo-cat.wiggle { animation: logo-wiggle .6s ease; }
@keyframes logo-wiggle { 20% { transform: rotate(-3deg) scale(1.03); } 50% { transform: rotate(3deg) scale(1.05); } 80% { transform: rotate(-1.5deg); } }
.lc-peek { pointer-events: auto; cursor: pointer; }
.lc-peek.pop { animation: lc-pop .55s ease; }
@keyframes lc-pop { 40% { translate: 0 -30%; scale: 1.15; } }

/* ---- ちはや: an obviously tappable rainbow pill ---- */
.credit { opacity: .85; font-size: 11px; line-height: 2.2; }
.chihaya { display: inline-flex; align-items: center; gap: .25em; min-height: 32px; padding: 2px 14px; border: 2.5px solid var(--ink); border-radius: 999px; font: inherit; font-weight: 900; font-size: 14px; color: var(--ink); text-decoration: none; background: linear-gradient(90deg, #ff9ccc, #ffd23f, #8fe3c4, #8fd3ff, #b8a6ff, #ff9ccc); background-size: 200% 100%; box-shadow: 0 3px 0 var(--ink); cursor: pointer; animation: chi-slide 3s linear infinite, chi-pulse 1.8s ease-in-out infinite; }
@keyframes chi-slide { to { background-position: 200% 0; } }
@keyframes chi-pulse { 50% { transform: scale(1.08) rotate(-2deg); } }
body.reduced .chihaya { animation: none; }

/* ---- urawaza banner ---- */
.urawaza { position: fixed; left: 50%; top: 38%; z-index: 60; transform: translate(-50%, -50%); max-width: 90vw; padding: 14px 26px; text-align: center; border: 4px solid var(--ink); border-radius: 28px; background: linear-gradient(90deg, #ff9ccc, #ffd23f, #8fe3c4, #8fd3ff, #b8a6ff); box-shadow: 0 8px 0 var(--ink); pointer-events: none; animation: ura-pop 3s ease forwards; }
.urawaza b { display: block; font-family: var(--chunky); font-weight: 400; font-size: clamp(22px, 7vw, 34px); color: #fff; text-shadow: 2px 2px 0 var(--ink); white-space: nowrap; }
.urawaza small { font-weight: 900; font-size: clamp(12px, 3.8vw, 16px); color: var(--ink); }
.urawaza[hidden] { display: none; }
@keyframes ura-pop { 0% { transform: translate(-50%, -50%) scale(.3) rotate(-8deg); opacity: 0; } 12% { transform: translate(-50%, -50%) scale(1.12) rotate(2deg); opacity: 1; } 22% { transform: translate(-50%, -50%) scale(1); } 85% { opacity: 1; } 100% { transform: translate(-50%, -60%) scale(1); opacity: 0; } }
.ura-chip { align-self: center; padding: 2px 12px; border-radius: 999px; background: #1b1d4d; color: #ffd23f; font-weight: 900; font-size: 12px; }

/* ---- jarashi toy on the title ---- */
.jarashi { position: fixed; left: 0; top: 0; z-index: 8; display: none; pointer-events: none; transform-origin: 50% 100%; will-change: transform; }
body.on-title .jarashi { display: block; }

/* ---- narrow phones: the play HUD must fit on one row (also with DEMO on) ---- */
@media (max-width: 380px) {
  .hud { padding: 0 8px; gap: 4px; }
  .hud .clock #clock-label { display: none; }
  .demo-tag { padding: 2px 7px; font-size: 11px; }
  .quit-btn { padding: 4px 8px; font-size: 11px; }
  .tree-lanes span { font-size: 10px; }
  .node { font-size: 10px; padding: 3px 2px; }
}
[hidden] { display: none !important; }

/* ---- collection cards: long names/conditions never overflow ---- */
.co-item { overflow: hidden; }
.co-name { max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.co-item small, .co-lock { max-width: 100%; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: normal; overflow-wrap: anywhere; }
.co-item .co-th { max-width: 100%; }
#co-preview { cursor: pointer; touch-action: manipulation; }
#co-now { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================= share modal ================= */
.share { z-index: 40; align-items: center; }
.share-card { position: relative; width: min(440px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(160deg, #fff4fa, #eef9ff 60%, #fff8df); text-align: center; }
.share-x { position: absolute; right: 10px; top: 10px; width: 40px; height: 40px; z-index: 2; }
.share-title { margin: 2px 40px 8px; font-family: var(--chunky); font-weight: 400; font-size: 24px; color: #ff4f9a; text-shadow: 2px 2px 0 var(--ink); }
.share-preview { position: relative; width: 100%; border-radius: 20px; overflow: hidden; border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink); background: #fff repeating-conic-gradient(#ffe3f1 0 25%, #fff4cf 0 50%) 0 0 / 40px 40px; min-height: 160px; }
.share-preview img { display: block; width: 100%; height: auto; max-height: 52dvh; object-fit: contain; margin: 0 auto; transition: opacity .3s; -webkit-touch-callout: default; user-select: auto; }
.share-load { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-weight: 900; color: var(--ink); animation: pulse-t 1s ease-in-out infinite; }
@keyframes pulse-t { 50% { opacity: .4; } }
.share-fmt { display: flex; gap: 8px; justify-content: center; margin: 10px 0 8px; }
.share-fmt button { flex: 1; max-width: 140px; min-height: 36px; font: inherit; font-weight: 900; font-size: 13px; border-radius: 999px; border: 2.5px solid var(--ink); background: #fff; box-shadow: 0 2px 0 var(--ink); }
.share-fmt button[aria-pressed="true"] { background: var(--yellow); }
.share-main { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; margin-bottom: 8px; }
.share-main button { min-height: 50px; font: inherit; font-weight: 900; font-size: 14px; border-radius: 16px; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
.sh-save { background: linear-gradient(180deg, #ffe680, #ffd23f); } .sh-copy { background: #fff; }
.share-main button:active, .sns:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.share-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sns { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 52px; padding: 4px 6px; font: inherit; border-radius: 14px; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); color: #fff; line-height: 1.2; }
.sns b { font-family: var(--chunky); font-weight: 400; font-size: 17px; letter-spacing: .02em; }
.sns span { font-weight: 900; font-size: 10.5px; opacity: .95; }
.sns-x { background: #111; } .sns-line { background: #06c755; } .sns-fb { background: #1877f2; } .sns-bsky { background: #0a84ff; } .sns-threads { background: #333; }
.sns-insta { background: linear-gradient(45deg, #f9a03f, #f4356a 45%, #b12fbf 75%, #5a5df0); } .sns-more { background: #7a4bff; } .sns-url { background: #fff; color: var(--ink); }
.share-note { min-height: 2.6em; margin: 8px 4px 2px; font-size: 12px; font-weight: 900; color: #7a4bff; line-height: 1.4; }
.share-credit { margin: 0; font-size: 12px; font-weight: 900; }
.share-credit a, .xlink { color: var(--ink); text-decoration: none; padding: 1px 8px; border-radius: 999px; background: #111; color: #fff; font-size: 11px; margin-left: 4px; white-space: nowrap; }
.xlink { display: inline-block; line-height: 1.7; }
@media (min-width: 700px) { .share-card { width: 760px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; text-align: center; align-content: start; } .share-title, .share-preview, .share-fmt { grid-column: 1; } .share-main, .share-grid, .share-note, .share-credit { grid-column: 2; } .share-preview { grid-row: 2 / span 3; align-self: start; } .share-title { grid-row: 1; } .share-main { grid-row: 2; margin-top: 0; } .share-grid { grid-row: 3; } .share-note { grid-row: 4; } .share-credit { grid-row: 5; } .share-fmt { grid-row: 5; margin: 0; } }

/* ================= マタタビモード ================= */
.mata { position: absolute; left: 50%; top: 96px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 10px; border: 3px solid var(--ink); border-radius: 999px; background: linear-gradient(90deg, #c8f5b8, #fff6a8, #ffc7e6, #c9d6ff); box-shadow: 0 3px 0 var(--ink); font-weight: 900; font-size: 12px; white-space: nowrap; animation: mata-chip 1s ease-in-out infinite; }
.mata[hidden] { display: none; }
.mata i { display: block; width: 84px; height: 10px; border-radius: 6px; border: 2px solid var(--ink); background: #fff; overflow: hidden; }
.mata b { display: block; height: 100%; transform-origin: 0 50%; background: linear-gradient(90deg, #3fdcb0, #ffd23f, #ff7ab6); }
@keyframes mata-chip { 50% { transform: translateX(-50%) rotate(-2deg) scale(1.05); } }
body.matatabi #bg { animation: mata-hue 6s linear infinite, mata-zoom 1.8s ease-in-out infinite; filter: saturate(1.5); }
body.matatabi .card { animation: mata-sway 1.7s ease-in-out infinite; box-shadow: 0 0 0 5px #fff, 0 0 0 10px #8fe3c4, 0 0 40px 12px rgba(143, 227, 196, .9); }
body.matatabi .tp-yomi span:nth-child(odd) { animation: mata-bob 1.1s ease-in-out infinite; }
body.matatabi .tp-yomi span:nth-child(even) { animation: mata-bob 1.1s ease-in-out infinite reverse; }
body.matatabi .pad.tpad .tk { animation: mata-key 1.3s ease-in-out infinite, fever-key 2s linear infinite; }
body.matatabi .pad.tpad .kr.r1 .tk { animation-delay: -.3s; } body.matatabi .pad.tpad .kr.r2 .tk { animation-delay: -.6s; }
@keyframes mata-hue { to { filter: saturate(1.5) hue-rotate(360deg); } }
@keyframes mata-zoom { 50% { transform: scale(1.04); } }
@keyframes mata-sway { 0%, 100% { transform: rotate(-1.1deg) translateY(0); } 50% { transform: rotate(1.1deg) translateY(-3px); } }
@keyframes mata-bob { 50% { transform: translateY(-3px) rotate(2deg); } }
@keyframes mata-key { 50% { transform: rotate(-2.5deg) translateY(-2px); } }
body.reduced .mata, body.reduced.matatabi #bg, body.reduced.matatabi .card, body.reduced.matatabi .tp-yomi span, body.reduced.matatabi .pad.tpad .tk { animation: none; }

/* ================= polish: splash, iris wipe, parallax, button juice ================= */
#splash { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: radial-gradient(circle at 50% 40%, #fff4fa, #ffe3f1 45%, #ffd8ec); transition: opacity .6s ease, transform .6s ease; pointer-events: none; }
#splash.done { opacity: 0; transform: scale(1.06); }
.sp-cats { display: flex; gap: 6px; animation: sp-bounce 1s ease-in-out infinite; } .sp-cats img { width: 30vw; max-width: 130px; }
.sp-cats img:last-child { animation: sp-bounce 1s ease-in-out infinite reverse; }
.sp-logo { margin: 8px 0 0; font-family: var(--chunky); font-size: clamp(34px, 11vw, 54px); color: #ff7ab6; text-shadow: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink), 0 6px 0 var(--ink); }
.sp-sub { margin: 0; font-family: var(--chunky); font-size: clamp(18px, 6vw, 28px); color: #8fd3ff; text-shadow: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink); }
.sp-load { margin: 14px 0 0; display: flex; gap: 8px; } .sp-load i { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); animation: sp-dot 0.9s ease-in-out infinite; } .sp-load i:nth-child(2) { animation-delay: .15s; background: #ff7ab6; } .sp-load i:nth-child(3) { animation-delay: .3s; background: #ffd23f; }
@keyframes sp-bounce { 50% { transform: translateY(-14px) rotate(-3deg); } } @keyframes sp-dot { 50% { transform: translateY(-9px); } }

#wipe { position: fixed; inset: 0; z-index: 900; pointer-events: none; display: none; }
#wipe.go { display: block; animation: wipe-iris .6s cubic-bezier(.6, 0, .2, 1) forwards; background: conic-gradient(from 0deg, #ff9ccc, #ffd23f, #8fe3c4, #8fd3ff, #b8a6ff, #ff9ccc); }
#wipe i { position: absolute; left: 50%; top: 50%; width: 22vmin; height: 22vmin; transform: translate(-50%, -50%); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-14 -14 28 28'%3E%3Cg fill='%23fff' stroke='%231b1d4d' stroke-width='1.6'%3E%3Cellipse cx='0' cy='4' rx='7' ry='6'/%3E%3Ccircle cx='-8' cy='-3' r='3.2'/%3E%3Ccircle cx='-3' cy='-8' r='3.2'/%3E%3Ccircle cx='3' cy='-8' r='3.2'/%3E%3Ccircle cx='8' cy='-3' r='3.2'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; }
@keyframes wipe-iris { 0% { clip-path: circle(150% at 50% 50%); } 100% { clip-path: circle(0% at 50% 50%); } }

#screen-title .logo { transform: translate(calc(var(--px, 0) * -10px), calc(var(--py, 0) * -6px)); transition: transform .25s ease-out; }
@media (hover: hover) {
  .big-btn, .sub-btn, .co-item, .node:not(.locked), .tk { transition: transform .12s ease, box-shadow .12s ease, filter .12s ease; }
  .big-btn:hover, .sub-btn:hover { transform: translateY(-2px) rotate(-.6deg); filter: brightness(1.04); }
  .co-item:hover, .node:not(.locked):hover { transform: translateY(-3px); }
  .tk:hover { filter: brightness(1.06); }
}
.big-btn:active, .sub-btn:active { transform: translateY(3px) scale(.985) !important; }
.rk-name b { display: inline-block; }
body.reduced #wipe, body.reduced #splash { display: none; }
@media (prefers-reduced-motion: reduce) { #wipe { display: none !important; } .lc-cloud, .lc-top i, .lc-drop, .lc-peek, .chihaya { animation: none !important; } }

/* ---- result rank box + share modal fixes ---- */
.rank-box .share-btn { width: 100%; height: auto; min-height: 48px; padding: 8px 10px; font-size: 16px; letter-spacing: 0; white-space: normal; line-height: 1.25; }
.rk-nums { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
.rk-nums small { white-space: nowrap; font-size: 9px; letter-spacing: -.02em; }
.rk-nums b { font-size: clamp(14px, 4.6vw, 20px); }
.rank-box { overflow: hidden; }
.share-card > * { flex: none; }
.share-preview { flex: none; height: auto; }
.share-preview img { height: auto; min-height: 120px; }

/* ================= name, logo charge/burst, tutorial cats, sticky share ================= */
body.guide-open #fx { z-index: 12; }
#guide-cats { position: absolute; left: 0; right: 0; top: max(76px, calc(47% - 168px)); display: flex; justify-content: center; gap: 14px; pointer-events: none; }
#guide-cats .gc { pointer-events: auto; width: min(38vw, 150px); padding: 0; border: none; background: none; cursor: pointer; touch-action: manipulation; filter: drop-shadow(0 6px 0 rgba(27, 29, 77, .35)); }
#guide-cats .gc img { width: 100%; display: block; pointer-events: none; }
#guide-cats .gc:first-child { transform: rotate(-6deg); } #guide-cats .gc:last-child { transform: rotate(6deg); }
#guide-cats .gc.pop { animation: gc-pop .5s ease; }
@keyframes gc-pop { 30% { translate: 0 -16%; scale: 1.14; } 60% { translate: 0 2%; scale: .96; } }

.name-card { text-align: center; }
.name-cats { display: flex; justify-content: center; gap: 4px; margin: -6px 0 2px; } .name-cats img { width: 84px; }
.name-title { margin: 0; font-family: var(--chunky); font-weight: 400; font-size: 24px; color: #ff4f9a; text-shadow: 2px 2px 0 var(--ink); }
.name-sub { margin: 6px 0 12px; font-size: 12px; font-weight: 900; opacity: .75; }
.name-input { width: 100%; box-sizing: border-box; height: 52px; padding: 0 16px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; font: inherit; font-weight: 900; font-size: 18px; text-align: center; color: var(--ink); outline: none; }
.name-input:focus { box-shadow: 0 0 0 4px #ffd23f; }
.name-actions { display: flex; gap: 10px; margin-top: 14px; } .name-actions button { flex: 1; min-height: 50px; }
.name-row { display: flex; gap: 8px; } .name-row .name-input { height: 44px; font-size: 16px; } .name-row .sub-btn { flex: none; padding: 0 14px; }
.hello { margin: -6px 0 0; padding: 4px 16px; border-radius: 999px; background: #fff; border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-weight: 900; font-size: 14px; max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; align-self: center; }
.hello[hidden] { display: none; }

.logo-cat.charging { z-index: 6; cursor: pointer; }
.logo-cat.boom { animation: logo-boom .9s cubic-bezier(.2, .9, .3, 1) forwards; }
@keyframes logo-boom { 0% { transform: scale(1); } 25% { transform: scale(1.5, 1.7) rotate(-4deg); filter: brightness(1.6); } 45% { transform: scale(.7, .6); } 70% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); } }
#goo { position: fixed; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; display: none; }
#goo.go { display: block; animation: goo-life 3.4s ease forwards; }
#goo i { position: absolute; top: -260px; border-radius: 48% 52% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 32% 28%, hsl(var(--h) 100% 88%), hsl(var(--h) 90% 66%) 55%, hsl(var(--h) 80% 48%)); box-shadow: inset -8px -10px 0 rgba(255, 255, 255, .25); animation: goo-fall 2s cubic-bezier(.5, 0, .9, .6) forwards; }
.goo-tide { position: absolute; left: -10%; right: -10%; bottom: -70%; height: 70%; background: linear-gradient(180deg, #ff9ccc, #ff4f9a 45%, #b8a6ff); border-radius: 50% 50% 0 0 / 60px 60px 0 0; box-shadow: 0 -14px 0 rgba(255, 255, 255, .5) inset; animation: goo-tide 3.2s ease forwards; }
@keyframes goo-fall { 0% { transform: translateY(0) scaleY(.7); } 80% { transform: translateY(calc(100vh + 300px)) scaleY(1.4); } 100% { transform: translateY(calc(100vh + 300px)) scaleY(1.4); } }
@keyframes goo-tide { 0% { transform: translateY(0); } 30% { transform: translateY(-105%); } 55% { transform: translateY(-100%); } 100% { transform: translateY(20%); } }
@keyframes goo-life { 0%, 78% { opacity: 1; } 100% { opacity: 0; } }
body.reduced #goo { display: none !important; }

.tp-yomi span.lucky { color: #e79a00; text-shadow: 0 0 10px rgba(255, 210, 63, .9); animation: lucky-glow .7s ease-in-out infinite; }
.tp-yomi span.lucky::after { content: "★"; position: absolute; margin: -1.1em 0 0 -.8em; font-size: .6em; color: #ffd23f; }
.tp-yomi span { position: relative; }
@keyframes lucky-glow { 50% { transform: scale(1.22); filter: brightness(1.2); } }

/* result / final: the share + next-step buttons stay on screen (no scrolling to find them) */
.result-card { max-height: 100%; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.result-card .actions { position: sticky; bottom: 0; z-index: 3; margin: 0 -8px; padding: 10px 8px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(255, 250, 242, 0), rgba(255, 250, 242, .96) 26%); }
.share-cta { background: linear-gradient(180deg, #ffe680, #ffd23f) !important; color: var(--ink) !important; }

#demo-cap { position: fixed; left: 50%; top: 112px; z-index: 30; transform: translateX(-50%) scale(.6); opacity: 0; max-width: 92vw; padding: 8px 20px; border-radius: 999px; background: linear-gradient(90deg, #ff7ab6, #ffb347); color: #fff; font-weight: 900; font-size: clamp(15px, 4.6vw, 22px); text-shadow: 0 2px 0 rgba(120, 20, 70, .5); box-shadow: 0 5px 0 rgba(140, 30, 90, .6), 0 12px 24px rgba(255, 79, 154, .35); white-space: nowrap; pointer-events: none; }
#demo-cap.show { animation: demo-cap 2.6s ease forwards; }
@keyframes demo-cap { 0% { opacity: 0; transform: translateX(-50%) scale(.5); } 10% { opacity: 1; transform: translateX(-50%) scale(1.12); } 18% { transform: translateX(-50%) scale(1); } 82% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(1); } }

/* ============================================================================
   NX theme — soft, sturdy, friendly menus in the spirit of Nintendo's UI:
   white borders + soft coloured drop shadows, pill buttons, big round cards,
   no heavy black outlines on the chrome (the characters keep theirs).
   ============================================================================ */
:root { --nx-shadow: 0 10px 0 rgba(120, 92, 190, .16), 0 20px 44px rgba(80, 50, 130, .2); --nx-soft: 0 4px 0 rgba(120, 92, 190, .22), 0 10px 18px rgba(80, 50, 130, .12); }
.big-btn { border: 4px solid #fff; border-radius: 999px; background: linear-gradient(180deg, #ff9bd0, #ff4f9a 60%, #ee3a86); color: #fff; text-shadow: 0 2px 0 rgba(150, 20, 85, .5); box-shadow: 0 6px 0 #c22d77, 0 14px 24px rgba(255, 79, 154, .35), inset 0 3px 0 rgba(255, 255, 255, .5); }
.big-btn.share-cta { border-color: #fff; background: linear-gradient(180deg, #fff2a3, #ffd23f 60%, #ffbe1f) !important; color: #5a3b00 !important; text-shadow: 0 1px 0 rgba(255, 255, 255, .7); box-shadow: 0 6px 0 #d49a00, 0 14px 24px rgba(255, 190, 31, .4), inset 0 3px 0 rgba(255, 255, 255, .6); }
.sub-btn, .mode-chip { border: 3px solid #fff; border-radius: 999px; background: linear-gradient(180deg, #ffffff, #f1edff); color: var(--ink); box-shadow: var(--nx-soft); }
.icon-btn { border: 3px solid #fff; background: linear-gradient(180deg, #ffffff, #f1edff); box-shadow: var(--nx-soft); }
.quit-btn { border: 3px solid #fff; background: linear-gradient(180deg, #ffffff, #f1edff); box-shadow: var(--nx-soft); }
.chip { border: 3px solid #fff; box-shadow: 0 4px 0 rgba(30, 60, 190, .35); }
.card, .modal-card, .result-card, .share-card, .cal-card, .quest-card { border: 4px solid #fff; border-radius: 30px; box-shadow: var(--nx-shadow); }
.tally span, .clock, .dopa, .combo, .pips { border-color: #fff; box-shadow: var(--nx-soft); }
.tally span, .clock { border-width: 3px; }
.grades button, .node, .co-item, .cal-day { border: 3px solid #fff; box-shadow: var(--nx-soft); }
.node.locked, .co-item.locked { box-shadow: 0 3px 0 rgba(120, 92, 190, .18); }
.co-item.on { box-shadow: 0 0 0 4px #ff7ab6, var(--nx-soft); }
.pad.tpad.roma .tk { border: 3px solid #fff; border-radius: 12px; box-shadow: 0 4px 0 rgba(120, 92, 190, .3), 0 8px 12px rgba(80, 50, 130, .1); }
.pad.tpad.roma .tk:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(120, 92, 190, .3); }
.tk.next { box-shadow: 0 4px 0 #d49a00, 0 0 0 4px #fff, 0 0 22px 8px rgba(255, 122, 182, .85) !important; }
.toast, .hello, .share-preview, .name-input { border-color: #fff; box-shadow: var(--nx-soft); }
.hello { border-width: 3px; background: linear-gradient(180deg, #fff, #fff6fb); }
.name-input { border: 3px solid #e7defa; box-shadow: inset 0 3px 6px rgba(120, 92, 190, .12); }
.name-input:focus { border-color: #ff7ab6; box-shadow: 0 0 0 4px rgba(255, 122, 182, .35); }
.sns, .share-main button, .share-fmt button { border: 3px solid #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .22), 0 8px 14px rgba(0, 0, 0, .12); }
.share-x { border: 3px solid #fff; }
.chihaya, .xlink, .share-credit a { border-color: #fff; }
.hello::before { content: "🐾 "; }
body { -webkit-tap-highlight-color: transparent; }
.name-actions button { min-width: 0; padding: 0 10px; font-size: 17px; white-space: nowrap; }
.name-card { width: min(360px, calc(100vw - 32px)); box-sizing: border-box; }
.share-cta { font-size: clamp(15px, 4.6vw, 19px); letter-spacing: 0; white-space: nowrap; padding-left: 8px; padding-right: 8px; }
.result-card .actions .share-cta { min-height: 52px; }
/* phones: the "send with picture" button (OS share sheet) comes first and spans the row; PC hides it */
@media (pointer: coarse) { .sns-more { order: -1; grid-column: 1 / -1; min-height: 58px; background: linear-gradient(90deg, #7a4bff, #ff4f9a); } }
@media (pointer: fine) { .sns-more { display: none; } }

/* ---- 90秒チャレンジ / share simplification ---- */
.challenge-btn { background: linear-gradient(180deg, #fff2a3, #ffd23f 60%, #ffbe1f) !important; color: #5a3b00 !important; text-shadow: 0 1px 0 rgba(255, 255, 255, .7) !important; box-shadow: 0 6px 0 #d49a00, 0 14px 24px rgba(255, 190, 31, .4), inset 0 3px 0 rgba(255, 255, 255, .6) !important; margin-top: 2px; }
.challenge-btn small { display: block; font-size: 10px; font-weight: 900; opacity: .8; letter-spacing: 0; }
.sh-send { display: flex; flex-direction: column; align-items: center; width: 100%; min-height: 58px; margin: 0 0 8px; padding: 6px 10px; font: inherit; font-weight: 900; font-size: 16px; color: #fff; border: 3px solid #fff; border-radius: 18px; background: linear-gradient(90deg, #7a4bff, #ff4f9a); box-shadow: 0 5px 0 rgba(90, 40, 160, .5), 0 10px 18px rgba(122, 75, 255, .25); }
.sh-send small { font-size: 10.5px; font-weight: 900; opacity: .92; }
.sh-send[hidden] { display: none; }
.share-main { grid-template-columns: 1fr 1fr; }
.share-main .sh-save { grid-column: 1 / -1; }
.share-main button { min-height: 46px; font-size: 13.5px; }
@media (min-width: 700px) { .sh-send { grid-column: 2; grid-row: 2; } .share-main { grid-row: 3; } .share-note { grid-row: 4; } .share-credit { grid-row: 5; } }
.challenge-btn { width: auto; min-width: 0; align-self: center; padding-left: 22px; padding-right: 22px; max-width: 88%; font-size: clamp(16px, 5vw, 20px); white-space: nowrap; }
.share-main { width: 100%; box-sizing: border-box; }
.share-main button { min-width: 0; padding: 0 6px; white-space: nowrap; font-size: clamp(12px, 3.6vw, 13.5px); }
.share-main .sh-save { white-space: nowrap; }
.share-main { display: grid; grid-template-columns: 1fr 1fr; }
.share-main button:nth-child(4) { grid-column: 1 / -1; }
@media (min-width: 700px) { .share-note { align-self: start; } }

/* ---- result card: the button bar is solid (no see-through, no dashed line over the content) ---- */
.result-card .actions { position: sticky; bottom: 0; z-index: 3; margin: 10px -20px -20px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 0; border-radius: 0 0 24px 24px; background: #fff; box-shadow: 0 -14px 14px -10px rgba(80, 50, 130, .2); }
.result-card { padding-bottom: 0; scrollbar-width: thin; }
.result-card > :nth-last-child(2) { margin-bottom: 10px; }

/* ================= PC: wider layout (the phone column is no longer used on big screens) ================= */
@media (min-width: 1000px) and (min-height: 600px) {
  #app { width: min(100vw, 1080px); }
  #screen-play .hud, #screen-play .hud2 { padding-left: 32px; padding-right: 32px; }
  .stage { margin: 0 32px; }
  .card { width: min(880px, calc(100% - 64px)); margin-left: auto; margin-right: auto; }
  .sheet-wrap { min-height: 230px; }
  .tp-text { font-size: clamp(34px, 3.2vw, 46px); }
  .tp-yomi { font-size: clamp(24px, 2.2vw, 32px); }
  .tp-yomi.solo { font-size: clamp(34px, 3.2vw, 46px); }
  .tp-roma { font-size: clamp(20px, 1.8vw, 26px); }
  .step-label { font-size: 16px; }
  .pad.tpad { width: min(840px, calc(100% - 64px)); margin-left: auto; margin-right: auto; }
  .pad.tpad.roma .tk { height: 60px; font-size: 22px; }
  .pad.tpad .kr { gap: 8px; margin-bottom: 8px; }
  .modes { width: min(100%, 720px); }
  .grades { width: min(100%, 720px); grid-template-columns: repeat(6, 1fr); }
  .big-btn.level-btn { min-width: 420px; }
  .logo-cat { --fs: clamp(60px, 6vw, 84px); width: min(100%, 540px); }
  .result-card { max-width: 660px; margin-left: auto; margin-right: auto; }
  .quest-card, .cal-card { max-width: 560px; }
  #screen-tree > *, #screen-trophy > *, #screen-collect > *, #screen-zukan > * { max-width: 820px; margin-left: auto; margin-right: auto; width: 100%; box-sizing: border-box; }
  .co-grid { grid-template-columns: repeat(4, 1fr); }
  .share-card { width: 820px; }
}
@media (min-width: 1500px) and (min-height: 860px) {
  #app { width: min(100vw, 1240px); }
  .card { width: min(1000px, calc(100% - 64px)); }
  .pad.tpad { width: min(960px, calc(100% - 64px)); }
  .pad.tpad.roma .tk { height: 70px; font-size: 25px; }
  .tp-text { font-size: 52px; } .tp-yomi { font-size: 36px; } .tp-roma { font-size: 29px; }
}

/* PC title: logo + cats on the left, the whole menu on the right (everything fits without scrolling) */
@media (min-width: 1000px) and (min-height: 600px) {
  #screen-title.is-active { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr auto; column-gap: 28px; row-gap: 8px; align-content: center; align-items: start; justify-items: center; padding: 28px 40px 24px; overflow-y: auto; }
  #screen-title > .settings-btn { position: absolute; }
  #screen-title > #logo { grid-column: 1; grid-row: 1; margin-top: 6px; }
  #screen-title > .title-stage { grid-column: 1; grid-row: 2; width: 100%; height: min(34vh, 300px); align-self: end; }
  #screen-title > .hello { grid-column: 2; grid-row: 1; align-self: end; justify-self: center; }
  #screen-title > .modes { grid-column: 2; grid-row: 2; align-self: start; width: 100%; }
  #screen-title > .quest-card { grid-column: 1 / -1; grid-row: 3; max-width: 760px; }
  #screen-title .big-btn.level-btn { min-width: 0; width: min(100%, 440px); }
  #screen-title .challenge-btn { width: min(100%, 440px); max-width: none; }
  #screen-title .grades { grid-template-columns: repeat(3, 1fr); width: min(100%, 440px); }
  #screen-title .mode-row { justify-content: center; }
}
@media (min-width: 1000px) and (min-height: 600px) {
  /* row 1: logo | hello+menu   row 2: cats | quests   row 3+: calendar, hint, credit across the width */
  #screen-title.is-active { grid-template-rows: auto auto auto auto auto; align-content: start; }
  #screen-title > #logo { grid-row: 1 / span 2; }
  #screen-title > .title-stage { grid-row: 3; height: min(30vh, 250px); }
  #screen-title > .hello { grid-row: 1; }
  #screen-title > .modes { grid-row: 2 / span 2; }
  #screen-title > .quest-card { grid-column: 1 / -1; grid-row: 4; }
  #screen-title > .cal-card { grid-column: 1 / -1; grid-row: 5; max-width: 760px; }
  #screen-title > .hint, #screen-title > .ura-chip, #screen-title > .credit { grid-column: 1 / -1; }
}
