/* pixel.css — ドット絵テーマ。app.css の上に重ねて、見た目だけを変える(機能のための指定は app.css のまま)。
   生成りの方眼紙の地、焦げ茶の太い枠とずらした影、ドット文字の見出し。調合結果の欄は研究ノート風。
   OSのダークモードでは、夜の台所に合わせた焦げ茶の配色にする。
   --ink は文字の色、--frame は枠と影の色、--night は暗い帯(ヘッダーなど)、--paper はその上の文字。 */
:root {
  --bg: #FBF4E6; --surface: #FFFDF7; --surface-2: #F3E6CC; --ink: #2B1A0E; --muted: #6B5444; --line: #D9C7A6;
  --accent: #A0502C; --accent-ink: #FFFDF7; --saffron: #B47E26; --chai: #C07E46; --warn: #B4381F;
  --brass: #DCA43E; --brass-hi: #FFF1C4; --rule: #E3D3B8; --margin: #E9A08C;
  --frame: #2B1A0E; --night: #2B1A0E; --paper: #FFFDF7; --on-brass: #2B1A0E; --sel-bg: #2B1A0E; --sel-fg: #FFFDF7; --shade: rgba(43, 26, 14, .25);
  --font-display: "DotGothic16", "Zen Kaku Gothic New", sans-serif;
  --radius: 0; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1C130C; --surface: #2A1D13; --surface-2: #3A2A1C; --ink: #F3E6CC; --muted: #C2AB8C; --line: #54402C;
    --accent: #E8A07A; --accent-ink: #1C130C; --saffron: #E6AE45; --chai: #D49A62; --warn: #F08A5D;
    --brass: #DCA43E; --brass-hi: #4D3A18; --rule: #251A11; --margin: #7A3F33;
    --frame: #0D0805; --night: #120C07; --paper: #FFF3D6; --on-brass: #2B1A0E; --sel-bg: #DCA43E; --sel-fg: #2B1A0E; --shade: rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #1C130C; --surface: #2A1D13; --surface-2: #3A2A1C; --ink: #F3E6CC; --muted: #C2AB8C; --line: #54402C;
    --accent: #E8A07A; --accent-ink: #1C130C; --saffron: #E6AE45; --chai: #D49A62; --warn: #F08A5D;
    --brass: #DCA43E; --brass-hi: #4D3A18; --rule: #251A11; --margin: #7A3F33;
    --frame: #0D0805; --night: #120C07; --paper: #FFF3D6; --on-brass: #2B1A0E; --sel-bg: #DCA43E; --sel-fg: #2B1A0E; --shade: rgba(0, 0, 0, .45);
    color-scheme: dark;
}
img.px, canvas.px { image-rendering: pixelated; image-rendering: crisp-edges; }
body { background-color: var(--bg); background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px); background-size: 24px 24px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

