/* けしカス — ていねいに作られた文房具（企画書 13章） */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-num);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  touch-action: manipulation; /* スマホで れんだ しても ズームしない */
}
:root { --on-accent: #2B2A28; }
button { font-family: inherit; color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--eraser-blue); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { display: block; flex-shrink: 0; }
h1, h2, h3 { font-family: var(--font-jp); font-weight: 900; margin: 0; text-wrap: balance; }
/* スペースなしの 日本語でも ことばの とちゅうで 改行しない（対応ブラウザのみ） */
:root:lang(ja) body { word-break: auto-phrase; }
.jp { font-family: var(--font-jp); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

#app { height: 100%; }
@supports (height: 100dvh) { #app { height: 100dvh; } } /* スマホの アドレスバーに かくれない */
.screen { height: 100%; }

/* ---------- ボタン ---------- */
.btn {
  min-height: var(--tap);
  padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid var(--ink); border-radius: var(--r-l);
  background: var(--card); color: var(--ink);
  font-family: var(--font-jp); font-weight: 900; font-size: 16px;
  box-shadow: var(--shadow-press);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease, opacity .2s;
  user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-pink { background: var(--eraser-pink); color: var(--on-accent); }
.btn-blue { background: var(--eraser-blue); color: #FFFFFF; }
.btn-gold { background: var(--gold); color: var(--on-accent); }
.btn-ghost { border: none; box-shadow: none; background: transparent; font-weight: 700; font-size: 15px; }
.btn-ghost:active:not(:disabled) { transform: none; box-shadow: none; opacity: .7; }
.btn-danger { color: var(--danger); border-color: var(--danger); box-shadow: 0 4px 0 var(--danger); }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 18px; border-radius: 16px; }

.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-family: var(--font-num); font-weight: 900; font-size: 12px; letter-spacing: .06em;
}
.badge-stage { background: var(--eraser-blue); color: #FFFFFF; }
.badge-special { background: #B07A10; color: #FFFFFF; }
.badge-new { background: var(--eraser-pink); color: var(--on-accent); }

/* ---------- タイトル ---------- */
#screen-title {
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 16px; gap: 22px; overflow: auto;
  background:
    radial-gradient(circle at 50% 38%, rgba(255,255,255,.55), transparent 60%),
    var(--paper);
}
/* 画面が ひくい スマホでも つぶれず スクロールできるように */
#screen-title > *, #screen-naming > * { flex-shrink: 0; }
#screen-title > :first-child, #screen-naming > :first-child { margin-top: auto; }
#screen-title > :last-child, #screen-naming > :last-child { margin-bottom: auto; }
.title-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.title-sub { font-weight: 900; font-size: 13px; letter-spacing: .3em; color: var(--graphite); }
.title-name { font-family: var(--font-jp); font-weight: 900; font-size: clamp(48px, 9vw, 88px); letter-spacing: .04em; line-height: 1.05; }
.title-name.long { font-size: clamp(36px, 7vw, 72px); text-align: center; } /* 長い名前（Eraser Crumb Clicker など）は 小さめ */
.title-tag { font-family: var(--font-jp); font-weight: 500; font-size: 16px; color: var(--ink-soft); text-align: center; }
.title-desk {
  position: relative; width: min(420px, 90vw); aspect-ratio: 42 / 30; border-radius: var(--r-2xl); overflow: hidden;
  background: var(--desk-grain); box-shadow: inset 0 0 0 1px rgba(92,64,30,.12), 0 8px 0 var(--line);
}
.title-desk .kasu-paper { left: 8%; top: 9%; width: 84%; height: 82%; }
.title-desk img { position: absolute; left: 40%; top: 58%; width: 62%; transform: translate(-50%, -50%); }
.title-eraser { position: absolute; right: 5%; top: 8%; width: 38%; aspect-ratio: 220 / 124; transform: rotate(-14deg); }
.title-eraser svg { display: block; width: 100%; height: 100%; }
.title-buttons { display: flex; flex-direction: column; gap: 12px; width: min(340px, 90vw); }
.title-foot { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lang-toggle { display: flex; padding: 3px; gap: 2px; border-radius: var(--r-m); background: var(--paper-3); }
.lang-toggle button {
  min-width: 96px; min-height: 40px; border: none; border-radius: var(--r-s); background: transparent;
  font-family: var(--font-jp); font-weight: 900; font-size: 14px; cursor: pointer;
}
.lang-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.link-btn { border: none; background: none; color: var(--eraser-blue); font-family: var(--font-jp); font-weight: 700; font-size: 14px; min-height: 40px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.foot-note { font-size: 12px; font-weight: 700; color: var(--graphite); font-family: var(--font-jp); }

/* ---------- なまえ ---------- */
#screen-naming {
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 32px 16px; overflow: auto;
}
.naming-day { font-weight: 900; font-size: 13px; letter-spacing: .3em; color: var(--eraser-pink); }
.naming-lead { font-family: var(--font-jp); font-weight: 500; font-size: 16px; color: var(--ink-soft); }
.naming-title { font-size: 26px; }
.naming-desk { width: min(300px, 80vw); }
.naming-input {
  width: min(320px, 90vw); height: 56px; padding: 0 18px;
  border: 2px solid var(--ink); border-radius: 16px; background: var(--card); color: var(--ink);
  font-family: var(--font-jp); font-weight: 900; font-size: 22px; text-align: center;
}
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 360px; }
.chip {
  min-height: 40px; padding: 0 16px; border: 2px solid var(--line-2); border-radius: 999px; background: var(--card);
  font-family: var(--font-jp); font-weight: 700; font-size: 15px; cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--eraser-pink); color: var(--on-accent); }
.naming-note { font-family: var(--font-jp); font-size: 12px; color: var(--graphite); text-align: center; }

/* ---------- ゲーム ---------- */
#screen-game { display: flex; flex-direction: column; overflow: hidden; position: relative; }
.topbar {
  height: 72px; flex-shrink: 0; padding: 0 28px;
  display: flex; align-items: center; gap: 24px;
  border-bottom: 2px solid var(--line); background: var(--paper-2);
}
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-logo svg { width: 40px; height: 40px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: var(--font-jp); font-weight: 900; font-size: 24px; letter-spacing: .04em; }
.brand-sub { font-size: 11px; font-weight: 800; letter-spacing: .18em; color: var(--graphite); margin-top: 4px; }
.news {
  flex: 1; min-width: 0; height: 40px;
  display: flex; align-items: center; gap: 12px; padding: 0 16px 0 6px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden;
}
.news-label {
  flex-shrink: 0; padding: 5px 12px; border-radius: 999px; background: var(--ink); color: var(--paper);
  font-family: var(--font-jp); font-weight: 700; font-size: 13px;
}
.news-track { flex: 1; min-width: 0; overflow: hidden; position: relative; height: 100%; display: flex; align-items: center; }
.news-text { font-family: var(--font-jp); font-weight: 500; font-size: 15px; white-space: nowrap; display: inline-block; }
.news-text.enter { animation: news-in .5s ease both; }
.news-text.scroll { animation: news-scroll linear both; }
@keyframes news-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes news-scroll { 0%, 15% { transform: translateX(0); } 100% { transform: translateX(var(--shift)); } }

.topnav { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.navbtn {
  height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 8px;
  border: none; border-radius: var(--r-m); background: transparent; color: var(--ink);
  font-family: var(--font-jp); font-weight: 700; font-size: 14px; cursor: pointer;
}
.navbtn:hover { background: var(--paper-3); }
.navbtn-icon { width: 44px; padding: 0; justify-content: center; }
.rebirth-btn {
  height: 44px; margin-left: 8px; padding: 0 18px; display: flex; align-items: center; gap: 8px;
  border: 2px solid var(--line-2); border-radius: var(--r-m); background: var(--paper-3); color: var(--graphite);
  font-family: var(--font-jp); font-weight: 900; font-size: 14px; cursor: pointer;
}
.rebirth-btn svg { width: 22px; height: 16px; }
.rebirth-btn.ready {
  border-color: var(--ink); background: var(--gold); color: var(--on-accent);
  box-shadow: 0 0 0 4px rgba(231,181,51,.3); animation: glow 1.6s ease-in-out infinite;
}
@keyframes glow { 50% { box-shadow: 0 0 0 8px rgba(231,181,51,.12); } }
.mobile-zukan { display: none; }

.buffbar {
  margin: 0; padding: 8px 28px; display: flex; flex-direction: column; gap: 6px;
  background: #2B2A28; color: var(--gold-soft);
}
.buffbar[hidden] { display: none; }
.buff { position: relative; display: flex; align-items: center; gap: 14px; }
.buff svg { width: 36px; height: 32px; flex: none; }
.buff-text { display: flex; flex-direction: column; line-height: 1.25; }
.buff-name { font-family: var(--font-jp); font-weight: 900; font-size: 17px; color: var(--gold); }
.buff-desc { font-family: var(--font-jp); font-weight: 700; font-size: 13px; }
.buff-time { margin-left: auto; font-weight: 900; font-size: 24px; font-variant-numeric: tabular-nums; }
.buff-bar { flex-basis: 180px; height: 6px; border-radius: 999px; background: rgba(255,255,255,.18); overflow: hidden; }
.buff-bar > div { height: 100%; background: var(--gold); }
.buff:not(.is-gold) .buff-name { color: var(--eraser-pink); }
.buff:not(.is-gold) .buff-bar > div { background: var(--eraser-pink); }
.buff-short { display: none; }

.panes { flex: 1; min-height: 0; display: flex; }
.pane { min-height: 0; }

/* カス */
.pane-kasu {
  width: 440px; flex-shrink: 0; padding: 24px 32px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  border-right: 2px solid var(--line); overflow-y: auto;
}
.count { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.count-num { font-family: var(--font-num); font-weight: 900; font-size: 64px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.count-unit { font-family: var(--font-jp); font-weight: 700; font-size: 16px; color: var(--graphite); }
.count-unit b { font-family: var(--font-num); font-weight: 800; color: var(--ink); }
.count-cps {
  margin-top: 6px; padding: 4px 12px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line);
  font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums;
}
.count-cps.boost { background: var(--gold); border-color: var(--ink); color: var(--on-accent); }
.count-small .count-num { font-size: 34px; }
.count-small .count-unit { font-size: 13px; }

.kasu-stage {
  position: relative; width: 376px; max-width: 100%; aspect-ratio: 1; flex-shrink: 0;
  border-radius: var(--r-2xl); overflow: hidden;
  background: var(--desk-grain);
  cursor: pointer; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  box-shadow: inset 0 0 0 1px rgba(92,64,30,.12), 0 8px 0 var(--line);
}
.kasu-stage.hold-rub { touch-action: none; }
.kasu-paper {
  position: absolute; left: 8%; top: 7%; width: 84%; height: 86%; border-radius: 3px; transform: rotate(-3deg);
  background: repeating-linear-gradient(180deg, var(--note) 0px, var(--note) 27px, var(--note-line) 27px, var(--note-line) 28px);
  box-shadow: 0 12px 26px rgba(60,40,15,.28), 0 1px 2px rgba(0,0,0,.18);
}
/* つくえの カス（さわると もじもじ するだけ） */
.kasu {
  position: absolute; left: 4%; top: 36%; width: 58%; height: 58%;
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.kasu-body { position: absolute; inset: 0; display: block; transition: transform .6s cubic-bezier(.5,-0.4,.3,1.4), opacity .3s; }
.kasu.gain .kasu-body { animation: gain .22s ease-out; }
@keyframes gain { 0% { transform: scale(1); } 40% { transform: scale(1.08, .93); } 70% { transform: scale(.98, 1.02); } 100% { transform: scale(1); } }
.kasu.shy .kasu-body { animation: shy .9s ease; }
@keyframes shy { 20% { transform: rotate(-4deg) scale(1.02); } 50% { transform: rotate(3deg); } 80% { transform: rotate(-1deg); } }
/* ふく は ほかの うごきより つよい（ほめた あとでも ちゃんと とぶように、shy より あとに かく） */
.kasu.blown .kasu-body { animation: blown 3s ease-in-out both; }
@keyframes blown {
  0% { transform: none; opacity: 1; }
  18% { transform: translate(160%, -60%) rotate(260deg) scale(.6); opacity: 0; }
  80% { transform: translate(-160%, 30%) rotate(-40deg) scale(.6); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

/* カスの絵。カラフルは 形で切りぬいた にじ色を かさねる */
.kpic { position: relative; display: block; width: 100%; height: 100%; }
.kpic img { width: 100%; height: 100%; display: block; pointer-events: none; }
.kpic-tint {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.kpic-rainbow {
  background:
    repeating-linear-gradient(125deg, #FF4F6D 0%, #FF9A3C 6%, #FFD83F 12%, #5DD37A 18%, #36B5F0 24%, #6E6BFF 30%, #E05CD8 36%, #FF4F6D 42%);
}

/* こする 消しゴム */
/* 消しゴムは ななめ 45° に 立てて、ピンクの 先で こする（先が つくえに あたる） */
.eraser-btn {
  position: absolute; left: 50%; top: 45%; width: 44%; aspect-ratio: 220 / 124; padding: 0; border: none; background: transparent; cursor: grab;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  transform: rotate(-48deg); border-radius: 18px; z-index: 3;
}
.eraser-shadow {
  position: absolute; left: 54%; top: 80%; width: 22%; height: 5%; border-radius: 50%;
  background: rgba(0,0,0,.18); filter: blur(3px); pointer-events: none;
}
.eraser-btn:active { cursor: grabbing; }
.eraser-btn:focus-visible { outline: 3px solid var(--blue, #3E6FB0); outline-offset: 4px; }
.eraser-art { position: absolute; inset: 0; display: block; transition: filter .2s; }
.eraser-art svg { display: block; width: 100%; height: 100%; pointer-events: none; }
.eraser-btn:hover .eraser-art { filter: brightness(1.04) drop-shadow(0 6px 8px rgba(60,40,15,.18)); }
.eraser-btn.rubbing { animation: rubbing-eraser .2s ease-out; }
.eraser-shadow.rubbing { animation: rubbing-eraser .2s ease-out; }
/* 先を つくえに つけたまま 左右に こする（まわす 角度は transform の rotate に たされる） */
@keyframes rubbing-eraser {
  0% { translate: 0 0; rotate: 0deg; }
  30% { translate: -10px 1px; rotate: -3deg; }
  65% { translate: 6px 0; rotate: 2deg; }
  100% { translate: 0 0; rotate: 0deg; }
}
/* ぶたい（STAGE が でるように なると ひろがっていく）。つくえ いがいは 紙を かくす */
.kasu-scene { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .8s ease; }
.kasu-scene svg { display: block; width: 100%; height: 100%; }
.kasu-stage:not([data-scene="desk"]) .kasu-scene { opacity: 1; }
.kasu-stage:not([data-scene="desk"]) .kasu-paper { opacity: 0; }
.kasu-paper { transition: opacity .8s ease; }
.kasu-stage[data-scene="space"] .float-num { color: #FFF6D6; -webkit-text-stroke-color: #1D2238; text-shadow: 0 1px 0 rgba(0,0,0,.5); }
.kasu-stage[data-scene="space"] .speck { filter: invert(.85); }
.kasu-stage.lv6 { box-shadow: inset 0 0 0 1px rgba(92,64,30,.12), 0 8px 0 var(--line), 0 0 0 3px var(--gold); }
.kasu-stage.lv7 { box-shadow: inset 0 0 0 1px rgba(92,64,30,.12), 0 8px 0 var(--line), 0 0 0 3px #8FA7C8, 0 0 28px rgba(143,167,200,.5); }
.kasu-stage.golden-on { box-shadow: 0 0 0 3px var(--gold), 0 0 40px rgba(231,181,51,.6); }

.kasu-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float-num {
  position: absolute; font-family: var(--font-num); font-weight: 900; font-size: 24px; color: var(--ink);
  -webkit-text-stroke: 4px #fff; paint-order: stroke fill;
  text-shadow: 0 2px 0 rgba(60,40,15,.18); pointer-events: none; white-space: nowrap;
  animation: floatup .9s cubic-bezier(.2,.8,.3,1) forwards;
}
.golden-on .float-num { color: var(--gold-deep); }
@keyframes floatup {
  0% { opacity: 0; transform: translate(-50%, 0) scale(.4); }
  15% { opacity: 1; transform: translate(-50%, -14px) scale(1.25); }
  30% { transform: translate(-50%, -22px) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--fx, 0px)), -90px) scale(.9); }
}
/* つぎの めあて（いま買えるもの。買えないときは いちばん 安いもの）とミッション */
.goal {
  width: 100%; max-width: 376px; display: flex; align-items: stretch; gap: 8px; padding: 6px 8px 6px 6px;
  border: 1.5px solid var(--line); border-radius: var(--r-l); background: var(--card); color: var(--ink);
}
.goal[hidden] { display: none; }
.goal.ready { border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.goal-go { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.goal-ico { width: 34px; height: 34px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 9px; background: var(--paper-3); }
.goal-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.goal-name { font-family: var(--font-jp); font-weight: 900; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.goal-sub { font-family: var(--font-jp); font-weight: 700; font-size: 12px; color: var(--graphite); }
.goal.ready .goal-sub { color: var(--eraser-blue); }
.goal-bar { height: 5px; border-radius: 999px; background: var(--paper-3); overflow: hidden; }
.goal-bar > span { display: block; height: 100%; background: var(--eraser-blue); border-radius: inherit; transition: width .3s; }
.goal-buy {
  flex-shrink: 0; min-width: 64px; padding: 0 14px; border: 2px solid var(--ink); border-radius: var(--r-m); background: var(--eraser-pink); color: var(--on-accent);
  font-family: var(--font-jp); font-weight: 900; font-size: 14px; cursor: pointer; box-shadow: 0 3px 0 var(--ink);
}
.goal-buy:disabled { opacity: .45; box-shadow: none; cursor: default; border-color: var(--line-2); }
.goal-ping { animation: goal-ping 1s ease; }
@keyframes goal-ping { 0%, 60% { box-shadow: 0 0 0 4px var(--eraser-blue); } 100% { box-shadow: 0 0 0 0 transparent; } }
.mission-strip {
  width: 100%; max-width: 376px; display: flex; align-items: center; gap: 8px; padding: 6px 10px; min-height: 34px; position: relative;
  border: 1.5px solid var(--gold); border-radius: var(--r-l); background: var(--gold-soft); color: var(--on-accent);
  font-family: var(--font-jp); font-weight: 700; font-size: 12.5px; text-align: left; cursor: pointer; overflow: hidden;
}
.mission-strip[hidden] { display: none; }
.mission-strip .ms-head { font-weight: 900; flex-shrink: 0; }
.mission-strip .ms-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mission-strip .ms-rw { flex-shrink: 0; font-weight: 900; font-size: 11.5px; padding: 0 8px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--ink); }
.mission-strip .ms-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 0; background: transparent; }
.ms-bar { height: 6px; border-radius: 999px; background: var(--paper-3); overflow: hidden; }
.ms-bar > span { display: block; height: 100%; background: var(--gold-deep); border-radius: inherit; transition: width .3s; }
.ms-list { display: flex; flex-direction: column; gap: 10px; }
.ms-row { padding: 12px 14px; border: 2px solid var(--ink); border-radius: var(--r-l); background: var(--card); display: flex; flex-direction: column; gap: 6px; }
.ms-row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ms-row-top b { font-family: var(--font-jp); font-weight: 900; font-size: 15px; }
.ms-row .ms-rw { font-weight: 900; font-size: 12px; padding: 1px 10px; border-radius: 999px; background: var(--gold-soft); border: 1.5px solid var(--ink); }
.ms-row small { font-weight: 700; color: var(--graphite); font-variant-numeric: tabular-nums; }
.dl-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 8px 0; }
.dl-day { aspect-ratio: 1 / 1.25; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 6px 2px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 900; }
.dl-day.today { border-color: var(--ink); background: var(--gold-soft); box-shadow: 0 3px 0 var(--ink); }
.dl-day.past { background: var(--paper-3); color: var(--graphite); }
.dl-n { font-size: 15px; font-variant-numeric: tabular-nums; }
.dl-i { min-height: 20px; display: flex; align-items: center; font-size: 14px; }
/* まぜる を たたむ */
.mat-toggle { width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 2px solid var(--line); border-radius: var(--r-l); background: var(--card); color: var(--ink); font: inherit; font-weight: 900; font-size: 14px; text-align: left; cursor: pointer; }
.mat-toggle small { flex: 1; font-weight: 700; color: var(--graphite); font-size: 12px; }
.mat-toggle.has small { color: var(--eraser-blue); }
.mat-chev { width: 9px; height: 9px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .2s; flex-shrink: 0; }
.mat-toggle[aria-expanded="true"] .mat-chev { transform: rotate(-135deg) translateY(-2px); }
#mat-body { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
#mat-body[hidden] { display: none; }
#mat-current { font-weight: 700; color: var(--graphite); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.bld.can { box-shadow: 0 0 0 3px rgba(62,111,176,.22); }
/* スマホ: 目標・ミッションは 名前の すぐ下、ほめる/ふくの 上 */
@media (max-width: 900px) {
  .pane-kasu .goal, .pane-kasu .mission-strip { max-width: none; order: 5; }
  .pane-kasu .actions { order: 6; }
}
/* こすった 先の けむり */
.rub-puff {
  position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.9) 0 30%, rgba(200,190,175,.55) 55%, rgba(200,190,175,0) 72%);
  animation: rub-puff .45s ease-out forwards; pointer-events: none;
}
@keyframes rub-puff { from { opacity: .9; transform: scale(.3); } to { opacity: 0; transform: scale(1.6); } }
/* こすると つぶの 数が ぴょこっと はねる */
.count-num.bump { animation: count-bump .18s ease-out; }
@keyframes count-bump { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
/* こすって とぶ カスは ひょろひょろの ひも（4しゅるいの 形を ランダムに） */
.speck {
  position: absolute; width: 28px; height: 9px; margin: -4px 0 0 -14px; opacity: 0;
  background: url(../art/speck-1.svg) center / 100% 100% no-repeat;
  animation: speck .65s cubic-bezier(.3,.1,.5,1) forwards;
}
.speck.k2 { background-image: url(../art/speck-2.svg); }
.speck.k3 { background-image: url(../art/speck-3.svg); }
.speck.k4 { background-image: url(../art/speck-4.svg); }
@keyframes speck {
  0% { transform: none; opacity: 1; }
  40% { transform: translate(var(--mx), var(--my)) rotate(var(--r)); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(calc(var(--r) * 2)) scale(.5); opacity: 0; }
}

.kasu-info { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.kasu-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.kasu-name { font-family: var(--font-jp); font-weight: 900; font-size: 20px; text-align: center; }
.kasu-pet { font-family: var(--font-jp); font-weight: 700; font-size: 13px; color: var(--graphite); }
.kasu-pet:empty { display: none; }
button.kasu-pet { background: none; border: 0; padding: 2px 4px; cursor: pointer; border-radius: 6px; }
button.kasu-pet:hover { background: var(--paper-3); }
.kasu-pet.unnamed { color: var(--eraser-blue); text-decoration: underline; text-underline-offset: 3px; }
.kasu-next { font-family: var(--font-jp); font-weight: 500; font-size: 13px; color: var(--graphite); }
.bar { width: 300px; max-width: 80vw; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--eraser-pink); transition: width .3s; }

.bubble {
  position: relative; align-self: stretch; padding: 14px 18px; border-radius: var(--r-xl);
  background: var(--card); border: 2px solid var(--ink);
  font-family: var(--font-jp); font-weight: 700; font-size: 16px; line-height: 1.6; text-align: center;
}
.bubble::before {
  content: ''; position: absolute; left: 50%; top: -9px; width: 14px; height: 14px; transform: translateX(-50%) rotate(45deg);
  background: var(--card); border-left: 2px solid var(--ink); border-top: 2px solid var(--ink);
}
.bubble.pop { animation: pop .25s ease; }
@keyframes pop { from { transform: scale(.96); opacity: .4; } to { transform: none; opacity: 1; } }
/* まるめる */
.btn-roll {
  align-self: stretch; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 16px; text-align: left;
  background: var(--gold); color: var(--on-accent); box-shadow: 0 4px 0 var(--ink);
}
.btn-roll svg { width: 26px; height: 26px; flex-shrink: 0; }
.btn-roll .roll-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.btn-roll b { font-family: var(--font-jp); font-weight: 900; font-size: 18px; }
.btn-roll small { font-family: var(--font-jp); font-weight: 700; font-size: 11px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-roll .price { font-size: 15px; background: rgba(255,255,255,.55); padding: 4px 10px; border-radius: 999px; }
.btn-roll:disabled { background: var(--card); color: var(--graphite); box-shadow: 0 4px 0 var(--line); }
.btn-roll:not(:disabled) { animation: roll-glow 1.6s ease-in-out infinite; }
@keyframes roll-glow { 50% { box-shadow: 0 4px 0 var(--ink), 0 0 0 7px rgba(231,181,51,.25); } }
.kasu.rolled .kasu-body { animation: rolled .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes rolled { 0% { transform: scale(.3) rotate(-120deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.z-desk-btn { margin-top: 12px; min-height: 40px; font-size: 14px; }
.z-ondesk { margin-top: 12px; align-self: flex-start; padding: 4px 12px; border-radius: 999px; background: var(--paper-2); border: 1.5px solid var(--line-2); font-family: var(--font-jp); font-weight: 700; font-size: 12px; }

.actions { display: flex; gap: 12px; align-self: stretch; margin-top: auto; padding-top: 6px; }
.actions .btn { flex: 1 1 auto; min-width: 0; min-height: 52px; padding: 0 10px; gap: 4px; white-space: nowrap; } /* 文字の長さに あわせて 幅を わける（折り返さない） */
.actions .btn svg { width: 20px; height: 20px; flex: none; }

/* つくえ */
.pane-desk { flex: 1; min-width: 0; padding: 24px 28px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; position: relative; }
.pane-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pane-head h2 { font-size: 20px; }
.pane-sub { font-family: var(--font-jp); font-weight: 500; font-size: 13px; color: var(--graphite); }
.desk-rows { display: flex; flex-direction: column; gap: 12px; }
.desk-row {
  min-height: 104px; flex-shrink: 0; padding: 12px 20px;
  display: flex; align-items: center; gap: 18px; border-radius: var(--r-xl);
  background: linear-gradient(180deg, var(--desk-top) 0%, var(--desk) 100%);
  box-shadow: inset 0 -4px 0 rgba(92,64,30,.14);
  color: var(--desk-ink);
}
.desk-row-name { width: 128px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; }
.desk-row-name b { font-family: var(--font-jp); font-weight: 900; font-size: 15px; color: var(--ink); word-break: keep-all; overflow-wrap: anywhere; line-height: 1.3; }
:root[data-theme="dark"] .desk-row-name b { color: var(--desk-ink); }
.desk-row-name span { font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
.desk-units { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; max-height: 80px; overflow: hidden; }
.desk-units .u { display: inline-block; }
.desk-units .u-new { animation: drop .4s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes drop { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
.desk-row[data-b="ant"] .u { animation: walk 2.4s ease-in-out infinite alternate; }
.desk-row[data-b="grandpa"] .u { animation: rubbing 1.2s ease-in-out infinite; transform-origin: bottom center; }
.desk-row[data-b="moon"] .u, .desk-row[data-b="eplanet"] .u, .desk-row[data-b="universe"] .u { animation: float 3s ease-in-out infinite; }
.desk-row[data-b="finger"] .u { animation: tap 1s ease-in-out infinite; }
.desk-units .u:nth-child(3n+1) { animation-delay: -.4s; }
.desk-units .u:nth-child(3n+2) { animation-delay: -.9s; }
@keyframes walk { to { transform: translateX(5px); } }
@keyframes rubbing { 50% { transform: rotate(-4deg); } }
@keyframes float { 50% { transform: translateY(-4px); } }
@keyframes tap { 50% { transform: translateY(3px); } }
.desk-count { flex-shrink: 0; font-weight: 900; font-size: 22px; font-variant-numeric: tabular-nums; }
.desk-more { font-weight: 900; font-size: 13px; opacity: .7; }
.desk-empty {
  min-height: 104px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding: 12px;
  border-radius: var(--r-xl); border: 2px dashed var(--line-2);
  font-family: var(--font-jp); font-weight: 700; font-size: 15px; color: var(--graphite); text-align: center;
}

/* みせ */
.pane-shop {
  width: 400px; flex-shrink: 0; padding: 24px 24px 0;
  display: flex; flex-direction: column; gap: 14px; background: var(--paper-2); border-left: 2px solid var(--line);
}
.seg { display: flex; align-items: center; padding: 3px; gap: 2px; border-radius: var(--r-m); background: var(--paper-3); }
.seg button {
  min-width: 42px; height: 34px; padding: 0 8px; border: none; border-radius: var(--r-s); background: transparent;
  font-weight: 900; font-size: 13px; font-family: var(--font-jp); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg .seg-mode[data-mode="sell"][aria-pressed="true"] { background: var(--danger); color: #FFFFFF; }
.seg-gap { width: 6px; }
.shop-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding-bottom: 24px; margin: 0 -6px; padding-left: 6px; padding-right: 6px; }
.shop-group { display: flex; flex-direction: column; gap: 8px; }
.group-label { font-family: var(--font-jp); font-weight: 700; font-size: 13px; color: var(--graphite); }
.group-label small { font-weight: 700; color: var(--ink-soft); margin-left: 6px; }
.up-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.up {
  position: relative; height: 52px; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--ink); border-radius: var(--r-m); background: var(--card); cursor: pointer; padding: 0;
  transition: transform .1s, opacity .2s, background .2s;
}
.up.cant { border-color: var(--line-2); background: var(--paper-3); opacity: .7; }
.up.sel { box-shadow: 0 0 0 3px var(--eraser-blue); }
.up.can:hover { transform: translateY(-2px); }
.up.flash { animation: flash .6s ease; }
@keyframes flash { 0% { background: var(--gold-soft); } }
.up.empty { border: 2px dashed var(--line-2); background: transparent; color: var(--muted); font-weight: 900; font-size: 16px; cursor: default; }
.up-icon-b { position: relative; display: inline-flex; }
.up-icon-b svg { width: 28px; height: 28px; }
.up-star { position: absolute; right: -8px; bottom: -6px; }
.up-detail {
  padding: 12px 14px; border-radius: var(--r-l); background: var(--card); border: 2px solid var(--ink);
  display: flex; flex-direction: column; gap: 6px;
}
.up-detail-head { display: flex; align-items: center; gap: 10px; }
.up-detail-name { font-family: var(--font-jp); font-weight: 900; font-size: 15px; flex: 1; }
.up-detail-desc { font-family: var(--font-jp); font-weight: 500; font-size: 13px; line-height: 1.6; color: var(--ink-soft); }
.up-detail-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.up-detail .btn { min-height: 44px; font-size: 15px; box-shadow: 0 3px 0 var(--ink); }
.price { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
.price.no { color: var(--danger); }
:root[data-theme="dark"] .price.no { color: #F0908C; }
.price svg { width: 11px; height: 11px; }
.mat-list { display: flex; flex-direction: column; gap: 6px; }
.mat {
  min-height: 52px; padding: 6px 12px 6px 8px; display: flex; align-items: center; gap: 10px;
  border: 2px solid var(--ink); border-radius: var(--r-l); background: var(--card); cursor: pointer; text-align: left;
}
.mat.cant { border-color: var(--line); background: var(--paper); opacity: .72; }
.mat-ico { width: 38px; height: 38px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--paper-3); }
.mat-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mat-name { font-family: var(--font-jp); font-weight: 900; font-size: 14px; }
.mat-desc { font-family: var(--font-jp); font-weight: 500; font-size: 12px; color: var(--graphite); }
.chip-dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--ink); flex-shrink: 0; }

.shop-list { display: flex; flex-direction: column; gap: 8px; }
.bld {
  min-height: 64px; padding: 6px 14px 6px 10px; display: flex; align-items: center; gap: 12px;
  border: 2px solid var(--ink); border-radius: var(--r-l); background: var(--card); text-align: left; cursor: pointer;
  transition: opacity .25s, background .25s, transform .1s;
}
.bld.cant { border-color: var(--line); background: var(--paper); opacity: .72; cursor: default; }
.bld.can:hover { transform: translateX(-2px); }
.bld.bump { animation: bump .25s ease; }
@keyframes bump { 40% { transform: scale(1.03); } }
.bld.became { animation: became .7s ease; }
@keyframes became { 0% { background: var(--gold-soft); } }
.bld-ico { width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: var(--r-m); background: var(--paper-3); }
.bld-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bld-name { font-family: var(--font-jp); font-weight: 900; font-size: 15px; }
.bld-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bld-rate { font-weight: 800; font-size: 12px; color: var(--graphite); font-variant-numeric: tabular-nums; }
.bld-own { font-weight: 900; font-size: 26px; color: var(--line-2); font-variant-numeric: tabular-nums; }
.bld.sell { border-color: var(--danger); }
.bld-line { font-family: var(--font-jp); font-size: 12px; color: var(--graphite); }

/* なかまの くわしい 数字（PC: ホバーの ふきだし / スマホ: よこの ボタンで ひらく） */
.bld-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.bld-wrap > .bld { flex: 1; min-width: 0; }
.bld-info {
  display: none; width: 58px; flex-shrink: 0; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  border: 2px solid var(--line-2); border-radius: var(--r-l); background: var(--card); color: var(--graphite); cursor: pointer; padding: 0;
  font-weight: 900; font-size: 12px; font-variant-numeric: tabular-nums;
}
.bld-info svg { transition: transform .2s; }
.bld-wrap.open .bld-info { border-color: var(--ink); color: var(--ink); background: var(--paper-3); }
.bld-wrap.open .bld-info svg { transform: rotate(180deg); }
@media (hover: none), (pointer: coarse) { .bld-info { display: flex; } }
.bld-stats {
  flex-basis: 100%; padding: 10px 14px 12px; border-radius: var(--r-l); background: var(--paper-3);
  animation: statsIn .2s ease;
}
@keyframes statsIn { from { opacity: 0; transform: translateY(-4px); } }
.bst-line { font-family: var(--font-jp); font-size: 12px; color: var(--graphite); margin-bottom: 6px; }
.bst-grid { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 3px; align-items: center; }
.bst-k { font-family: var(--font-jp); font-weight: 700; font-size: 12px; color: var(--graphite); }
.bst-v { justify-self: end; font-weight: 900; font-size: 14px; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 3px; }
.bst-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 1px 0 3px; }
.bst-bar span { display: block; height: 100%; border-radius: 3px; background: var(--eraser-blue); }
.bld-tip {
  position: fixed; z-index: 60; width: 260px; padding: 12px 14px 14px; pointer-events: none;
  border: 2px solid var(--ink); border-radius: var(--r-l); background: var(--card); box-shadow: 0 6px 18px rgba(0, 0, 0, .14);
}
.bst-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bst-head b { flex: 1; font-family: var(--font-jp); font-weight: 900; font-size: 15px; }
.bst-head span { font-weight: 900; font-size: 13px; color: var(--graphite); }

/* メニュー（スマホ） */
.pane-menu { display: none; }
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.menu-item {
  min-height: 64px; padding: 0 16px; display: flex; align-items: center; gap: 14px;
  border: 2px solid var(--ink); border-radius: 16px; background: var(--card); cursor: pointer; text-align: left;
}
.menu-item svg { width: 24px; height: 24px; }
.menu-item-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.menu-item-text b { font-family: var(--font-jp); font-weight: 900; font-size: 17px; }
.menu-item-text small { font-family: var(--font-jp); font-weight: 700; font-size: 12px; color: var(--graphite); }
.menu-item-num { font-weight: 900; font-size: 15px; color: var(--graphite); }
.menu-item.gold { background: var(--gold); color: var(--on-accent); }
.menu-item.gold small { color: #5A4410; }
.menu-sub { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.menu-sub button { min-height: 48px; border: none; background: none; text-align: left; font-family: var(--font-jp); font-weight: 700; font-size: 15px; padding: 0 6px; cursor: pointer; display: flex; align-items: center; gap: 10px; }

/* タブ（スマホ） */
.tabs { display: none; }

/* ゲストけしゴム（ゴールデンも ここ） */
.guest {
  position: absolute; z-index: 55; width: 80px; height: 80px; padding: 0; border: none; background: transparent; cursor: pointer; /* ずかんなどの 画面（.modal 50）より 上 */
  display: grid; place-items: center;
  animation: golden-in .5s ease both;
}
.guest-art { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.95) 0%, rgba(255,255,255,.7) 55%, rgba(255,255,255,0) 72%);
  animation: golden-bob 1.6s ease-in-out .5s infinite; }
.guest-art svg { width: 64px; height: 56px; filter: drop-shadow(0 3px 0 rgba(43,42,40,.25)); }
.guest.is-golden .guest-art { background: radial-gradient(circle, rgba(255,246,214,.95) 0%, rgba(231,181,51,.45) 55%, rgba(231,181,51,0) 72%); filter: drop-shadow(0 0 12px rgba(231,181,51,.8)); }
.guest-label {
  position: absolute; left: 50%; bottom: calc(100% - 2px); transform: translateX(-50%); white-space: nowrap;
  padding: 3px 10px; border: 2px solid #2B2A28; border-radius: 999px; background: #FFFFFF; color: #2B2A28;
  font-family: var(--font-jp); font-weight: 900; font-size: 12px; box-shadow: 0 2px 0 #2B2A28; pointer-events: none;
}
.guest.is-golden .guest-label { background: #FFF6D6; }
@media (prefers-reduced-motion: reduce) { .guest, .guest-art, .eraser-btn.swap .eraser-art { animation: none; } }
/* もちかえた けしゴム: いれかわる ときに ぽんっと でる。カスの いろも その けしゴムの いろ */
.eraser-btn.swap .eraser-art { animation: eraser-swap .45s cubic-bezier(.3,1.5,.5,1); }
@keyframes eraser-swap { from { transform: scale(.4) rotate(-30deg); opacity: 0; } }
.kasu-stage[data-hold="golden"] .speck { filter: sepia(1) saturate(5) hue-rotate(5deg) brightness(1.5); }
.kasu-stage[data-hold="kadokeshi"] .speck { filter: grayscale(1) brightness(2.4) drop-shadow(0 0 1px #2B2A28); }
.kasu-stage[data-hold="sand"] .speck { filter: sepia(.7) contrast(1.5) brightness(1.1); }
.kasu-stage[data-hold="kaori"] .speck { filter: grayscale(1) sepia(1) hue-rotate(300deg) saturate(3) brightness(1.6); }
.kasu-stage[data-hold="rocket"] .speck { filter: grayscale(1) sepia(1) hue-rotate(50deg) saturate(3) brightness(1.4); }
.kasu-stage[data-hold="neri"] .speck { display: none; }
.kasu-stage[data-hold="dendo"] .speck { filter: grayscale(1) brightness(2.2) drop-shadow(0 0 1px #3E6FB0); }
.kasu-stage[data-hold="jumbo"] .speck { filter: grayscale(1) brightness(2.4) drop-shadow(0 0 1px #2B2A28); }
.kasu-stage[data-hold="jumbo"] #eraser { scale: 1.3; }
.kasu-stage[data-hold="dendo"] .eraser-art svg { animation: dendo-buzz .12s linear infinite; }
@keyframes dendo-buzz { 0%, 100% { translate: 0 0; } 25% { translate: 1px -1px; } 75% { translate: -1px 1px; } }
@media (prefers-reduced-motion: reduce) { .kasu-stage[data-hold="dendo"] .eraser-art svg { animation: none; } }
.guest[hidden] { display: none; }
@keyframes golden-in { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }
@keyframes golden-bob { 50% { transform: translateY(-6px) rotate(6deg); } }
.guest.leaving { animation: golden-out .6s ease forwards; }
@keyframes golden-out { to { opacity: 0; transform: scale(.4); } }
#screen-game.gold-mode { background: radial-gradient(circle at 30% 40%, #FFF6D6 0%, #F7E7B8 55%, #EFD58E 100%); }
:root[data-theme="dark"] #screen-game.gold-mode { background: radial-gradient(circle at 30% 40%, #4A3C18 0%, #2E2716 60%, #22211F 100%); }

/* コーチ（チュートリアル） */
.coach {
  position: absolute; z-index: 30; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: min(380px, calc(100vw - 32px)); padding: 16px 18px; border-radius: var(--r-xl);
  background: #2B2A28; color: #FFFFFF; display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-soft); animation: pop .3s ease;
}
.coach-step { font-weight: 900; font-size: 11px; letter-spacing: .2em; color: var(--eraser-pink); }
.coach-title { font-family: var(--font-jp); font-weight: 900; font-size: 19px; }
.coach-body { font-family: var(--font-jp); font-weight: 500; font-size: 14px; line-height: 1.6; color: #D8D5CE; }
.coach-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.coach-foot button { min-height: 40px; padding: 0 14px; border-radius: var(--r-m); font-family: var(--font-jp); font-weight: 700; font-size: 13px; cursor: pointer; }
.coach-skip { border: none; background: transparent; color: #B8B4AC; }
.coach-ok { border: 2px solid #FFFFFF; background: var(--eraser-pink); color: var(--on-accent); font-weight: 900 !important; }
.coach-target { box-shadow: 0 0 0 4px var(--eraser-pink), 0 0 0 10px rgba(242,156,163,.3) !important; }

/* ---------- ダイアログ ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(43,42,40,.45); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-card {
  position: relative; width: 480px; max-width: 100%; max-height: calc(100vh - 48px); overflow-y: auto;
  padding: 24px; border-radius: 24px; background: var(--paper); box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 16px; animation: rise .25s ease;
}
.modal-card.wide { width: 1100px; }
.modal-card.mid { width: 760px; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 12px; }
/* スクロールしても タイトルと × は 上に のこる（カードの padding の ぶん 上に のばして すきまを うめる） */
.modal-card { --mpad: 24px; }
.modal-card > .modal-head:first-child {
  position: sticky; top: calc(-1 * var(--mpad)); z-index: 5;
  margin: calc(-1 * var(--mpad)) calc(-1 * var(--mpad)) 0; padding: var(--mpad) var(--mpad) 10px;
  background: var(--paper);
}
.modal-head h1 { font-size: 24px; flex: 1; }
.icon-btn {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  border: 2px solid var(--ink); border-radius: var(--r-m); background: var(--card); cursor: pointer;
}
.head-count { font-weight: 900; font-size: 18px; font-variant-numeric: tabular-nums; }
.head-pill { padding: 4px 12px; border-radius: 999px; background: var(--gold); color: var(--on-accent); font-weight: 900; font-size: 13px; }
.lead { margin: 0; font-family: var(--font-jp); font-weight: 500; font-size: 14px; line-height: 1.7; color: var(--ink-soft); }
.center { text-align: center; }

/* 設定 */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 6px 0; border-bottom: 1.5px solid var(--line); }
.set-row > span { font-family: var(--font-jp); font-weight: 900; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.switch { position: relative; width: 60px; height: 34px; border-radius: 999px; border: 2px solid var(--ink); background: var(--paper-3); cursor: pointer; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--eraser-pink); }
.switch[aria-checked="true"]::after { transform: translateX(26px); }
.parents-box { padding: 14px 16px; border-radius: 16px; background: var(--card); border: 1.5px solid var(--line-2); display: flex; flex-direction: column; gap: 8px; }
.parents-box h3 { font-size: 15px; }
.parents-box p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--ink-soft); font-family: var(--font-jp); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
textarea.savebox {
  width: 100%; min-height: 110px; padding: 12px; border: 2px solid var(--ink); border-radius: var(--r-l);
  background: var(--card); color: var(--ink); font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.5; resize: vertical; word-break: break-all;
}
.warn { font-family: var(--font-jp); font-size: 13px; color: var(--danger); font-weight: 700; }

/* ずかん */
.zukan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; align-content: start; }
.z-group { grid-column: 1 / -1; margin-top: 8px; font-family: var(--font-num); font-weight: 900; font-size: 11px; letter-spacing: .06em; color: var(--graphite); border-bottom: 2px solid var(--line); padding-bottom: 3px; }
.z-group:first-child { margin-top: 0; }
.z-cell .z-no { position: absolute; left: 4px; bottom: 2px; font-family: var(--font-num); font-weight: 800; font-size: 9px; color: var(--muted); letter-spacing: .02em; }
.z-detail-no { display: block; font-family: var(--font-num); font-weight: 900; font-size: 12px; color: var(--muted); letter-spacing: .06em; }
.zukan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.zukan-table { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.z-row { display: grid; grid-template-columns: 86px repeat(7, minmax(64px, 1fr)); gap: 6px; align-items: center; }
.z-head { font-family: var(--font-jp); font-weight: 900; font-size: 12px; display: flex; align-items: center; gap: 5px; justify-content: center; }
.z-rowlabel { font-weight: 900; font-size: 11px; letter-spacing: .06em; color: var(--graphite); }
.z-rowlabel b { display: block; font-family: var(--font-jp); font-size: 12px; color: var(--ink); letter-spacing: 0; }
.z-cell {
  position: relative; aspect-ratio: 1; border-radius: var(--r-m); border: 2px solid var(--ink); background: #F4F1EA;
  padding: 0; cursor: pointer; overflow: hidden;
}
.z-cell img { width: 100%; height: 100%; }
.z-cell.unk { border: 2px dashed var(--line-2); background: transparent; }
.z-cell.unk img { filter: brightness(0) opacity(.12) !important; }
:root[data-theme="dark"] .z-cell.unk img { filter: brightness(0) invert(1) opacity(.12) !important; }
.z-cell.sel { box-shadow: 0 0 0 3px var(--eraser-blue); }
.z-cell .z-new { position: absolute; right: 2px; top: 2px; font-size: 9px; padding: 1px 5px; }
.z-cell .z-q { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; color: var(--muted); font-size: 18px; }
.z-detail { padding: 18px; border-radius: 20px; background: var(--card); border: 2px solid var(--ink); display: flex; flex-direction: column; gap: 10px; align-self: start; position: sticky; top: 64px; }
.z-detail-img { position: relative; width: 100%; aspect-ratio: 1; border-radius: 16px; background: #F4F1EA; overflow: hidden; }
.z-detail-img img { width: 100%; height: 100%; }
.z-detail h3 { font-size: 20px; }
.z-en { font-size: 13px; font-weight: 800; color: var(--graphite); }
.z-quote { font-family: var(--font-jp); font-weight: 700; font-size: 14px; line-height: 1.6; }
.z-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-family: var(--font-jp); font-size: 12px; color: var(--graphite); }
.z-meta b { color: var(--ink); font-weight: 700; }

/* じっせき */
.ach-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.ach-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.ach-h { font-size: 16px; }
.ach-soon { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ach-soon-item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 16px; background: var(--card); border: 2px solid var(--line-2); color: inherit; text-align: left; cursor: pointer; }
.ach-soon-item .ach { width: 46px; flex-shrink: 0; }
.ach-soon-body { flex: 1; min-width: 0; }
.ach-soon-body b { display: block; font-family: var(--font-jp); font-weight: 900; font-size: 14px; }
.ach-soon-body small { color: var(--graphite); font-size: 12px; font-weight: 700; }
.ach-main .bar, .ach-detail .bar { display: block; width: 100%; max-width: none; height: 8px; }
.ach-main .bar-fill { display: block; }
.ach-legend { display: flex; gap: 12px; flex-wrap: wrap; font-family: var(--font-jp); font-size: 12px; font-weight: 700; color: var(--graphite); }
.ach-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ach-legend i { width: 14px; height: 14px; border-radius: 5px; border: 2.5px solid; display: inline-block; }
.ach-legend i.t1 { border-color: #C98B5A; } .ach-legend i.t2 { border-color: #9FA6AF; } .ach-legend i.t3 { border-color: #D9A520; background: #FFF6D6; }
.ach-legend i.no { border-style: dashed; border-color: var(--line-2); }
.ach-sec { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.ach-sec h3 { font-size: 16px; flex-shrink: 0; }
.ach-sec .bar { flex: 1; }
.ach-sec small { font-family: var(--font-num); font-weight: 800; font-size: 13px; color: var(--graphite); white-space: nowrap; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; align-content: start; }
.ach-btn { position: relative; padding: 0; border: none; background: none; cursor: pointer; border-radius: 16px; }
.ach-btn.sel { outline: 3px solid var(--eraser-blue); outline-offset: 2px; }
.ach { aspect-ratio: 1; width: 100%; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--card); border: 2.5px solid var(--ink); color: var(--ink); }
.ach > svg, .ach > img, .ach > .up-icon-b { width: 58% !important; height: 58% !important; }
.ach.t1 { border-color: #C98B5A; box-shadow: 0 3px 0 #C98B5A; }
.ach.t2 { border-color: #9FA6AF; box-shadow: 0 3px 0 #9FA6AF; }
.ach.t3 { border-color: #D9A520; box-shadow: 0 3px 0 #D9A520; background: #FFF6D6; }
.ach.shadow { border-color: #5A5956; background: #5A5956; }
:root[data-theme="dark"] .ach-legend i.t3 { background: #4A3F1E; }
.ach.no, .ach.q { border: 2px dashed var(--line-2); background: transparent; }
.ach.no > * { filter: grayscale(1); opacity: .35; }
.ach.q { font: 900 18px var(--font-num); color: var(--muted); }
.ach-p { position: absolute; left: 7px; right: 7px; bottom: 6px; height: 4px; border-radius: 9px; background: var(--line); overflow: hidden; }
.ach-p i { display: block; height: 100%; background: var(--eraser-pink); }
.ach-detail { padding: 16px; border-radius: 20px; background: var(--card); border: 2px solid var(--ink); display: flex; gap: 14px; align-items: flex-start; position: sticky; top: 64px; scroll-margin-top: 80px; }
.ach-detail > .ach { width: 76px; flex-shrink: 0; }
.ach-detail-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ach-detail h3 { font-size: 19px; }
.ach-left { margin: 0; font-family: var(--font-jp); font-weight: 700; font-size: 13px; color: var(--ink-soft); }
.toast .ach { width: 26px; border-width: 2px; box-shadow: none; flex-shrink: 0; }

/* とうけい */
.stat-big { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card { padding: 16px; border-radius: 18px; background: var(--card); border: 2px solid var(--ink); display: flex; flex-direction: column; gap: 4px; }
.stat-card b { font-weight: 900; font-size: 30px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-card span { font-family: var(--font-jp); font-weight: 700; font-size: 13px; color: var(--graphite); }
.stat-card small { font-size: 11px; font-weight: 800; color: var(--muted); }
.stat-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stat-group { padding: 16px 18px; border-radius: 18px; background: var(--paper-2); border: 1.5px solid var(--line-2); }
.stat-group h3 { font-size: 15px; margin-bottom: 6px; }
.stat-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-family: var(--font-jp); font-size: 14px; }
.stat-line:last-child { border-bottom: none; }
.stat-line b { font-family: var(--font-num); font-weight: 900; font-variant-numeric: tabular-nums; }

/* かけらの おみせ */
.shard-next { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 12px; border-radius: 18px; background: var(--card); border: 2px solid var(--line-2); }
.shard-next > svg { flex-shrink: 0; }
.shard-next-body { flex: 1; min-width: 0; }
.shard-next b { font-family: var(--font-jp); font-weight: 900; font-size: 15px; }
.shard-next small { display: block; color: var(--graphite); font-family: var(--font-jp); font-size: 12.5px; font-weight: 700; }
.shard-next .bar { width: 100%; max-width: none; height: 10px; margin-top: 6px; }
.shard-next .bar-fill { background: linear-gradient(90deg, #F29CA3, #E7B533); }
.shard-branches { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.shard-branch { border-radius: 20px; background: var(--card); border: 2px solid var(--ink); padding: 14px 14px 8px; }
.shard-bh { display: flex; align-items: center; gap: 10px; font-family: var(--font-jp); font-weight: 900; font-size: 16px; margin-bottom: 8px; }
.shard-bic { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--paper-2); border: 2px solid var(--line-2); flex-shrink: 0; }
.shard-bic svg { width: 26px; height: 26px; }
.shard-bh small { margin-left: auto; font-family: var(--font-num); font-weight: 800; font-size: 13px; color: var(--graphite); }
.shard-node { position: relative; width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 10px 10px 10px 36px; margin: 0 0 6px; border-radius: 14px; border: none; background: transparent; color: inherit; text-align: left; cursor: default; }
.shard-node::before { content: ''; position: absolute; left: 15px; top: -8px; bottom: -8px; width: 3px; background: var(--line); }
.shard-bh + .shard-node::before { top: 20px; }
.shard-node:last-child::before { bottom: calc(100% - 20px); }
.shard-bh + .shard-node:last-child::before { display: none; }
.shard-dot { position: absolute; left: 7px; top: 12px; width: 19px; height: 19px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--card); z-index: 1; display: flex; align-items: center; justify-content: center; }
.shard-node.owned { background: rgba(62, 111, 176, .12); }
.shard-node.owned .shard-dot { background: var(--eraser-blue); border-color: var(--eraser-blue); }
.shard-node.owned .shard-dot::after { content: ''; width: 8px; height: 4px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.shard-node.can { background: rgba(242, 156, 163, .2); box-shadow: inset 0 0 0 2px var(--eraser-pink); cursor: pointer; }
.shard-node.can:hover { box-shadow: inset 0 0 0 3px var(--eraser-pink); }
.shard-node.can .shard-dot { background: var(--eraser-pink); }
.shard-node.cant .shard-main { opacity: .75; }
.shard-node.lock { opacity: .55; }
.shard-node.lock .shard-dot { border-style: dashed; }
.shard-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.shard-name { font-family: var(--font-jp); font-weight: 900; font-size: 15px; line-height: 1.35; }
.shard-desc { font-family: var(--font-jp); font-weight: 500; font-size: 12.5px; line-height: 1.5; color: var(--ink-soft); }
.shard-need { align-self: flex-start; margin-top: 4px; padding: 0 8px; border-radius: 999px; background: var(--paper-2); color: var(--graphite); font-family: var(--font-jp); font-weight: 900; font-size: 11px; }
.shard-cost { margin-left: auto; flex-shrink: 0; display: flex; align-items: center; gap: 3px; font-family: var(--font-num); font-weight: 900; font-size: 15px; }
.shard-cost svg { width: 18px; height: 18px; }
.shard-cost.done { font-family: var(--font-jp); font-size: 12px; color: var(--eraser-blue); }
.shard-have { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 999px; background: var(--card); border: 2px solid var(--ink); font-weight: 900; font-size: 20px; }
.shard-have svg { width: 24px; height: 24px; }

/* てんせい */
.reb-scene { position: relative; height: 220px; margin: -24px -24px 0; border-radius: 24px 24px 0 0; overflow: hidden; background: var(--desk-grain); }
.reb-scene .kasu-paper { left: 8%; top: 10%; width: 84%; height: 82%; transform: rotate(-2deg); }
.reb-scene img { position: absolute; left: 6%; top: 8%; height: 84%; opacity: .85; }
.reb-scene svg { position: absolute; right: 8%; top: 32%; }
.reb-gain { padding: 14px 16px; display: flex; align-items: center; gap: 12px; border-radius: 16px; background: var(--card); border: 2px solid var(--ink); }
.reb-gain svg { width: 34px; height: 34px; }
.reb-gain-text { flex: 1; display: flex; flex-direction: column; }
.reb-gain-text span { font-family: var(--font-jp); font-weight: 700; font-size: 13px; color: var(--graphite); }
.reb-gain-text b { font-weight: 900; font-size: 26px; font-variant-numeric: tabular-nums; }
.reb-gain-text b small { font-size: 14px; color: var(--graphite); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.keep-box { padding: 12px 14px; border-radius: 14px; background: var(--paper-2); border: 1.5px solid var(--line-2); display: flex; flex-direction: column; gap: 6px; }
.keep-box b { font-family: var(--font-jp); font-weight: 900; font-size: 13px; }
.keep-box span { font-family: var(--font-jp); font-weight: 500; font-size: 13px; line-height: 1.6; }

/* おかえり・ひとやすみ */
.welcome-scene { position: relative; height: 200px; margin: -24px -24px 0; border-radius: 24px 24px 0 0; overflow: hidden; background: var(--desk-grain); display: flex; align-items: center; justify-content: center; }
.welcome-scene .kpic { height: 90%; width: auto; aspect-ratio: 1; }
.welcome-scene .zzz { position: absolute; right: 22%; top: 16%; font-weight: 900; font-size: 22px; color: var(--ink); animation: float 2s ease-in-out infinite; }
.welcome-gain { font-weight: 900; font-size: 44px; text-align: center; font-variant-numeric: tabular-nums; line-height: 1; }
.rest-scene { background: linear-gradient(180deg, #1D2238 0%, #2F3658 100%); }
.rest-scene img { filter: brightness(.75); }
.rest-scene .zzz { color: #FFF6D6; }
.moon-dot { position: absolute; left: 16%; top: 14%; width: 38px; height: 38px; border-radius: 50%; box-shadow: 10px 6px 0 0 #F3E3A6; }
.sleep-overlay {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
  background: linear-gradient(180deg, #1D2238 0%, #2F3658 100%); color: #FFF6D6; padding: 24px; text-align: center;
}
.sleep-overlay img { width: min(260px, 60vw); filter: brightness(.75); animation: breathe 3s ease-in-out infinite; }
.sleep-overlay p { font-family: var(--font-jp); font-weight: 700; font-size: 18px; margin: 0; }

/* ---------- しんかの演出 ---------- */
/* 0〜3.6s: ひかる シルエットが いれかわる（だんだん はやく）・光が あつまる・ゆれる
   3.6s: まっしろ フラッシュ → あたらしい カス、紙ふぶき、ほし。まぜた ときは 半分の じかん */
.evo {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at var(--cx, 50%) var(--cy, 40%), #3A3226 0%, #1C1B19 62%); color: #F6F1E7; overflow: hidden; padding: 24px;
  cursor: pointer; animation: evo-dark .4s ease both;
  --reveal: 3.6s;
}
.evo.mix { --reveal: 1.1s; background: radial-gradient(circle at var(--cx, 50%) var(--cy, 40%), #33303A 0%, #1C1B19 62%); }
.evo.lv7 { background: radial-gradient(circle at var(--cx, 50%) var(--cy, 40%), #2E3350 0%, #12131F 65%); }
.evo.special { background: radial-gradient(circle at var(--cx, 50%) var(--cy, 40%), #4A3A18 0%, #1C1B19 65%); }
@keyframes evo-dark { from { opacity: 0; } }

.evo-rays {
  position: absolute; left: var(--cx, 50%); top: var(--cy, 40%); width: 1400px; height: 1400px; margin: -700px 0 0 -700px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,246,214,.16) 0deg 7deg, transparent 7deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 60%); mask-image: radial-gradient(circle, #000 0%, transparent 60%);
  animation: rays-in var(--reveal) cubic-bezier(.5,0,.8,.5) both, rays-spin 14s linear infinite;
}
.evo-rays2 { background: repeating-conic-gradient(from 9deg, rgba(231,181,51,.22) 0deg 5deg, transparent 5deg 22deg); animation: rays-in .6s ease var(--reveal) both, rays-spin 20s linear infinite reverse; }
.evo.lv7 .evo-rays2 { background: repeating-conic-gradient(from 9deg, rgba(143,167,200,.28) 0deg 5deg, transparent 5deg 22deg); }
@keyframes rays-in { from { transform: scale(0); opacity: 0; } }
@keyframes rays-spin { to { rotate: 360deg; } }

.evo-rings { position: absolute; left: var(--cx, 50%); top: var(--cy, 36%); width: 0; height: 0; }
.evo-rings i {
  position: absolute; left: 0; top: 0; border-radius: 50%; border: 4px solid var(--gold); transform: translate(-50%, -50%); opacity: 0;
  animation: ring 1.4s ease-out var(--reveal) 2;
}
.evo-rings i:nth-child(2) { animation-delay: calc(var(--reveal) + .25s); border-color: #FFF6D6; }
.evo-rings i:nth-child(3) { animation-delay: calc(var(--reveal) + .5s); }
@keyframes ring { from { width: 60px; height: 60px; opacity: 1; } to { width: 1100px; height: 1100px; opacity: 0; } }

.evo-spark {
  position: absolute; left: var(--cx, 50%); top: var(--cy, 40%); width: 8px; height: 8px; margin: -4px; border-radius: 50%; opacity: 0;
  background: #FFF6D6; box-shadow: 0 0 12px 3px rgba(255,246,214,.8);
  animation: spark-in .7s cubic-bezier(.6,0,.9,.6) both;
}
@keyframes spark-in { from { transform: translate(var(--sx), var(--sy)) scale(1.4); opacity: 0; } 30% { opacity: 1; } to { transform: none; opacity: 0; } }
.evo-burst {
  position: absolute; left: var(--cx, 50%); top: var(--cy, 40%); width: 12px; height: 6px; border-radius: 2px; opacity: 0;
  animation: burst cubic-bezier(.1,.7,.3,1) both;
}
@keyframes burst {
  0% { transform: none; opacity: 1; }
  60% { opacity: 1; }
  100% { transform: translate(var(--bx), calc(var(--by) + 260px)) rotate(var(--rot)); opacity: 0; }
}
.evo-star {
  position: absolute; width: 14px; height: 14px; opacity: 0;
  background: #FFF6D6; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: twinkle 1.6s ease-in-out infinite both;
}
@keyframes twinkle { 0%, 100% { transform: scale(0); opacity: 0; } 50% { transform: scale(1) rotate(45deg); opacity: 1; } }

.evo-flash { position: absolute; inset: 0; background: #FFFFFF; opacity: 0; pointer-events: none; animation: flash-white .9s ease-out calc(var(--reveal) - .12s) both; }
.evo.mix .evo-flash { background: #F6E7F8; }
@keyframes flash-white { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }

.evo-inner { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; }
.evo-stagebox { position: relative; width: min(300px, 70vw); aspect-ratio: 1; margin-bottom: 10px; animation: shake var(--reveal) linear both; }
@keyframes shake {
  0%, 30% { transform: none; }
  40% { transform: translate(1px, -1px); } 50% { transform: translate(-2px, 1px); } 60% { transform: translate(2px, 2px); }
  70% { transform: translate(-3px, -2px); } 80% { transform: translate(4px, 1px); } 88% { transform: translate(-5px, 3px); }
  94% { transform: translate(5px, -4px) scale(1.04); } 100% { transform: scale(1.1); }
}
.evo-morph { position: absolute; inset: 0; filter: brightness(0) invert(1) drop-shadow(0 0 18px rgba(255,246,214,.9)); animation: morph-out .2s ease var(--reveal) both; }
.evo-morph > span { position: absolute; inset: 0; }
.evo-morph .kpic-tint { display: none; }
.evo-morph.cycle > span { opacity: 0; }
.evo-morph.cycle > span.on { opacity: 1; }
.evo-from { animation: blink-a var(--reveal) steps(1, end) both; }
.evo-to { animation: blink-b var(--reveal) steps(1, end) both; }
@keyframes blink-a {
  0% { opacity: 1; } 22% { opacity: 0; } 32% { opacity: 1; } 46% { opacity: 0; } 53% { opacity: 1; } 63% { opacity: 0; } 68% { opacity: 1; }
  75% { opacity: 0; } 79% { opacity: 1; } 84% { opacity: 0; } 87% { opacity: 1; } 90% { opacity: 0; } 92% { opacity: 1; } 94% { opacity: 0; } 96% { opacity: 1; } 98%, 100% { opacity: 0; }
}
@keyframes blink-b {
  0% { opacity: 0; } 22% { opacity: 1; } 32% { opacity: 0; } 46% { opacity: 1; } 53% { opacity: 0; } 63% { opacity: 1; } 68% { opacity: 0; }
  75% { opacity: 1; } 79% { opacity: 0; } 84% { opacity: 1; } 87% { opacity: 0; } 90% { opacity: 1; } 92% { opacity: 0; } 94% { opacity: 1; } 96% { opacity: 0; } 98%, 100% { opacity: 1; }
}
.evo.mix .evo-from { animation: none; opacity: 1; }
.evo.mix .evo-to { animation: none; opacity: 0; }
.evo.mix .evo-morph { animation: swirl var(--reveal) cubic-bezier(.5,0,.9,.4) both; }
@keyframes swirl { from { transform: none; } to { transform: rotate(720deg) scale(.1); opacity: 0; } }
@keyframes morph-out { to { opacity: 0; transform: scale(1.3); } }
.evo-reveal {
  position: absolute; inset: 0; opacity: 0;
  filter: drop-shadow(0 0 22px rgba(231,181,51,.75)) drop-shadow(0 0 4px rgba(255,246,214,.9));
  animation: reveal .9s cubic-bezier(.3,1.7,.5,1) var(--reveal) both, float 2.4s ease-in-out calc(var(--reveal) + 1s) infinite;
}
.evo.lv7 .evo-reveal { filter: drop-shadow(0 0 26px rgba(143,167,200,.9)) drop-shadow(0 0 4px #FFF6D6); }
/* 0% は opacity 0（fill: both で はじまる まえに 小さく みえて しまわないように） */
@keyframes reveal { 0% { opacity: 0; transform: scale(.2) rotate(-25deg); } 1% { opacity: 1; } 100% { opacity: 1; transform: none; } }

.evo-kicker { font-weight: 900; font-size: 13px; letter-spacing: .3em; color: var(--gold); animation: evo-in .45s ease calc(var(--reveal) + .2s) both; }
.evo-title {
  margin-top: 6px; font-size: clamp(38px, 8vw, 64px); letter-spacing: .04em; color: #FFF6D6;
  text-shadow: 0 4px 0 #8A6A3E, 0 0 24px rgba(231,181,51,.6);
  animation: evo-title .7s cubic-bezier(.3,1.8,.5,1) calc(var(--reveal) + .3s) both;
}
@keyframes evo-title { from { transform: scale(2.6) rotate(-6deg); opacity: 0; } }
.evo-result { margin: 18px 0 0; font-family: var(--font-jp); font-weight: 900; font-size: 21px; line-height: 1.6; color: #FFF6D6; animation: evo-in .45s ease calc(var(--reveal) + .8s) both; }
.evo-result em { font-style: normal; color: var(--gold); }
.evo-line { margin: 8px 0 0; font-family: var(--font-jp); font-weight: 500; font-size: 14px; line-height: 1.6; color: #B8B0A0; animation: evo-in .45s ease calc(var(--reveal) + 1.1s) both; }
.evo-new { margin-top: 18px; padding: 6px 16px; border-radius: 999px; background: var(--eraser-pink); border: 2px solid #FFF6D6; font-weight: 900; font-size: 14px; letter-spacing: .08em; color: #2B2A28; animation: new-pop .6s cubic-bezier(.3,1.8,.5,1) calc(var(--reveal) + 1.3s) both; }
@keyframes evo-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes new-pop { from { transform: scale(0) rotate(12deg); } }
.evo-tap { margin-top: 18px; font-family: var(--font-jp); font-size: 12px; color: #8C8577; animation: evo-in .45s ease calc(var(--reveal) + 1.7s) both; }

/* うごきを へらす 設定: 光と ゆれは なし、すぐ けっか */
.evo.reduced { --reveal: 0s; }
.evo.reduced .evo-rays, .evo.reduced .evo-stagebox, .evo.reduced .evo-flash, .evo.reduced .evo-rings i { animation: none; }
.evo.reduced .evo-morph { display: none; }
.evo.reduced .evo-reveal { animation: none; opacity: 1; }

/* てんせいの演出 */
.reb-anim { position: fixed; inset: 0; z-index: 80; background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 24px; text-align: center; }
.reb-anim .eraser { animation: eraser-form 1.6s cubic-bezier(.3,1.4,.5,1) both; }
@keyframes eraser-form { 0% { transform: scale(.2) rotate(-40deg); opacity: 0; filter: blur(6px); } 60% { opacity: 1; filter: none; } 100% { transform: none; } }
.reb-anim p { font-family: var(--font-jp); font-weight: 900; font-size: 20px; margin: 0; animation: pop .6s ease 1.4s both; }
.reb-anim img { width: 90px; animation: drop-in .6s cubic-bezier(.3,1.6,.5,1) 2.4s both; }
@keyframes drop-in { from { transform: translateY(-120px); opacity: 0; } }

/* ---------- トースト ---------- */
.toasts { position: fixed; z-index: 90; right: 20px; top: 84px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  padding: 10px 16px; border-radius: 14px; background: var(--ink); color: var(--paper);
  font-family: var(--font-jp); font-weight: 700; font-size: 14px; box-shadow: var(--shadow-soft);
  display: flex; align-items: center; gap: 10px; animation: toast 3.2s ease forwards; max-width: 340px;
}
.toast b { color: var(--gold); }
@keyframes toast { 0% { opacity: 0; transform: translateY(10px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

.only-narrow { display: none; }

/* ---------- 大きい PC 画面（全画面など）: 文字も カスも 大きく ---------- */
@media (min-width: 1600px) and (min-height: 1000px) {
  .pane-kasu { width: 580px; padding: 28px 40px; gap: 14px; }
  .kasu-stage { width: clamp(300px, calc(100vh - 700px), 520px); }
  .goal { max-width: 500px; padding: 8px 14px; }
  .goal-label { font-size: 15px; }
  .count-num { font-size: 84px; }
  .count-unit { font-size: 18px; }
  .count-cps { font-size: 17px; }
  .kasu-name { font-size: 24px; }
  .actions .btn { min-height: 60px; font-size: 18px; }
  .pane-desk { padding: 28px 36px; }
  .pane-head h2 { font-size: 24px; }
  .pane-sub { font-size: 15px; }
  .desk-row { min-height: 120px; }
  .desk-row-name { width: 150px; }
  .desk-row-name b { font-size: 18px; }
  .desk-row-name span { font-size: 15px; }
  .desk-count { font-size: 26px; }
  .desk-empty { min-height: 120px; font-size: 18px; }
  .pane-shop { width: 480px; padding: 28px 28px 0; }
  .group-label { font-size: 15px; }
  .up { height: 62px; }
  .up-icon-b svg, .up > svg { width: 34px; height: 34px; }
  .bld { min-height: 78px; gap: 14px; }
  .bld-ico { width: 54px; height: 54px; }
  .bld-ico svg { width: 40px; height: 40px; }
  .bld-name { font-size: 18px; }
  .bld-rate, .price { font-size: 15px; }
  .bld-own { font-size: 32px; }
  .seg button { height: 40px; font-size: 15px; min-width: 48px; }
  .navbtn, .rebirth-btn { height: 50px; font-size: 16px; }
}

/* ---------- 高さが ひくい PC 画面（CrazyGames の ふつうの まど 1186x668 など）: ほめる・ふく まで 1画面に おさめる ---------- */
@media (min-width: 901px) and (max-height: 940px) {
  .panes .pane-kasu { padding-top: 14px; padding-bottom: 14px; gap: 8px; }
  .count { flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: center; column-gap: 10px; }
  .count-num { font-size: 52px; }
  .count-cps { margin-top: 0; }
  .goal { padding: 4px 10px; }
  .goal-ico { width: 26px; height: 26px; }
  .pane-kasu .kasu-stage { width: clamp(200px, calc(100vh - 490px), 376px); }
  .kasu-info { gap: 3px; }
  .bubble { padding: 7px 14px; font-size: 14px; line-height: 1.5; }
  .actions .btn { min-height: 46px; }
}

/* ---------- タブレット ---------- */
@media (max-width: 1280px) {
  .pane-kasu { width: 380px; padding: 20px 24px; }
  .pane-shop { width: 360px; }
  .kasu-stage { width: 320px; }
  .navbtn span[data-t] { display: none; } /* 文字だけ かくす（設定は アイコンだけなので のこす） */
  .navbtn { width: 44px; padding: 0; justify-content: center; }
  .up-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ---------- スマホ（タブで切りかえ） ---------- */
@media (max-width: 900px) {
  .only-wide { display: none !important; }
  .only-narrow { display: inline; }
  div.only-narrow { display: flex; }
  .topbar { height: auto; padding: calc(10px + env(safe-area-inset-top)) 16px 0; flex-wrap: wrap; gap: 8px; border-bottom: none; background: transparent; }
  .brand-logo svg { width: 26px; height: 26px; }
  .brand-name { font-size: 18px; }
  .brand-sub { display: none; }
  .topnav { display: none; }
  .mobile-zukan {
    display: flex; align-items: center; margin-left: auto; height: 36px; padding: 0 14px; border: 1.5px solid var(--line-2); border-radius: 999px;
    background: var(--card); color: var(--ink); font-family: var(--font-jp); font-weight: 900; font-size: 12px; cursor: pointer;
  }
  .news { order: 3; flex-basis: 100%; height: 30px; padding: 0 12px 0 3px; gap: 8px; border-width: 1px; }
  .news-label { font-size: 10px; padding: 3px 8px; }
  .news-text { font-size: 12px; }
  .buffbar { margin: 10px 16px 0; border-radius: 18px; padding: 10px 14px; }
  .buff { flex-wrap: wrap; }
  .buff-bar { flex-basis: 100%; order: 5; }
  .panes { display: block; position: relative; overflow: hidden; }
  .pane { position: absolute; inset: 0; display: none !important; overflow-y: auto; padding: 16px 16px 100px; }
  .pane.active { display: flex !important; }
  /* 1画面に ぜんぶ おさめる: つくえは 全はば、なまえと バーは 1行、キラキラタイムと セリフは つくえの 中 */
  .pane-kasu { width: auto; border-right: none; gap: 8px; padding-top: 8px; }
  .count-num { font-size: 44px; }
  .count-unit { font-size: 13px; }
  .kasu-stage { width: 100%; aspect-ratio: 380 / 272; border-radius: 18px; }
  .kasu-info { flex-direction: row; flex-wrap: wrap; justify-content: center; align-self: stretch; gap: 4px 10px; }
  .kasu-name-row { flex-wrap: nowrap; }
  .kasu-name { font-size: 15px; }
  .kasu-pet { font-size: 12px; }
  .kasu-next { display: none; }
  .bar { flex-basis: 100%; width: 100%; max-width: none; height: 6px; }
  .btn-roll { min-height: 54px; }
  .actions { margin-top: 0; padding-top: 0; gap: 10px; }
  .actions .btn { min-height: 42px; font-size: 14px; box-shadow: 0 3px 0 var(--ink); }
  .kasu-stage .buffbar {
    position: absolute; left: 10px; top: 10px; z-index: 5; margin: 0; padding: 0; gap: 4px;
    align-items: flex-start; background: none; border-radius: 0;
  }
  .kasu-stage .buff {
    padding: 4px 12px 4px 6px; gap: 8px; background: #2B2A28; color: var(--gold-soft);
    border-radius: 999px; flex-wrap: nowrap; overflow: hidden; box-shadow: 0 3px 0 rgba(0,0,0,.25);
  }
  .kasu-stage .buff svg { width: 24px; height: 22px; }
  .kasu-stage .buff-text { display: none; }
  .kasu-stage .eraser-btn { top: 32%; }
  .kasu-stage .buff-short { display: inline; font-family: var(--font-jp); font-weight: 900; font-size: 14px; color: var(--gold); white-space: nowrap; }
  .kasu-stage .buff:not(.is-gold) .buff-short { color: var(--eraser-pink); }
  .kasu-stage .buff-time { margin-left: 0; font-size: 14px; }
  .kasu-stage .buff-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; flex-basis: auto; border-radius: 0; order: 0; }
  .kasu-stage .bubble {
    position: absolute; left: 50%; bottom: 10px; z-index: 4; transform: translateX(-50%);
    max-width: calc(100% - 20px); padding: 5px 12px; border-width: 1.5px; font-size: 12px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .kasu-stage .bubble::before { top: -6px; width: 9px; height: 9px; border-width: 1.5px; }
  .kasu-stage .bubble.pop { animation: none; }
  .pane-desk { padding-top: 14px; }
  .desk-row { min-height: 88px; padding: 10px 14px; gap: 10px; }
  .desk-row-name { width: 92px; }
  .desk-units { max-height: 70px; }
  .pane-shop { width: auto; border-left: none; background: var(--paper); flex-direction: column; padding-bottom: 0; }
  .pane-shop .shop-scroll { overflow: visible; padding-bottom: 100px; }
  .pane-shop.active { overflow-y: auto; }
  .up-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .pane-menu { flex-direction: column; gap: 14px; }
  .tabs {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(76px + env(safe-area-inset-bottom));
    padding: 8px 8px calc(12px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px;
    background: var(--paper-2); border-top: 2px solid var(--line);
  }
  .tabs button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: none; border-radius: var(--r-m); background: transparent; font-family: var(--font-jp); font-weight: 700; font-size: 11px; cursor: pointer;
  }
  .tabs button svg { width: 22px; height: 22px; }
  .tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
  .tab-badge {
    position: absolute; top: 2px; right: calc(50% - 26px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--eraser-pink); border: 1.5px solid var(--ink); font-family: var(--font-num); font-weight: 900; font-size: 10px; line-height: 15px; color: var(--on-accent);
  }
  .guest { width: 64px; height: 64px; }
  .guest-art svg { width: 50px; height: 44px; }
  /* せまい 画面では 上に。カスや みせの なかまを かくさない */
  .coach { top: calc(8px + env(safe-area-inset-top)); bottom: auto; padding: 12px 16px; gap: 2px; }
  .coach-title { font-size: 17px; }
  .coach-body { font-size: 13px; line-height: 1.5; }
  .coach-foot { margin-top: 0; }
  .coach-foot button { min-height: 36px; }
  /* 「とばす」だけの ときは 右上に よせて ひくく */
  .coach:not([data-step="3"]) .coach-foot { position: absolute; top: 4px; right: 6px; }
  .modal { padding: 0; }
  .modal-card, .modal-card.wide, .modal-card.mid { width: 100%; height: 100%; max-height: none; border-radius: 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); --mpad: 20px; }
  .modal-card > .modal-head:first-child { margin: -20px -16px 0; padding: 20px 16px 10px; }
  .reb-scene, .welcome-scene { margin: -20px -16px 0; border-radius: 0; }
  .zukan-layout, .ach-layout { grid-template-columns: 1fr; }
  .z-detail { position: static; order: -1; }
  .ach-detail { position: static; order: -1; }
  .z-detail { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .z-detail-img { width: 110px; flex-shrink: 0; }
  .z-detail-body { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 6px; }
  .z-row { grid-template-columns: 58px repeat(7, 56px); }
  .stat-big { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card b { font-size: 24px; }
  .stat-groups { grid-template-columns: 1fr; }
  .ach-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .shard-branches { grid-template-columns: 1fr; gap: 12px; }
  .shard-next { padding: 10px 12px; }
  .toasts { left: 16px; right: 16px; top: auto; bottom: calc(92px + env(safe-area-inset-bottom)); align-items: center; }
  .toast { font-size: 13px; padding: 8px 14px; }
  .toast:not(:last-child) { display: none; } /* せまい 画面では あたらしい 1まいだけ */
  #screen-game.gold-mode .pane-kasu { background: transparent; }
}
@media (max-width: 380px) {
  .brand { gap: 8px; }
  .brand-logo svg { width: 26px; height: 26px; }
  .brand-name { font-size: 17px; letter-spacing: 0; }
  .mobile-zukan { padding: 0 10px; font-size: 12px; }
  .naming-title { font-size: 24px; }
  .desk-row-name { width: 76px; }
}

/* うごきを へらす（OS の設定、または ゲームの設定） */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
:root.reduce-motion *, :root.reduce-motion *::before, :root.reduce-motion *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
}

/* よるの つくえ: アイコンは 明るい台紙の上に のせて 見やすく */
:root[data-theme="dark"] .bld-ico, :root[data-theme="dark"] .mat-ico { background: #E9E4DA; }
:root[data-theme="dark"] .up:not(.empty) { background: #F4F1EA; }
:root[data-theme="dark"] .up.cant { background: #BDB6A8; }
:root[data-theme="dark"] .desk-row .u svg [fill="#2B2A28"] { fill: #1A1917; }
:root[data-theme="dark"] .toast { background: #F1ECE2; color: #2B2A28; }
:root[data-theme="dark"] .toast b { color: #8A6410; }

/* --- ガチャ（けしゴムの かみ）・スタンプ・ちらかり --- */
@keyframes ticket-got { 0% { transform: scale(1); } 30% { transform: scale(1.06); } 100% { transform: scale(1); } }
.eraser-btn.fresh .eraser-art { animation: eraser-fresh .6s ease-out; }
@keyframes eraser-fresh { 0% { opacity: 0; transform: translateY(-30px) scale(1.15); } 60% { opacity: 1; transform: translateY(4px); } 100% { transform: none; } }
.kasu-mess { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.mess-dot {
  position: absolute; width: 16px; height: 5px; margin: -2px 0 0 -8px; opacity: 0; transition: opacity .3s;
  background: url(../art/speck-1.svg) center / 100% 100% no-repeat;
}
.mess-dot.k2 { background-image: url(../art/speck-2.svg); }
.mess-dot.k3 { background-image: url(../art/speck-3.svg); }
.mess-dot.k4 { background-image: url(../art/speck-4.svg); }
.mess-dot.on { opacity: .55; }
.kasu-stage[data-scene="space"] .mess-dot { filter: invert(.85); }
.kasu-mess.blowing .mess-dot.on { animation: mess-blow .7s ease-in forwards; transition: none; }
.kasu-mess.blowing .mess-dot:nth-child(odd).on { animation-duration: .55s; }
@keyframes mess-blow { to { transform: translate(160px, -90px) rotate(200deg); opacity: 0; } }
#blow-btn { position: relative; overflow: hidden; }
#blow-btn::before {
  content: ''; position: absolute; left: 0; bottom: 0; height: 4px; width: calc(var(--mess, 0) * 100%);
  background: var(--graphite, #6B6A66); opacity: .5; transition: width .2s;
}
#blow-btn.ready { animation: roll-glow 1.6s ease-in-out infinite; }
.z-trade-btn { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin-top: 8px; }
.z-trade-btn svg { width: 16px; height: 16px; }
#mat-current .chip-dot { display: inline-block; width: 10px; height: 10px; margin-left: 3px; vertical-align: -1px; }
@media (prefers-reduced-motion: reduce) {
  .kasu-mess.blowing .mess-dot.on { animation: none; opacity: 0; }
  .eraser-btn.fresh .eraser-art { animation: none; }
}

/* --- まるめる（ガチャ）の ページ --- */
.mid-switch { align-self: flex-start; }
.mid-switch button { position: relative; }
.mid-badge {
  display: inline-block; min-width: 18px; height: 18px; margin-left: 6px; padding: 0 5px; border-radius: 999px; vertical-align: 1px;
  background: var(--eraser-pink); border: 1.5px solid var(--ink); font-family: var(--font-num); font-weight: 900; font-size: 10px; line-height: 15px; color: var(--on-accent);
}
.mid-badge[hidden] { display: none; }
.pane-gacha { flex: 1; min-width: 0; padding: 24px 28px; display: none; flex-direction: column; gap: 16px; overflow-y: auto; }
#panes[data-mid="gacha"] .pane-desk { display: none; }
#panes[data-mid="gacha"] .pane-gacha { display: flex; }
.gacha-main { display: flex; align-items: center; gap: 24px; padding: 18px 20px; border-radius: 18px; background: var(--card); border: 2px solid var(--line); }
.gacha-machine { width: 170px; flex-shrink: 0; aspect-ratio: 200 / 250; }
.gacha-machine svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gacha-machine .gm-knob { transform-origin: 100px 177px; transform-box: view-box; }
.gacha-machine .gm-balls { transform-origin: 100px 84px; transform-box: view-box; }
.gacha-machine.turning .gm-knob { animation: gm-knob .8s cubic-bezier(.4,.1,.3,1); }
.gacha-machine.turning .gm-balls { animation: gm-shake .8s ease-in-out; }
@keyframes gm-knob { to { transform: rotate(360deg); } }
@keyframes gm-shake { 0%, 100% { transform: none; } 20% { transform: rotate(-8deg) translateY(-3px); } 45% { transform: rotate(7deg); } 70% { transform: rotate(-4deg) translateY(-2px); } }
.gacha-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.gacha-tickets { display: flex; align-items: center; gap: 8px; font-family: var(--font-jp); font-weight: 700; font-size: 14px; }
.gacha-tickets svg { width: 30px; height: 22px; }
.gacha-tickets b { margin-left: auto; font-family: var(--font-num); font-weight: 900; font-size: 30px; }
.gacha-tickets b.got { animation: ticket-got .6s ease-out; }
@keyframes ticket-got { 0% { transform: scale(1); } 30% { transform: scale(1.3); color: var(--eraser-pink); } 100% { transform: scale(1); } }
.pane-gacha .btn-roll { min-height: 64px; }
.pane-gacha .btn-roll b { font-size: 22px; }
.gacha-result { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--paper); border: 2px dashed var(--line); animation: gr-in .35s ease-out; }
.gacha-result.new { border-color: var(--eraser-pink); border-style: solid; }
.gr-pic { width: 48px; height: 48px; flex-shrink: 0; }
.gr-pic .kpic, .gm-h .kpic { width: 100%; height: 100%; }
.gr-text { display: flex; flex-direction: column; min-width: 0; font-family: var(--font-jp); }
.gr-text b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-text small { font-size: 12px; font-weight: 700; color: var(--graphite); }
@keyframes gr-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.gacha-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gcard { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); min-width: 0; }
.gcard-wide { grid-column: 1 / -1; }
.gcard-label { font-family: var(--font-jp); font-weight: 700; font-size: 12px; color: var(--graphite); }
.gcard-val { font-family: var(--font-jp); font-weight: 900; font-size: 17px; }
.gcard-note { font-family: var(--font-jp); font-weight: 700; font-size: 11px; color: var(--graphite); }
.gcard .bar { width: 100%; max-width: none; }
.gcard .btn-small { align-self: flex-start; min-height: 32px; padding: 4px 12px; font-size: 13px; }
.pips { display: flex; gap: 4px; }
.pips i { flex: 1; height: 10px; border-radius: 999px; background: var(--line); }
.pips i.on { background: var(--graphite); }
.pips i.last { background: var(--gold); }
.pips-stamp i { height: auto; aspect-ratio: 1; max-width: 14px; border-radius: 50%; flex: 1 1 0; }
.pips-stamp i.on { background: var(--eraser-pink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.gm-colors { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.gm-color { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-jp); font-weight: 700; font-size: 13px; }
.gm-rates { display: flex; flex-direction: column; gap: 6px; }
.gm-rate { display: flex; align-items: center; gap: 10px; }
.gm-rate .badge { flex-shrink: 0; min-width: 72px; text-align: center; }
.gm-rate-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.gm-rate-bar i { display: block; height: 100%; background: var(--blue, #3E6FB0); border-radius: 999px; }
.gm-rate b { width: 42px; text-align: right; font-family: var(--font-num); font-weight: 900; font-size: 14px; }
.gacha-history { display: flex; flex-direction: column; gap: 8px; }
.gm-history { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.gm-h { position: relative; aspect-ratio: 1; padding: 6px; border-radius: 12px; background: var(--card); border: 2px solid var(--line); }
.gm-h.new { border-color: var(--eraser-pink); }
.gm-h .badge { position: absolute; top: -8px; right: -6px; font-size: 9px; padding: 1px 5px; }
.gm-empty { grid-column: 1 / -1; font-family: var(--font-jp); font-weight: 700; font-size: 13px; color: var(--graphite); }
@media (max-width: 900px) {
  .mid-switch { display: none; }
  .pane-gacha { padding-top: 12px; gap: 12px; }
  .gacha-main { padding: 14px; gap: 14px; }
  .gacha-machine { width: 120px; }
  .gacha-tickets b { font-size: 24px; }
  .gacha-cards { gap: 8px; }
  .gcard { padding: 10px 12px; }
  .gm-history { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tabs button { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .gacha-machine.turning .gm-knob, .gacha-machine.turning .gm-balls { animation: none; }
}

/* ひきだし（js/drawer.js） */
.drawer-btn { margin-left: auto; position: relative; align-self: center; }
.drawer-btn svg { width: 18px; height: 18px; }
.drawer-badge { position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--eraser-pink); color: #2B2A28; border: 2px solid var(--ink); font: 900 11px/16px var(--font-num); text-align: center; }
.drawer-badge[hidden] { display: none; }
.dw-lead { font-family: var(--font-jp); font-weight: 700; font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; }
.dw-top { background: var(--desk-grain); border: 2px solid var(--ink); border-radius: 16px; padding: 12px 12px 14px; margin-top: 10px; box-shadow: inset 0 -6px 0 rgba(0,0,0,.08); }
.dw-handle { width: 64px; height: 10px; border-radius: 6px; background: var(--ink); margin: 0 auto 10px; opacity: .85; }
.dw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dw-slot { background: var(--paper-2); border: 2px solid var(--ink); border-radius: 12px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; text-align: center; color: var(--ink); }
.dw-slot .bar { width: 100%; max-width: none; height: 6px; flex: 0 0 6px; margin-top: 4px; }
.dw-pot { width: 52px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: var(--paper-3); border: 1.5px dashed var(--line-2); font: 900 20px var(--font-num); color: var(--muted); }
.dw-name { font-family: var(--font-jp); font-weight: 900; font-size: 12px; overflow-wrap: anywhere; }
.dw-state { font-family: var(--font-jp); font-weight: 700; font-size: 11px; color: var(--graphite); font-variant-numeric: tabular-nums; }
.dw-slot.ready { background: var(--gold-soft); border-color: var(--gold-deep); color: #2B2A28; }
.dw-slot.ready .dw-state { color: var(--gold-deep); }
.dw-slot.empty, .dw-slot.lock { border-style: dashed; border-color: var(--line-2); background: var(--paper-3); }
.dw-slot.lock { opacity: .8; }
.dw-slot.sel { border-style: solid; border-color: var(--eraser-blue); box-shadow: 0 0 0 2px var(--eraser-blue); }
.dw-slot .btn { min-height: 30px; padding: 2px 12px; font-size: 12px; margin-top: 2px; }
.dw-h2 { font-family: var(--font-jp); font-weight: 900; font-size: 15px; margin: 18px 0 0; }
.dw-steps { margin: 8px 0 0; padding-left: 1.4em; font-family: var(--font-jp); font-weight: 700; font-size: 13px; color: var(--ink); display: grid; gap: 2px; }
.dw-slot.next { border-color: var(--eraser-blue); border-style: dashed; }
.dw-slot.next .dw-state { color: var(--eraser-blue); }
.dw-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 8px; margin-top: 8px; }
.dw-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--card); border: 2px solid var(--line); min-width: 0; }
.dw-card.dw-no { opacity: .75; }
.dw-mini { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: #F3EDE1; }
.dw-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-family: var(--font-jp); }
.dw-card-text b { font-weight: 900; font-size: 14px; }
.dw-card-text b small { margin-left: 8px; font-family: var(--font-num); font-weight: 800; font-size: 12px; color: var(--graphite); }
.dw-got { font-weight: 700; font-size: 12px; color: var(--ink-soft); }
.dw-why { font-weight: 700; font-size: 11px; color: var(--danger); }
.dw-card-buy { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dw-price { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-num); font-weight: 800; font-size: 12px; font-variant-numeric: tabular-nums; }
.dw-card.dw-in { background: #F3EDE1; border-style: dashed; }
.dw-in-tag { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 999px; background: #E3EED9; color: #3F6B2E; font-family: var(--font-jp); font-weight: 800; font-size: 12px; white-space: nowrap; }
.dw-card .btn { min-height: 32px; padding: 2px 14px; font-size: 13px; white-space: nowrap; }

/* じっせき: よるの つくえでも 絵が 見えるように */
:root[data-theme="dark"] .ach.t1, :root[data-theme="dark"] .ach.t2 { background: #F6F1E7; color: #2B2A28; }
:root[data-theme="dark"] .ach.t3 { color: #2B2A28; }
:root[data-theme="dark"] .ach.no > * { filter: grayscale(1) invert(1); opacity: .4; }

/* ずかん: カス / 消しゴム の きりかえと 消しゴムの ページ */
.zukan-tabs { align-self: flex-start; margin-bottom: 12px; }
.zukan-tabs button { padding: 6px 16px; font-weight: 700; }
.er-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.er-card { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1.5px solid var(--line); border-radius: var(--r-m); background: var(--paper-2); min-width: 0; }
.er-card.max { border-color: var(--gold); background: var(--gold-soft); }
.er-pic { position: relative; flex: none; width: 112px; aspect-ratio: 220 / 124; max-width: 100%; padding: 6px; border-radius: var(--r-s); background: var(--desk); }
.er-pic svg { display: block; width: 100%; height: 100%; }
.er-card.locked .er-pic svg { filter: brightness(0) opacity(.18); }
.er-seal { position: absolute; right: -8px; top: -10px; width: 30px !important; height: 30px !important; }
.er-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; font-size: 13px; }
.er-body h3 { margin: 0; font-size: 15px; }
.er-stars { color: var(--gold); letter-spacing: 1px; white-space: nowrap; font-size: 14px; }
.er-stars i { font-style: normal; color: var(--line-2); }
.er-line { margin: 0; color: var(--graphite); font-size: 12px; }
.er-eff { margin: 0; }
.er-next { margin: 0; font-weight: 700; color: var(--gold-deep); }
.er-bar { height: 6px; border-radius: 9px; background: var(--line); overflow: hidden; }
.er-bar span { display: block; height: 100%; background: var(--gold); }
.er-note { margin: 0; color: var(--muted); font-size: 12px; }
:root[data-theme="dark"] .dw-why { color: #EC9893; }

/* CrazyGames 版の リワード広告（js/ads.js） */
.actions .btn-ad { flex: 0 0 auto; min-width: 0; }
.actions .btn-ad:disabled { opacity: .6; font-variant-numeric: tabular-nums; }
.ad-choice { display: flex; flex-direction: column; gap: 10px; align-self: stretch; }
.ad-choice .btn { width: 100%; justify-content: center; }
.ad-choice .btn svg { width: 22px; height: 22px; }
.ad-note { font-size: 12px; color: var(--graphite); margin: 0; }
.ad-playing body::after { content: ''; position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.35); }
.ad-playing #app { pointer-events: none; }

/* ことばの えらびかた */
.lang-select {
  font: inherit; font-weight: 700; font-size: 14px; color: var(--ink);
  padding: 8px 32px 8px 12px; border-radius: var(--r-m); border: 2px solid var(--ink); background-color: var(--card);
  -webkit-appearance: none; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}

/* 見ていない あいだに 来て 待っている 消しゴム（つくえの 右上） */

/* おんりょうの つまみ */
.vol-range { width: min(180px, 46%); height: 28px; accent-color: var(--eraser-blue); cursor: pointer; }
