/* とんとん ぐつぐつ キッチン — 見た目。ライト=ひるの キッチン・ダーク=よるの キッチン。外部フォントは使わない */
:root {
  --bg: #fff1dc;
  --ink: #2b2433;
  --sub: #6b6177;
  --card: #ffffff;
  --card-sh: #e2cba5;
  --stage: #f7e4c6;
  --tile: #efd3a8;
  --gold: #ffc53d;
  --ok: #2f9e44;
  --focus: #2f7cf6;
  --wood: #d9a35f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #211c1a;
    --ink: #f3eefc;
    --sub: #c4b8ab;
    --card: #3a302b;
    --card-sh: #120f0d;
    --stage: #3a312b;
    --tile: #332a25;
    --focus: #ffc53d;
    --wood: #6b4a2b;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); }
body { background: radial-gradient(rgba(255, 146, 43, .14) 2.2px, transparent 2.8px) 0 0 / 26px 26px, radial-gradient(120% 70% at 50% 0, #fffaf1, var(--bg) 70%); }
@media (prefers-color-scheme: dark) { body { background: radial-gradient(rgba(255, 197, 61, .07) 2.2px, transparent 2.8px) 0 0 / 26px 26px, var(--bg); } }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
body {
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "BIZ UDPGothic", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior: none;
  overflow: hidden;
}
/* 画面の下 15% には押すものを置かない(手首が当たる)。そこは キッチンの だいの かざり */
body::after {
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: calc(15vh - 6px); z-index: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 90px), var(--wood);
  border-top: 5px solid rgba(43, 36, 51, .25);
}
#app {
  position: fixed; inset: 0; z-index: 1;
  display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) calc(env(safe-area-inset-right) + 10px) 15vh calc(env(safe-area-inset-left) + 10px);
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible, .stage:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
svg { display: block; overflow: visible; }

/* ---- うえ ---- */
.top { display: flex; align-items: center; gap: 8px; min-height: 56px; }
.hbtn { position: relative; flex-shrink: 0; width: 56px; height: 56px; border-radius: 16px; background: var(--card); box-shadow: 0 4px 0 var(--card-sh); display: grid; place-items: center; }
.hbtn svg { width: 32px; height: 32px; }
.hbtn:active { transform: translateY(3px); }
.home .q { position: absolute; right: -6px; top: -8px; width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: #2b2433; font-size: 18px; line-height: 26px; display: none; }
.home.ask { background: var(--gold); color: #2b2433; animation: wob .35s ease-in-out 2; }
.home.ask .q { display: block; }
@keyframes wob { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
.spk { fill: currentColor; }
.wave, .slash { fill: none; stroke: currentColor; stroke-width: 3.5; stroke-linecap: round; }
.snd.off .wave, .snd:not(.off) .slash { display: none; }
.logo { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; margin: 0; min-width: 0; font-size: clamp(18px, 5vw, 26px); font-weight: 900; white-space: nowrap; }
.logo img { width: 40px; height: 40px; flex-shrink: 0; }
.dots { flex: 1 1 auto; display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--card-sh); transition: transform .2s; }
.dots i.done { background: var(--ok); }
.dots i.on { background: var(--gold); transform: scale(1.5); box-shadow: 0 0 0 2px var(--ink); }
body[data-screen="menu"] .home, body[data-screen="menu"] .dots { display: none; }
body:not([data-screen="menu"]) .logo { display: none; }

/* ---- メニュー ---- */
.menu { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; min-height: 0; }
.mt { margin: 0; text-align: center; font-size: clamp(18px, 5vw, 28px); font-weight: 900; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 10px; min-height: 0; width: min(100%, 720px); justify-self: center; }
.card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; min-width: 64px; padding: 6px;
  border-radius: 22px; box-shadow: 0 5px 0 var(--card-sh); border: 3px solid var(--ink);
  background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .28) 0 9px, transparent 9px 18px), var(--cbg, var(--card));
}
.card:nth-child(odd) { transform: rotate(-1.2deg); }
.card:nth-child(even) { transform: rotate(1.2deg); }
.card[data-k="pasta"] { --cbg: #ffd9b8; }
.card[data-k="curry"] { --cbg: #ffeaa0; }
.card[data-k="pizza"] { --cbg: #ffc9c9; }
.card[data-k="pancake"] { --cbg: #ffd8ec; }
.card[data-k="omurice"] { --cbg: #c9f0d6; }
.card[data-k="hamburg"] { --cbg: #ecd2b8; }
.card[data-k="takoyaki"] { --cbg: #d6ecb8; }
.card[data-k="cake"] { --cbg: #e2d4ff; }
.card[data-k="kakigori"] { --cbg: #c8e8ff; }
@media (prefers-color-scheme: dark) {
  .card[data-k="pasta"] { --cbg: #5c3c25; }
  .card[data-k="curry"] { --cbg: #574a1c; }
  .card[data-k="pizza"] { --cbg: #5c2b2b; }
  .card[data-k="pancake"] { --cbg: #573049; }
  .card[data-k="omurice"] { --cbg: #214a37; }
  .card[data-k="hamburg"] { --cbg: #4d3524; }
  .card[data-k="takoyaki"] { --cbg: #34481f; }
  .card[data-k="cake"] { --cbg: #3d3260; }
  .card[data-k="kakigori"] { --cbg: #1f3f5c; }
  .card { background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .07) 0 9px, transparent 9px 18px), var(--cbg, var(--card)); }
}
.card:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--card-sh); }
.card .th { flex: 1 1 0; min-height: 0; width: 100%; position: relative; }
.card .th svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.card .nm { font-weight: 900; font-size: clamp(11px, min(3.6vw, 4vh), 20px); white-space: nowrap; background: #fff; color: #2b2433; border: 2px solid #2b2433; border-radius: 999px; padding: 1px clamp(3px, 1.6vw, 12px); max-width: 100%; box-sizing: border-box; margin-bottom: 2px; }
.mt { letter-spacing: .04em; }
.mt::before, .mt::after { content: "♪"; color: #ff922b; margin: 0 .35em; font-size: .8em; }
.album { display: grid; gap: 4px; justify-items: center; justify-content: center; }
.at { margin: 0; font-size: 14px; font-weight: 800; color: var(--sub); }
.alist { display: grid; grid-template-columns: repeat(auto-fill, 64px); gap: 8px; min-height: 64px; align-items: center; justify-content: center; width: min(100vw - 24px, 424px); }
.alist .none { grid-column: 1 / -1; justify-self: center; }
.alist .none { color: var(--sub); font-size: 13px; border: 2px dashed var(--card-sh); border-radius: 14px; padding: 18px 16px; white-space: nowrap; }
.alb { width: 64px; height: 64px; border-radius: 16px; background: var(--card); box-shadow: 0 3px 0 var(--card-sh); padding: 2px; }
.alb svg { width: 100%; height: 100%; }

/* ---- つくる ---- */
.cook { display: grid; grid-template-rows: minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); gap: 8px; min-height: 0; }
.stage {
  position: relative; min-height: 0; border: 3px solid var(--ink); border-radius: 22px; overflow: hidden; touch-action: none; box-shadow: 0 5px 0 var(--card-sh);
  background:
    linear-gradient(45deg, var(--tile) 25%, transparent 25% 75%, var(--tile) 75%) 0 0 / 44px 44px,
    linear-gradient(45deg, var(--tile) 25%, transparent 25% 75%, var(--tile) 75%) 22px 22px / 44px 44px,
    var(--stage);
}
#sv { position: absolute; inset: 0; width: 100%; height: 100%; }
.say {
  position: absolute; left: 8px; top: 8px; max-width: calc(100% - 16px); margin: 0; padding: 6px 12px; border-radius: 16px; z-index: 3; pointer-events: none;
  background: #fff; color: #2b2433; border: 3px solid #2b2433; font-size: clamp(14px, 3.9vw, 20px); font-weight: 900; box-shadow: 0 3px 0 rgba(43, 36, 51, .2);
}
.tray { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; width: min(100%, 560px); }
.opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 72px; min-width: 64px; padding: 4px 2px;
  border-radius: 16px; background: var(--card); box-shadow: 0 4px 0 var(--card-sh); border: 3px solid transparent;
}
.opt .ic { width: 44px; height: 44px; flex-shrink: 0; padding: 2px; border-radius: 12px; background: radial-gradient(circle at 40% 35%, #ffffff, #fff0da); box-shadow: inset 0 -2px 0 rgba(43, 36, 51, .08); }
.opt .ic svg { width: 100%; height: 100%; }
.opt .lb { font-size: 11px; font-weight: 800; line-height: 1.2; white-space: nowrap; max-width: 100%; overflow: hidden; }
.opt[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 4px 0 var(--card-sh), 0 0 0 3px var(--gold); background: #fff8e1; color: #2b2433; }
.opt:active, .act:active { transform: translateY(3px); }
.acts { display: flex; gap: 10px; justify-content: center; width: min(100%, 560px); }
.act {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 104px; min-height: 64px; padding: 0 14px;
  border-radius: 18px; background: var(--card); box-shadow: 0 4px 0 var(--card-sh); font-weight: 900; font-size: 16px;
}
.act .ic { width: 32px; height: 32px; flex-shrink: 0; }
.act .ic svg { width: 100%; height: 100%; }
.act.ok { background: var(--ok); color: #fff; box-shadow: 0 4px 0 #1b6b2c; flex: 1 1 auto; max-width: 240px; }
.nudge { animation: nudge .6s ease-in-out 3; }
@keyframes nudge { 50% { transform: scale(1.12); } }

/* ---- てほん(やじるし・ゆび)。がめん ぜんたいの うえに かく ---- */
.guide { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 15; overflow: visible; }
.g-line { fill: none; stroke: #2b2433; stroke-width: 15; stroke-linecap: round; stroke-linejoin: round; opacity: .45; }
.g-dash { fill: none; stroke: #ffd43b; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 16 12; animation: march .7s linear infinite; }
.g-head { fill: #ffd43b; stroke: #2b2433; stroke-width: 3; stroke-linejoin: round; }
.g-ring { fill: none; stroke: #ffd43b; stroke-width: 7; transform-box: fill-box; transform-origin: center; animation: ring 1s ease-out infinite; }
.g-ring.g-hold { animation: ringHold 1.6s ease-in-out infinite; }
@keyframes march { to { stroke-dashoffset: -28; } }
@keyframes ring { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@keyframes ringHold { 0% { transform: scale(.4); opacity: .4; } 80% { transform: scale(1.6); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.hand { position: fixed; left: 0; top: 0; width: 48px; height: 58px; pointer-events: none; opacity: 0; z-index: 16; margin: -4px 0 0 -18px; }
.hand svg { width: 100%; height: 100%; }
.hand.on { opacity: 1; }
/* トレイから ひっぱって いる もの */
.ghost { position: fixed; left: 0; top: 0; width: 66px; height: 66px; margin: -33px 0 0 -33px; pointer-events: none; z-index: 20; filter: drop-shadow(0 6px 4px rgba(0, 0, 0, .3)); }
.ghost svg { width: 100%; height: 100%; }
.opt.drag { touch-action: none; }
.opt.lift { opacity: .45; }
.opt.used { opacity: .3; pointer-events: none; box-shadow: none; }

/* ---- えんしゅつ(transform と opacity だけ) ---- */
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.fx i { position: absolute; left: 0; top: 0; display: block; width: 12px; height: 12px; }
.fx .sp { width: 18px; height: 18px; margin: -9px 0 0 -9px; background: #ffd43b; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.fx .cf { width: 10px; height: 14px; border-radius: 2px; }
.fx .ht { width: auto; height: auto; margin: -16px 0 0 -10px; color: #ff6b8a; font-size: 28px; font-weight: 900; line-height: 1; text-shadow: 0 0 2px #fff; }
.bgdim { fill: #000; opacity: 0; }
@media (prefers-color-scheme: dark) { .bgdim { opacity: .22; } }
#scene .fb { transform-box: fill-box; transform-origin: center; }
#scene .pop { transform-box: fill-box; transform-origin: center; animation: pop .28s ease-out; }
@keyframes pop { from { transform: scale(.2); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } }
#scene .bub { transform-box: fill-box; transform-origin: center; animation: bub 1.1s ease-in-out infinite; }
@keyframes bub { 0%, 100% { transform: scale(.3); opacity: 0; } 50% { transform: scale(1); opacity: .9; } }
#scene .drop { animation: drop .35s ease-in; }
@keyframes drop { from { transform: translateY(-120px); opacity: 0; } to { transform: none; opacity: 1; } }
#scene .fall { animation: fall .8s ease-in forwards; }
@keyframes fall { to { transform: translateY(70px); opacity: 0; } }
#scene .steam { animation: steam 1.6s ease-in-out infinite; }
@keyframes steam { 0% { transform: translateY(8px); opacity: 0; } 50% { opacity: .8; } 100% { transform: translateY(-14px); opacity: 0; } }
#scene .stm .steam { opacity: 0; animation: steam2 2.4s ease-out infinite; }
#scene .stm .s1 { animation-delay: .8s; }
#scene .stm .s2 { animation-delay: 1.6s; }
#scene .snow { opacity: 0; transition: opacity .2s; }
#scene .snow.on { opacity: 1; }
#scene .snow .sn { animation: snow 0.9s linear infinite; }
#scene .snow .s1 { animation-delay: .3s; }
#scene .snow .s2 { animation-delay: .6s; }
@keyframes snow { from { transform: translateY(0); opacity: 1; } to { transform: translateY(80px); opacity: 0; } }
#scene .flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flame .5s ease-in-out infinite alternate; }
@keyframes flame { to { transform: scale(.85, 1.1); } }
@keyframes steam2 { 0% { transform: translateY(10px); opacity: 0; } 35% { opacity: .75; } 100% { transform: translateY(-40px); opacity: 0; } }

/* ---- つくった りょうりを みる ---- */
.view { position: fixed; inset: 0; z-index: 10; background: rgba(33, 28, 26, .55); display: grid; place-items: center; padding: 16px 16px 15vh; }
.vcard { display: grid; gap: 12px; justify-items: center; background: var(--card); border: 3px solid var(--ink); border-radius: 26px; padding: 14px; width: min(100%, 420px); max-height: 100%; }
.vdish { width: min(78vw, 52vh, 360px); aspect-ratio: 1; }
.vdish svg { width: 100%; height: 100%; }

/* スマホを よこに した とき: えらぶ ところを みぎに */
@media (orientation: landscape) and (max-height: 600px) {
  .top { min-height: 50px; }
  .hbtn { width: 50px; height: 50px; }
  .logo img { width: 34px; height: 34px; }
  .mt { display: none; }
  .menu { grid-template-rows: minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
  .cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .album { grid-auto-flow: column; align-items: center; gap: 10px; }
  .cook { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) auto; }
  .tray { display: grid; grid-template-columns: repeat(4, 64px); grid-auto-rows: 64px; gap: 6px; align-content: center; justify-content: center; }
  .opts, .acts { display: contents; }
  .opt { min-height: 64px; }
  .opt .lb { display: none; }
  .act { min-width: 64px; padding: 0; }
  .act .lb { display: none; }
  .act.ok { max-width: none; }
  .vdish { width: min(40vw, 46vh); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hand.on { opacity: 1; }
  .g-dash { stroke-dasharray: none; }
}