/* ヘッダーとタブ */
header.top { background: var(--night); color: var(--paper); border-bottom: 4px solid var(--brass); }
.brand h1 { font-size: 26px; letter-spacing: 1px; }
.brand small { color: #D9C7A6; }
nav.tabs { background: transparent; padding: 0; border-radius: 0; gap: 6px; }
nav.tabs a { font-family: var(--font-display); font-weight: 400; font-size: 15px; color: var(--paper); border: 2px solid #6B5444; border-radius: 0; padding: 8px 14px; min-height: 44px; display: inline-flex; align-items: center; }
nav.tabs a:hover { border-color: var(--brass); }
nav.tabs a[aria-current="page"] { background: var(--brass); color: var(--on-brass); border-color: var(--brass); box-shadow: none; }

/* 枠 */
.panel, .card, .basecard { background: var(--surface); border: 3px solid var(--frame); border-radius: 0; box-shadow: 4px 4px 0 var(--frame); }
.panel h2 { font-size: 18px; }
.panel h2 span { font-family: var(--font-body); }
.empty { border: 2px dashed var(--line); border-radius: 0; }

/* ボタン類 */
.btn { background: var(--brass); color: var(--on-brass); border: 3px solid var(--frame); border-radius: 0; box-shadow: 3px 3px 0 var(--frame); font-family: var(--font-display); font-weight: 400; font-size: 16px; min-height: 44px; }
.btn:hover { filter: none; background: #EEC25E; }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--frame); }
.btn.ghost, .btn.danger { background: var(--surface); border: 3px solid var(--frame); }
.btn.danger { color: var(--warn); }
.btn.danger.armed { background: var(--warn); color: #fff; border-color: var(--frame); }
.btn.small { min-height: 36px; font-size: 14px; }
.btn.big { font-size: 20px; padding: 14px 36px; }
.chip, .seg button, .linkbtn.chipish { border: 2px solid var(--frame); border-radius: 0; background: var(--surface); min-height: 36px; }
.chip:hover { border-color: var(--accent); background: var(--brass-hi); }
.chip[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--sel-bg); color: var(--sel-fg); border-color: var(--frame); }
.seg button .st { color: var(--accent); }
.shelfq, .save input, .tools input, .logform textarea { border: 2px solid var(--frame); border-radius: 0; background: var(--surface); }
.pill { border-radius: 0; border: 1px solid var(--frame); background: var(--surface); color: var(--ink); }
.pill.ok { background: #8DB05E; color: var(--ink); }
.tag { border-radius: 0; background: var(--brass-hi); color: var(--ink); border: 1px solid var(--brass); }
.x { border-radius: 0; }

/* スパイス棚 */
.tile { border: 2px solid var(--line); border-radius: 0; background: var(--surface); padding: 6px 2px 6px; }
.tile:hover { border-color: var(--frame); transform: none; background: var(--brass-hi); }
.tile[aria-pressed="true"] { border-color: var(--frame); box-shadow: 3px 3px 0 var(--frame); background: var(--brass-hi); }
.tile .badge { border-radius: 0; background: var(--accent); width: 8px; height: 8px; }
.tile.mine::after { border-radius: 0; background: #8DB05E; }
.group-name { font-family: var(--font-display); font-weight: 400; font-size: 14px; color: var(--ink); border-bottom: 2px solid var(--frame); padding-bottom: 2px; }

/* 鍋のステージ:大きく見せる */
.stage { background: var(--surface); padding: 12px; }
.stage canvas.pot { width: 100%; height: auto; aspect-ratio: 5 / 3; display: block; border: 3px solid var(--frame); background: #E6F1EE; }
.stage .title { order: 2; text-align: left; margin-top: 12px; background: var(--night); color: var(--paper); padding: 12px 16px; outline: 2px solid var(--paper); outline-offset: -7px; }
.stage .title h2 { font-size: 22px; color: var(--paper); }
.stage .title p { color: #E3D3B8; }
.stage { display: flex; flex-direction: column; }
.loaded { background: var(--brass); color: var(--on-brass); border-radius: 0; }

/* 研究ノート風:味のバランス・作り方・ひとこと */
.panel:has(#flavor), .panel:has(#recipe), .panel:has(#notes) {
  position: relative; padding-left: 48px;
  background-color: var(--surface);
  background-image: linear-gradient(90deg, transparent 33px, var(--margin) 33px, var(--margin) 35px, transparent 35px), repeating-linear-gradient(var(--surface) 0 27px, var(--rule) 27px 28px);
  background-position: 0 0, 0 14px;
}
.panel:has(#flavor) h2::before, .panel:has(#recipe) h2::before, .panel:has(#notes) h2::before { content: "研究ノート"; display: block; width: 100%; font-family: var(--font-body); font-size: 11px; color: var(--accent); letter-spacing: 1px; }
.bar .track { position: relative; height: 14px; border-radius: 0; background: #E8DCC6; border: 2px solid var(--frame); }
.bar .fill { border-radius: 0; }
.bar .track::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 9px, #E8DCC6 9px 11px); pointer-events: none; }
.bar .v { color: var(--ink); font-family: var(--font-display); }
ol.recipe li::marker { font-family: var(--font-display); color: var(--accent); }
.notes li { background: transparent; border-left: 4px solid var(--brass); border-radius: 0; }
.notes li.warn { border-left-color: var(--warn); background: #FCE9E0; }

/* 鍋の中のリスト・買い物リスト */
.potlist li, .shoplist li { border: 2px solid var(--line); border-radius: 0; background: var(--surface); }
.potlist li:hover { border-color: var(--frame); }
.mini { border-radius: 0; background: #E8DCC6; height: 8px; }
.mini i { background: var(--brass); }

/* スパイスの詳細・辞典 */
.dhead img { flex: none; background: var(--surface-2); border: 3px solid var(--frame); padding: 4px; box-sizing: content-box; }
.dhead.big { flex-direction: column; align-items: flex-start; }
.dhead.big img { padding: 10px; background-color: #E6F1EE; background-image: linear-gradient(#C9DDD8 2px, transparent 2px), linear-gradient(90deg, #C9DDD8 2px, transparent 2px); background-size: 32px 32px; }
.dhead h2 { font-size: 24px; }
dl.facts dt { font-family: var(--font-display); font-weight: 400; font-size: 14px; color: var(--accent); border-bottom: 1px dashed var(--line); }
.dots i { border-radius: 0; width: 14px; height: 10px; background: #E8DCC6; }
.dots i.on { background: var(--brass); box-shadow: inset 0 -2px 0 #9C6A1E; }
.card .tip { border-radius: 0; background: var(--surface-2); border-left: 4px solid var(--brass); }
.swatch { border-radius: 0; border: 2px solid var(--frame); }
.icons img { background: var(--surface-2); border: 2px solid var(--frame); }

/* マイスパイス・図鑑 */
.dexbar { border-radius: 0; height: 14px; border: 2px solid var(--frame); background: #E8DCC6; }
.dexbar i { background: #8DB05E; background-image: repeating-linear-gradient(90deg, transparent 0 9px, #E8DCC6 9px 11px); }
.dexcell { border: 2px solid var(--frame); border-radius: 0; background: var(--surface); }
.dexcell:hover { background: var(--brass-hi); }
.dexcell.locked { border: 2px dashed var(--line); background: transparent; }
.dexcell.locked img { filter: brightness(0) opacity(.16); }
.dexcell.locked span { font-family: var(--font-display); }
.newdex { border-radius: 0; background: var(--brass-hi); color: var(--ink); border: 2px solid var(--brass); }

/* ガチャ:石臼 */
.machine { position: relative; padding: 8px 0; }
.mortar { width: 288px; height: 288px; max-width: 100%; aspect-ratio: 1; background: url(../img/mortar_anim.png) 0 0 / 800% 100% no-repeat; image-rendering: pixelated; }
.machine.spin .mortar { animation: grind .55s steps(8, jump-none) infinite; }
@keyframes grind { from { background-position: 0 0; } to { background-position: 100% 0; } }
.glint { position: absolute; inset: 0; pointer-events: none; }
.glint::before, .glint::after { content: "✦"; position: absolute; font-size: 26px; color: var(--brass); animation: twinkle 1.2s steps(2) infinite; }
.glint::before { left: 18%; top: 12%; } .glint::after { right: 16%; top: 30%; animation-delay: .6s; }
.glint.r1::before, .glint.r1::after { color: #8DB05E; } .glint.r2::before, .glint.r2::after { color: #3B6FD8; }
@keyframes twinkle { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .machine.spin .mortar, .glint::before, .glint::after { animation: none; } }
.gacha-card { border: 3px solid var(--frame); background: var(--surface); padding: 14px; box-shadow: 4px 4px 0 var(--frame); }
.gacha-card.r3 { box-shadow: 4px 4px 0 var(--brass); border-color: var(--frame); border-radius: 0; }
.rar.r2 { color: #2E5FC0; }

/* 重ねて出す画面 */
.overlay { background: rgba(43, 26, 14, .6); }
.sheet { border: 4px solid var(--frame); border-radius: 0; box-shadow: 6px 6px 0 var(--frame); }
.cook-progress i { border-radius: 0; height: 8px; }
.timer { border-radius: 0; border: 3px solid var(--frame); background: var(--surface-2); }
.timer .ring { border-radius: 0; }
.card-preview img { border-radius: 0; border: 3px solid var(--frame); }
.starpick button.on { color: var(--brass); }
.logform { border-radius: 0; border: 2px dashed var(--line); background: var(--surface); }

.foot { border-top: 3px solid var(--frame); background: var(--surface-2); }
.foot a { color: var(--accent); }
@media (max-width: 520px) { .sheet { border-width: 0; box-shadow: none; } }
.loaded[hidden] { display: none; }
.panel .gacha-card { border: 0; box-shadow: none; padding: 0; background: transparent; }
.panel .gacha-card.r3 { border: 3px solid var(--brass); padding: 12px; box-shadow: 4px 4px 0 var(--frame); }
.panel .gacha-card h2 { font-size: 26px; }
/* 共有コード */
.sharebox { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border: 3px dashed var(--frame); }
.sharebox .code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 15px; line-height: 1.5; word-break: break-all; background: var(--surface); border: 2px solid var(--frame); padding: 10px 12px; user-select: all; -webkit-user-select: all; }
.sharebox .hint { margin: 8px 0 0; }
.importer #codeIn { flex: 1; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 16px; min-height: 44px; padding: 0 12px; border: 2px solid var(--frame); border-radius: 0; background: var(--surface); }
.importer #codeIn[aria-invalid="true"] { border-color: var(--warn); }
.err { margin: 10px 0 0; padding: 10px 12px; border-left: 4px solid var(--warn); background: #FCE9E0; color: #8A2A12; font-weight: 700; }
.okmsg { margin: 10px 0 0; padding: 10px 12px; border-left: 4px solid #6E943E; background: #EEF5E0; color: #2E4A1C; font-weight: 700; }
.card.imported { margin-top: 14px; border-style: dashed; }
.card.imported #impName { width: 100%; min-height: 44px; font-size: 16px; padding: 0 10px; border: 2px solid var(--frame); border-radius: 0; background: var(--surface); }
.implist { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; }
.implist li { display: flex; gap: 10px; align-items: center; border: 2px solid var(--line); background: var(--surface); padding: 4px 8px; }
.implist li > span { display: flex; flex-direction: column; }
.importer .inrow { display: flex; gap: 8px; flex-wrap: wrap; }
.importer { margin-bottom: 18px; }
/* お手本レシピ:小さなカードを並べる */
ul.presets { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
ul.presets li { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.preset { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; min-height: 88px; padding: 8px 6px; background: var(--surface); border: 2px solid var(--frame); box-shadow: 3px 3px 0 var(--frame); cursor: pointer; font: inherit; color: var(--ink); text-align: center; }
.preset:hover { background: var(--brass-hi); }
.preset:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--frame); }
.preset[aria-pressed="true"] { background: var(--brass-hi); border-color: var(--frame); box-shadow: 3px 3px 0 var(--brass); }
.picons { display: flex; justify-content: center; min-height: 32px; }
.picons img { width: 32px; height: 32px; }
.picons img + img { margin-left: -10px; }
.picons .more { align-self: center; margin-left: 2px; font-size: 11px; color: var(--muted); }
.pname { font-size: 12px; line-height: 1.35; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pmeta { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.pmeta .pill, .pmeta .linkbtn { font-size: 11px; }
@media (max-width: 1080px) { ul.presets { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }
/* アイス向き/ホット向き */
.sicon { flex: none; image-rendering: pixelated; vertical-align: -4px; }
.stage .title .serve { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 8px 0 0; font-size: 13px; color: #E3D3B8; }
.stage .title .serve b { font-family: var(--font-display); font-weight: 400; font-size: 15px; padding: 1px 8px; border: 2px solid currentColor; }
.stage .title .serve[data-kind="ice"] b { color: #9FD8EE; }
.stage .title .serve[data-kind="hot"] b { color: #F2A27A; }
.stage .title .serve[data-kind="both"] b { color: #F2CF72; }
.notes li.serve-tip { display: flex; gap: 8px; align-items: flex-start; border-left-color: #5FA8C8; }
.notes li.serve-tip b { font-family: var(--font-display); font-weight: 400; }
.servetag, .pserve { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 1px 6px; border: 2px solid var(--frame); background: var(--surface); }
.servetag { margin-top: 4px; }
.servetag[data-kind="ice"], .pserve[data-kind="ice"] { background: #E2F3FA; }
.servetag[data-kind="hot"], .pserve[data-kind="hot"] { background: #FBE3D6; }
.servetag[data-kind="both"], .pserve[data-kind="both"] { background: var(--brass-hi); }
.pserve { font-size: 11px; padding: 0 4px; border-width: 1px; }
.stage .title .serve b { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.06); }
.stage .title .serve b .sicon { width: 20px; height: 20px; }

/* ===== スマホ向けの作り(720px以下) ===== */
.mtabs, .sheetx, .morebtn, .sheetback, nav.tabs .ts, nav.tabs .nicon { display: none; }
.row.sharemenu { justify-content: flex-start; margin-top: 10px; }
.row.sharemenu[hidden] { display: none; }
.servebtn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.stage .title .serve .servebtn b { cursor: pointer; }
.stage .title .serve .fold { display: none; }
nav.tabs .f { fill: #E2A868; }
nav.tabs a[aria-current="page"] .f { fill: #FFF3D6; }

@media (max-width: 1080px) {
  header.top { padding: 8px 14px; border-bottom-width: 3px; }
  .brand img { width: 32px; height: 32px; }
  .brand h1 { font-size: 20px; }
  .brand small { display: none; }
  main { padding: 12px 10px 24px; }

  /* 画面下のメニュー */
  nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; background: var(--night); border-top: 3px solid var(--brass); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  nav.tabs a { position: relative; flex-direction: column; justify-content: center; gap: 1px; min-height: 54px; padding: 2px 0; border: 0; font-size: 12px; line-height: 1.2; }
  nav.tabs a .tl { display: none; }
  nav.tabs a .ts, nav.tabs .nicon { display: block; }
  nav.tabs .nicon svg { display: block; image-rendering: pixelated; }
  #tab-saved[data-n]:not([data-n=""])::after { content: attr(data-n); position: absolute; top: 3px; left: calc(50% + 8px); min-width: 16px; padding: 0 3px; font-size: 10px; line-height: 16px; text-align: center; background: #C0663D; color: #FFF3D6; border: 1px solid var(--frame); }
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }

  /* 作る画面: 鍋を上に固定して、下をタブで切り替える */
  .make { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
  .make > .col > .panel { min-width: 0; }
  .make .col { display: contents; }
  .make > .col > .stage { order: 0; position: sticky; top: 0; z-index: 20; margin: -12px -10px 0; padding: 0; border-width: 0 0 3px; box-shadow: 0 3px 0 var(--shade); }
  .make [data-mtab] { display: none; order: 2; }
  .make [data-morder="1"] { order: 1; }
  .make [data-morder="3"] { order: 3; }
  .make[data-mtab="base"] [data-mtab="base"], .make[data-mtab="spice"] [data-mtab="spice"], .make[data-mtab="recipe"] [data-mtab="recipe"], .make[data-mtab="note"] [data-mtab="note"] { display: block; }
  .make > .col > .stage { background: var(--night); }
  .potwrap { width: fit-content; max-width: 100%; margin: 8px auto 8px; }
  .stage canvas.pot { width: auto; max-width: 100%; height: min(196px, 24vh); border: 2px solid var(--frame); outline: 2px solid #4A3626; }
  .stage .title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 0; padding: 8px 14px; outline: 0; border-top: 3px solid var(--brass); }
  .stage .title h2 { flex: 1 1 auto; font-size: 16px; line-height: 1.4; }
  .stage .title #potSub { display: none; }
  .stage .title .serve { margin: 0; }
  .stage .title .serve b { font-size: 13px; padding: 0 6px; }
  .stage .title .serve b .sicon { width: 16px; height: 16px; }
  .stage .title .serve > span { display: none; }
  .stage .title .loaded { flex-basis: 100%; font-size: 11px; }
  .stage .title { position: relative; }
  .stage .title .serve .fold { display: inline-flex; width: 18px; height: 18px; margin-left: 6px; font-size: 15px; border: 0; box-shadow: none; color: var(--ink); }
  .stage .title .serve[data-kind="ice"] .fold { background: #9FD8EE; }
  .stage .title .serve[data-kind="hot"] .fold { background: #F2A27A; }
  .stage .title .serve[data-kind="both"] .fold { background: #F2CF72; }
  .stage .title .serve.open > span { display: block; position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% + 6px); padding: 8px 12px; font-size: 13px; line-height: 1.6; color: var(--paper); background: var(--night); border: 2px solid currentColor; box-shadow: 3px 3px 0 rgba(43, 26, 14, .35); }
  .stage .title .serve[data-kind="ice"].open > span { border-color: #9FD8EE; }
  .stage .title .serve[data-kind="hot"].open > span { border-color: #F2A27A; }
  .stage .title .serve[data-kind="both"].open > span { border-color: #F2CF72; }

  .mtabs { order: 3; display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; border-top: 3px solid var(--frame); background: var(--surface-2); }
  .mtabs button { position: relative; min-height: 42px; padding: 0; border: 0; border-right: 2px solid var(--frame); background: transparent; color: var(--ink); font-family: var(--font-display); font-size: 15px; cursor: pointer; }
  .mtabs button:last-child { border-right: 0; }
  .mtabs button[aria-selected="true"] { background: var(--brass); color: var(--on-brass); }
  .mtabs .cnt:not(:empty) { display: inline-block; margin-left: 3px; min-width: 18px; padding: 0 3px; font-size: 11px; line-height: 16px; background: var(--frame); color: var(--paper); font-family: var(--font-body); vertical-align: 2px; }

  /* お手本は鍋の「お手本」ボタンから、下から出るパネルで選ぶ */
  .make > .col > .presetpanel.open { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; max-height: 82vh; overflow-y: auto; overscroll-behavior: contain; margin: 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); border-width: 3px 0 0; box-shadow: 0 -3px 0 var(--brass); }
  .presetpanel .sheetx { display: inline-flex; position: absolute; top: 8px; right: 10px; }
  .presetpanel h2 { padding-right: 40px; }
  .presetpanel .fold { display: none; }
  .presetpanel #presetBody[hidden] { display: block; }
  .presetpanel ul.presets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .potpreset { display: inline-flex; }

  /* スパイスの詳しい情報は、下から出るパネルに */
  .make > .detail { display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 45; max-height: 82vh; overflow-y: auto; overscroll-behavior: contain; margin: 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); border-width: 3px 0 0; box-shadow: 0 -3px 0 var(--brass); transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s; }
  .make > .detail.open { transform: none; visibility: visible; transition: transform .22s ease; }
  .detail::before { content: ""; order: 0; flex: none; width: 44px; height: 4px; margin: 0 auto 8px; background: var(--line); }
  .sheetback:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(43, 26, 14, .45); }
  .detail .sheetx { display: inline-flex; position: absolute; top: 8px; right: 10px; }
  .detail .dhead { order: 1; margin-bottom: 6px; padding-right: 40px; }
  .detail .dhead.big { flex-direction: row; align-items: center; }
  .detail .dhead.big img { width: 48px; height: 48px; padding: 4px; background-size: 16px 16px; }
  .detail .dhead h2 { font-size: 20px; }
  .detail .controls { order: 2; }
  .detail .morebtn { display: block; order: 3; margin: 14px 0 4px; text-align: left; font-size: 13px; }
  .detail .own-row { order: 4; }
  .detail .facts { order: 5; }
  .detail:not(.more) .own-row, .detail:not(.more) .facts { display: none; }
  .detail.more .own-row { margin-top: 8px; }
}
@media (max-width: 1080px) and (prefers-reduced-motion: reduce) { .make > .detail, .make > .detail.open { transition: none; } }

/* 開く・閉じるのマーク(+ / −) */
.panel h2 .hgroup { display: inline-flex; align-items: center; gap: 8px; }
.fold { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px; padding: 0; border: 2px solid var(--frame); background: var(--brass-hi); color: var(--ink); font-family: var(--font-display); font-size: 18px; line-height: 1; font-style: normal; cursor: pointer; box-shadow: 2px 2px 0 var(--frame); }
.fold:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--frame); }
#presetBody[hidden] { display: none; }

/* ダークモードでも読める色にそろえる */
.servetag, .pserve { color: #2B1A0E; }
.btn.ghost, .btn.danger { color: var(--ink); }
.fold { color: var(--ink); }

/* ガチャ: 結果は石臼のすぐ下に出す(1枚のパネルにまとめる) */
.gacha-wrap { grid-template-columns: minmax(0, 620px); justify-content: center; }
.gacha-machine #gachaResult { width: 100%; text-align: left; }
.gacha-machine #gachaResult:empty { display: none; }
.gacha-machine.has-result .mortar { width: 168px; height: 168px; }
.gacha-machine.has-result .machine { padding: 0; }
.gacha-machine #gachaResult .gacha-card { padding: 14px; border: 3px solid var(--frame); box-shadow: 4px 4px 0 var(--frame); animation: rise .35s steps(4) both; }
.gacha-machine #gachaResult .gacha-card.r3 { border-color: var(--brass); }
.gacha-machine #gachaResult .gacha-card h2 { font-size: 22px; }
.gacha-machine #gachaResult .rar { justify-self: start; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .gacha-machine #gachaResult .gacha-card { animation: none; } }
#spinBtn[hidden] { display: none; }

/* 鍋の上の「お手本」ボタン(スマホだけ) */
.potpreset { display: none; position: absolute; z-index: 2; top: 27%; left: 6px; align-items: center; gap: 4px; padding: 3px 9px 3px 5px; border: 2px solid var(--brass); background: rgba(18, 12, 7, .78); color: #FFF3D6; font-family: var(--font-display); font-size: 14px; cursor: pointer; box-shadow: 2px 2px 0 rgba(0, 0, 0, .35); }
.potpreset .nicon svg { display: block; width: 18px; height: 18px; image-rendering: pixelated; }
.potpreset .f { fill: #E2A868; }
.potpreset:active { transform: translate(1px, 1px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* スマホのベース選び: 1行に収まるよう少し詰める */
@media (max-width: 1080px) {
  .base .seg { gap: 4px; }
  .base .seg button { padding: 4px 8px; font-size: 14px; }
  .base .seg[data-key="sweet"] { flex-wrap: nowrap; }
  .base .seg[data-key="sweet"] button { flex: 1 1 auto; min-width: 0; padding: 4px 4px; white-space: nowrap; }
}
/* ダークモード: 暗いスパイス(黒胡椒など)が沈まないよう、うっすら明るい縁どり */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) img.sp { filter: drop-shadow(1px 0 0 rgba(255, 236, 200, .28)) drop-shadow(-1px 0 0 rgba(255, 236, 200, .28)) drop-shadow(0 1px 0 rgba(255, 236, 200, .28)) drop-shadow(0 -1px 0 rgba(255, 236, 200, .28)); }
}
@media (max-width: 1080px) { .potpreset { display: inline-flex; } }
.servetag[data-kind="both"], .pserve[data-kind="both"] { background: #FFF1C4; }

.potwrap { position: relative; }
.row.sharemenu[hidden], .sharemenu[hidden] { display: none; }
.sharemenu { margin-top: 12px; }
/* 共有メニュー: 3つの大きいタイル */
.sharetiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sharebar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.stile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 68px; padding: 8px 2px; border: 2px solid var(--frame); background: var(--surface); color: var(--ink); box-shadow: 3px 3px 0 var(--frame); font-family: var(--font-display); font-size: 14px; cursor: pointer; }
.stile .nicon svg { display: block; width: 24px; height: 24px; image-rendering: pixelated; }
.stile .f { fill: var(--brass); }
.stile:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--frame); }
.stile[aria-pressed="true"] { background: var(--brass); color: var(--on-brass); }
.stile[aria-pressed="true"] .f { fill: #FFF3D6; }
.stile.small { min-height: 58px; font-size: 12px; box-shadow: 2px 2px 0 var(--frame); }
.stile.small .nicon svg { width: 20px; height: 20px; }
.cardarea { margin-top: 12px; }
.cardarea[hidden] { display: none; }
.cardimg { display: block; width: 100%; max-width: 300px; margin: 0 auto; border: 3px solid var(--frame); box-shadow: 4px 4px 0 var(--frame); }
.sharehint:empty { display: none; }
#copyMsg { margin-top: 8px; }
.gachashare { margin-top: 4px; }
.gachashare .sharebar { margin-top: 6px; }
/* 調理モードのできあがり */
.steptext.finish { text-align: center; font-size: 20px; line-height: 1.7; }
.cookcard .cardimg { max-width: 240px; }
.cookcard { margin: 8px 0 4px; }
/* 鍋が空のとき */
.potlist li.potempty { display: block; cursor: default; padding: 14px; border: 2px dashed var(--line); background: var(--surface-2); }
.potlist li.potempty p { margin: 0 0 10px; font-size: 14px; }
.potlist li.potempty .row { justify-content: flex-start; }
#emptyPot[hidden] { display: none; }
/* スパイス棚: 入れていないものは「+」、入っているものは「✓」 */
.tile .badge { display: flex; align-items: center; justify-content: center; top: 3px; right: 3px; width: 16px; height: 16px; font-size: 12px; line-height: 1; font-family: var(--font-display); border-radius: 0; }
.tile .badge.add { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.tile .badge.in { background: var(--brass); color: var(--on-brass); border: 1px solid var(--frame); }
.tile.inpot { background: var(--brass-hi); }
.tile:hover .badge.add { color: var(--ink); border-color: var(--frame); }
/* ベースの選択肢: スマホでは3つずつ・横いっぱいにそろえる */
.seg .segbr { display: none; }
@media (max-width: 1080px) {
  .base .seg .segbr { display: block; flex-basis: 100%; height: 0; }
  .base .seg button { flex: 1 1 auto; padding: 4px 6px; }
}
.gacha-machine #gachaResult .gacha-card h2 { text-wrap: wrap; }
.steptext.finish .fname { display: block; font-size: 16px; text-wrap: balance; }
.cardarea .cardimg { max-width: 420px; }

/* 共有ボタンの各社ロゴ(色・形は公式のまま) */
.stile .brand { display: block; width: 22px; height: 22px; }
.stile .brand-x, .stile .brand-instagram { fill: var(--ink); }
.stile .brand-facebook { fill: #0866FF; }
.stile[aria-pressed="true"] .brand-x, .stile[aria-pressed="true"] .brand-instagram { fill: var(--on-brass); }
.potfoot { justify-content: flex-start; margin-top: 10px; }
#presetChip[hidden] { display: none; }

/* 名前が長いときは、2行目をアイス/ホットの選択肢だけにする */
@media (max-width: 1080px) {
  .stage .title.stack .serve { flex-basis: 100%; }
  .stage .title.stack .servebtn { display: block; width: 100%; }
  .stage .title.stack .serve .servebtn b { display: flex; width: 100%; box-sizing: border-box; padding: 3px 4px 3px 8px; }
  .stage .title.stack .serve .fold { margin-left: auto; }
}

/* 作り方(①〜⑤) */
.styles { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; }
.styles .ctl-label { margin: 0; flex: none; }
.styleseg { flex: 1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.styleseg button { min-height: 40px; border: 2px solid var(--frame); background: var(--surface); color: var(--ink); font-family: var(--font-display); font-size: 20px; line-height: 1; cursor: pointer; }
.styleseg button[aria-checked="true"] { background: var(--brass); color: var(--on-brass); box-shadow: 2px 2px 0 var(--frame); }
.styleseg button:disabled { opacity: .35; cursor: not-allowed; }
.stylenote { margin: 0 0 12px; padding: 10px 12px; background: var(--surface-2); border-left: 4px solid var(--brass); font-size: 13px; line-height: 1.65; }
.stylenote b { font-family: var(--font-display); font-weight: 400; font-size: 16px; display: block; margin-bottom: 2px; }
.stylenote p { margin: 2px 0 0; }
.stylenote .k { display: inline-block; margin-right: 6px; padding: 0 5px; font-size: 11px; font-weight: 700; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }

/* 調理モード: タイマーのない手順のドット絵 */
.cookpic { position: relative; height: 240px; margin: 12px auto 0; max-width: 300px; display: flex; align-items: flex-end; justify-content: center; }
.cookpic img.px { image-rendering: pixelated; }
.cookpic.pot .kettle { position: relative; z-index: 1; display: block; }
.cookpic .drops { position: absolute; inset: 0 0 auto 0; height: 120px; z-index: 2; }
.cookpic .drops span { position: absolute; top: 0; left: calc(50% + (var(--i) - (var(--n) - 1) / 2) * 44px - 20px); width: 40px; display: flex; justify-content: center; animation: dropin 2.2s steps(11) infinite; animation-delay: calc(var(--i) * .45s); opacity: 0; }
@keyframes dropin { 0% { transform: translateY(-8px); opacity: 0; } 10% { opacity: 1; } 70% { transform: translateY(78px); opacity: 1; } 80%, 100% { transform: translateY(86px); opacity: 0; } }
.cookpic .drops b { display: block; border: 2px solid var(--frame); }
.cookpic .drops b.milk { width: 14px; height: 18px; background: #FFFDF7; border-radius: 0 0 7px 7px; box-shadow: inset -3px -3px 0 #E8E0CF; }
.cookpic .drops b.water { width: 14px; height: 18px; background: #BFE6F5; border-radius: 0 0 7px 7px; box-shadow: inset -3px -3px 0 #7FC4E0; }
.cookpic .drops b.honey { width: 14px; height: 18px; background: #F2B53C; border-radius: 0 0 7px 7px; box-shadow: inset -3px -3px 0 #C98A12; }
.cookpic .drops b.sugar { width: 12px; height: 12px; background: #FFFFFF; box-shadow: inset -3px -3px 0 #E3D3B8; }
.cookpic .bub { position: absolute; z-index: 2; bottom: 140px; width: 6px; height: 6px; background: #FFF3D6; border: 1px solid var(--frame); animation: bub 1.6s steps(8) infinite; opacity: 0; }
.cookpic .bub.b1 { left: calc(50% - 30px); } .cookpic .bub.b2 { left: calc(50% + 6px); animation-delay: .5s; } .cookpic .bub.b3 { left: calc(50% + 34px); animation-delay: 1s; }
@keyframes bub { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-26px); opacity: 0; } }
/* カップに注ぐ */
.cookpic.cup img.px { position: relative; z-index: 1; display: block; margin-bottom: 8px; }
.cookpic .pour { position: absolute; z-index: 0; bottom: 110px; left: calc(50% - 4px); width: 8px; height: 110px; background: repeating-linear-gradient(#B8784A 0 6px, #C98A5C 6px 12px); border-left: 2px solid var(--frame); border-right: 2px solid var(--frame); animation: pour .5s steps(2) infinite; }
@keyframes pour { to { background-position: 0 12px; } }
.cookpic .st { position: absolute; z-index: 2; bottom: 150px; width: 6px; height: 6px; background: var(--muted); opacity: 0; animation: steam 2s steps(10) infinite; }
.cookpic .st.s1 { left: calc(50% - 34px); } .cookpic .st.s2 { left: calc(50% - 16px); animation-delay: .7s; } .cookpic .st.s3 { left: calc(50% + 2px); animation-delay: 1.3s; }
@keyframes steam { 0% { transform: translate(0, 0); opacity: 0; } 25% { opacity: .7; } 100% { transform: translate(6px, -40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cookpic .drops span { animation: none; opacity: 1; transform: translateY(40px); } .cookpic .bub, .cookpic .st, .cookpic .pour { animation: none; } }

.stepnote { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.stepnote::before { content: "♪ "; color: var(--brass); }
p.stepnote { text-align: left; font-size: 14px; margin: -4px 0 0; }
.cookpic.cup .drops span { animation-delay: calc(.6s + var(--i) * .5s); }

/* 共有画像: レシピ版 / ノート版の切り替え */
.cardkind { display: grid; grid-template-columns: 1fr 1fr; max-width: 420px; margin: 0 auto 10px; border: 2px solid var(--frame); }
.cardkind button { min-height: 38px; border: 0; background: var(--surface); color: var(--ink); font-family: var(--font-display); font-size: 14px; cursor: pointer; }
.cardkind button + button { border-left: 2px solid var(--frame); }
.cardkind button[aria-selected="true"] { background: var(--brass); color: var(--on-brass); }
.cardkind.small { max-width: none; margin: 10px 0 0; }
.cardkind.small button { min-height: 34px; font-size: 13px; }

/* ===== タブレット(721〜1080px): スマホと同じ作りを、真ん中に寄せて ===== */
@media (min-width: 721px) and (max-width: 1080px) {
  main { max-width: 720px; }
}

/* ===== PC(1081px以上): 3列を画面の高さにおさめ、列ごとにスクロール ===== */
@media (min-width: 1081px) {
  .make { grid-template-columns: 280px minmax(0, 1fr) 340px; gap: 18px; height: calc(100vh - var(--top, 96px) - 36px); min-height: 560px; align-items: stretch; }
  .make > .col, .make > .detail { height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .make > .col { align-content: start; padding: 0 8px 8px 0; }
  .make > .col.center { display: flex; flex-direction: column; gap: 14px; }
  /* 左: スパイス棚だけ(お手本はダイアログで) */
  .make > .col:first-child > .presetpanel { display: none; }
  /* 真ん中: 鍋を上に固定して、下をタブで */
  .make > .col > .stage { position: sticky; top: 0; z-index: 5; padding: 0; background: var(--night); flex: none; }
  .make .potwrap { width: fit-content; max-width: 100%; margin: 10px auto; }
  .make .stage canvas.pot { width: auto; max-width: 100%; height: min(300px, 34vh); border: 2px solid var(--frame); outline: 2px solid #4A3626; }
  .make .stage .title { margin-top: 0; padding: 10px 16px; outline: 0; border-top: 3px solid var(--brass); }
  .make .stage .title h2 { font-size: 20px; }
  .make .stage .title #potSub { display: none; }
  .make .mtabs { order: 3; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 3px solid var(--frame); background: var(--surface-2); }
  .make .mtabs button { position: relative; min-height: 44px; border: 0; border-right: 2px solid var(--frame); background: transparent; color: var(--ink); font-family: var(--font-display); font-size: 16px; cursor: pointer; }
  .make .mtabs button:last-child { border-right: 0; }
  .make .mtabs button:hover { background: var(--brass-hi); }
  .make .mtabs button[aria-selected="true"] { background: var(--brass); color: var(--on-brass); }
  .make .mtabs .cnt:not(:empty) { display: inline-block; margin-left: 4px; min-width: 18px; padding: 0 3px; font-size: 11px; line-height: 16px; background: var(--frame); color: var(--paper); font-family: var(--font-body); vertical-align: 2px; }
  .make .col.center [data-mtab] { display: none; flex: none; }
  .make .col.center [data-morder="1"] { order: 1; }
  .make .col.center [data-morder="3"] { order: 3; }
  .make .col.center > .stage { order: 0; }
  .make[data-mtab="base"] .col.center [data-mtab="base"], .make[data-mtab="spice"] .col.center [data-mtab="spice"], .make[data-mtab="recipe"] .col.center [data-mtab="recipe"], .make[data-mtab="note"] .col.center [data-mtab="note"] { display: block; }
  /* 右: スパイスの入れ方を先に、くわしい説明はたたむ */
  .make > .detail { position: static; display: flex; flex-direction: column; }
  .detail .dhead { order: 1; }
  .detail .dhead.big { flex-direction: row; align-items: center; }
  .detail .dhead.big img { width: 64px; height: 64px; padding: 6px; background-size: 16px 16px; }
  .detail .dhead h2 { font-size: 22px; }
  .detail .controls { order: 2; }
  .detail .morebtn { display: block; order: 3; margin: 14px 0 4px; text-align: left; font-size: 13px; }
  .detail .own-row { order: 4; }
  .detail .facts { order: 5; }
  .detail:not(.more) .own-row, .detail:not(.more) .facts { display: none; }
  .detail.more .own-row { margin-top: 8px; }
  /* お手本はまんなかに出るダイアログ */
  .make > .col > .presetpanel.open { display: block; position: fixed; z-index: 45; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(820px, 90vw); max-height: 82vh; overflow-y: auto; padding: 18px 20px; }
  .presetpanel .sheetx { display: inline-flex; position: absolute; top: 10px; right: 12px; }
  .presetpanel h2 { padding-right: 44px; }
  .presetpanel .fold { display: none; }
  .presetpanel #presetBody[hidden] { display: block; }
  .presetpanel ul.presets { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .sheetback:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(43, 26, 14, .45); }
  .foot { padding: 10px 16px 14px; }
}

/* PC: 名前とアイス/ホットを1行に。理由は「+」で吹き出し */
@media (min-width: 1081px) {
  .make .stage .title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; position: relative; }
  .make .stage .title h2 { flex: 1 1 auto; }
  .make .stage .title .serve { margin: 0; }
  .make .stage .title .serve > span { display: none; }
  .make .stage .title .serve .fold { display: inline-flex; width: 18px; height: 18px; margin-left: 6px; font-size: 15px; border: 0; box-shadow: none; color: var(--ink); }
  .make .stage .title .serve[data-kind="ice"] .fold { background: #9FD8EE; }
  .make .stage .title .serve[data-kind="hot"] .fold { background: #F2A27A; }
  .make .stage .title .serve[data-kind="both"] .fold { background: #F2CF72; }
  .make .stage .title .serve.open > span { display: block; position: absolute; z-index: 6; left: 0; right: 0; top: calc(100% + 6px); padding: 8px 14px; font-size: 13px; line-height: 1.6; color: var(--paper); background: var(--night); border: 2px solid #F2CF72; }
  .make .stage .title .serve[data-kind="ice"].open > span { border-color: #9FD8EE; }
  .make .stage .title .serve[data-kind="hot"].open > span { border-color: #F2A27A; }
  .make .stage .title .loaded { flex-basis: 100%; font-size: 12px; }
}
@media (min-width: 721px) and (max-width: 1080px) {
  .shelf { grid-template-columns: repeat(5, 1fr); }
}

/* お気に入り(★) */
ul.presets li { position: relative; }
.card { position: relative; }
.favbtn { position: absolute; z-index: 2; top: 4px; left: 4px; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.card > .favbtn { left: auto; right: 10px; top: 10px; width: 32px; height: 32px; font-size: 24px; }
.favbtn[aria-pressed="true"] { color: var(--brass); text-shadow: 1px 1px 0 var(--frame); }
.favbtn:hover { color: var(--brass); }
ul.presets li.isfav .preset { border-color: var(--brass); }
.favbar { margin: 0 0 10px; display: flex; justify-content: flex-start; }
#view-saved .favbar { margin: 4px 0 12px; }
.favempty { grid-column: 1 / -1; list-style: none; }

.stile.brandbtn .brand { width: 28px; height: 28px; margin: 7px; }
