/* Layout: 3 columns on desktop — spice shelf | pot, base & recipe | spice detail. Stacks on phones (pot first). */
:root {
  --bg: #F1F3EF;
  --surface: #FFFFFF;
  --surface-2: #E7ECE6;
  --ink: #1D2A26;
  --muted: #5B6863;
  --line: #D6DDD6;
  --accent: #2F6B4F;
  --accent-ink: #FFFFFF;
  --saffron: #C98A12;
  --chai: #B9814F;
  --warn: #B4471F;
  --font-display: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
  --font-body: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111715; --surface: #1A2320; --surface-2: #233029; --ink: #E7EDEA; --muted: #9AA9A2;
    --line: #2E3B35; --accent: #73B994; --accent-ink: #0E1A14; --saffron: #E6AE45; --chai: #C8935F; --warn: #F08A5D;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111715; --surface: #1A2320; --surface-2: #233029; --ink: #E7EDEA; --muted: #9AA9A2;
  --line: #2E3B35; --accent: #73B994; --accent-ink: #0E1A14; --saffron: #E6AE45; --chai: #C8935F; --warn: #F08A5D;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.7; }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.3; }

header.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px clamp(16px, 3vw, 32px); border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 22px; }
.brand small { color: var(--muted); font-size: 12px; }
nav.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; flex-wrap: wrap; }
nav.tabs a { text-decoration: none; color: var(--muted); padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; }
nav.tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

main { padding: 20px clamp(16px, 3vw, 32px) 40px; max-width: 1320px; margin: 0 auto; }
.view[hidden] { display: none; }

.make { display: grid; grid-template-columns: 260px minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.col { display: grid; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel h2 { font-size: 16px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.panel h2 span { font-family: var(--font-body); font-weight: 400; font-size: 12px; color: var(--muted); }

/* shelf */
.group-name { font-size: 12px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.group-name:first-of-type { margin-top: 0; }
.shelfq { width: 100%; padding: 7px 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); font: inherit; font-size: 13px; }
.shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 8px 2px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; transition: border-color .15s, transform .15s; min-width: 0; }
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--surface); }
.tile .nm { font-size: 11.5px; font-weight: 700; line-height: 1.3; text-align: center; word-break: keep-all; overflow-wrap: anywhere; }
.tile .badge { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 4px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--accent); }

/* pot */
.stage { position: relative; background: radial-gradient(ellipse at 50% 85%, var(--surface-2), var(--surface) 70%); }
.stage svg.pot { width: 100%; max-width: 460px; display: block; margin: 0 auto; overflow: visible; }
.stage .title { text-align: center; }
.stage .title h2 { display: block; font-size: 20px; margin: 0; }
.stage .title p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.loaded { display: inline-block; margin-top: 4px; font-size: 12px; background: var(--surface-2); padding: 1px 10px; border-radius: 999px; }
.steam path { fill: none; stroke: var(--muted); stroke-width: 3; stroke-linecap: round; opacity: .35; animation: steam 3.2s ease-in-out infinite; }
.steam path:nth-child(2) { animation-delay: .8s; }
.steam path:nth-child(3) { animation-delay: 1.6s; }
@keyframes steam { 0% { transform: translateY(8px); opacity: 0; } 40% { opacity: .4; } 100% { transform: translateY(-18px); opacity: 0; } }
.drop { animation: drop .7s cubic-bezier(.3,.1,.5,1.4) both; }
@keyframes drop { from { transform: translateY(-150px) rotate(-40deg); opacity: .2; } to { transform: translateY(0) rotate(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .steam path, .drop { animation: none; } }

/* base */
.base { display: grid; gap: 12px; }
.base .hint { margin-top: 4px; }

.flavor { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 76px 1fr 34px; align-items: center; gap: 10px; font-size: 13px; }
.bar .track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; transition: width .4s; }
.bar .v { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.potlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.potlist li { display: grid; grid-template-columns: 30px 1fr auto auto; gap: 10px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.potlist li:hover { border-color: var(--accent); }
.meta { font-size: 12px; color: var(--muted); }
.potlist .nm { font-weight: 700; font-size: 14px; line-height: 1.3; }
.mini { width: 54px; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.mini i { display: block; height: 100%; background: var(--saffron); }
.x { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.x:hover { background: var(--surface-2); color: var(--warn); }
.empty { color: var(--muted); font-size: 13px; padding: 14px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; }

.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.notes li { font-size: 13px; padding: 8px 10px 8px 12px; border-left: 3px solid var(--saffron); background: var(--bg); border-radius: 0 8px 8px 0; }
.notes li.warn { border-left-color: var(--warn); }

ol.recipe { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.btn { border: none; background: var(--accent); color: var(--accent-ink); padding: 10px 18px; border-radius: 999px; font-weight: 700; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--warn); border: 1px solid var(--line); }
.btn.danger.armed { background: var(--warn); color: #fff; border-color: var(--warn); }
.save { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.save .inrow { display: flex; gap: 8px; flex-wrap: wrap; }
.save input { flex: 1 1 180px; min-width: 0; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); font: inherit; }

/* detail */
.detail { position: sticky; top: 16px; }
.dhead { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.dhead svg { flex: none; background: var(--bg); border-radius: 12px; }
.dhead h2 { font-size: 22px; margin: 0; display: block; }
.alt { color: var(--muted); font-size: 12px; }
dl.facts { margin: 0; display: grid; gap: 10px; }
dl.facts dt { font-size: 12px; font-weight: 700; color: var(--accent); }
dl.facts dd { margin: 0; font-size: 14px; }
.methods { display: grid; gap: 4px; margin-top: 4px; }
.mrow { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.dots { display: flex; gap: 3px; }
.dots i { width: 14px; height: 8px; border-radius: 3px; background: var(--surface-2); }
.dots i.on { background: var(--saffron); }
.dots .no { font-size: 12px; color: var(--muted); }
.controls { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { border: 1px solid var(--line); background: var(--bg); padding: 5px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg button .st { font-size: 10px; letter-spacing: -1px; color: var(--saffron); margin-left: 3px; }
.seg button[aria-pressed="true"] .st { color: inherit; }
.ctl-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.pairs { display: flex; flex-wrap: wrap; gap: 4px; }

/* dictionary & saved */
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.tools input { flex: 1 1 220px; max-width: 320px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; align-content: start; }
.card .dhead { margin: 0; }
.card .dhead h3 { font-size: 19px; }
.card .tip { font-size: 13px; background: var(--bg); padding: 10px 12px; border-radius: 10px; }
.card .act { justify-self: start; }
.intro { max-width: 65ch; color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.section-h { font-size: 18px; margin: 32px 0 6px; }
.basegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.basecard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.basecard h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.basecard p { margin: 4px 0 0; font-size: 13px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #00000022; flex: none; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.tag { font-size: 11px; font-weight: 700; padding: 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.benefits { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.benefits .tags { margin: 4px 0; }
.icons { display: flex; flex-wrap: wrap; gap: 2px; }
.icons svg { background: var(--bg); border-radius: 8px; }
.card .row { justify-content: flex-start; }

@media (max-width: 1080px) {
  .make { grid-template-columns: 240px minmax(0, 1fr); }
  .detail { grid-column: 1 / -1; position: static; }
}
@media (max-width: 720px) {
  .make { grid-template-columns: 1fr; }
  .center { order: -1; }
  .shelf { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 420px) {
  .shelf { grid-template-columns: repeat(4, 1fr); }
}

/* ===== 追加: 共通 ===== */
body.noscroll { overflow: hidden; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.pill.ok { background: var(--accent); color: var(--accent-ink); }
.linkbtn { border: none; background: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: 12px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip:disabled { opacity: .6; cursor: default; }
.actions { justify-content: flex-start; margin-top: 14px; }
.x.big { font-size: 26px; }
.rar { font-size: 12px; font-weight: 700; color: var(--muted); }
.rar.r2 { color: #2E6FB8; }
.rar.r3 { color: var(--saffron); }
.stars { color: var(--saffron); letter-spacing: 1px; }
.newdex { font-size: 13px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); padding: 8px 12px; border-radius: 10px; margin: 8px 0 0; }

/* 棚 */
.shelf-tools { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.shelf-tools .shelfq { margin: 0; flex: 1; min-width: 0; }
.tile.mine::after { content: ""; position: absolute; left: 5px; top: 5px; width: 8px; height: 8px; border-radius: 2px; background: var(--saffron); }
.shelf.wide { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }

/* お手本レシピ */
ul.presets { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
ul.presets li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

/* 詳細 */
.own-row { justify-content: flex-start; margin-bottom: 12px; }

/* 保存したレシピ */
.logsum { font-size: 13px; }
.loglist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.logform { display: grid; gap: 8px; background: var(--bg); padding: 12px; border-radius: 12px; }
.logform textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.logform [type=submit] { justify-self: start; }
.starpick { display: flex; gap: 4px; }
.starpick button { border: none; background: none; font-size: 30px; line-height: 1; cursor: pointer; color: var(--line); padding: 0 2px; }
.starpick button.on { color: var(--saffron); }

/* マイスパイス */
.my-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.shoplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.shoplist li { display: grid; grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; }
.shoplist li.empty { display: block; }
.shoplist .nm { font-weight: 700; font-size: 14px; line-height: 1.4; }
.dex { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.dexbar { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 6px; }
.dexbar i { display: block; height: 100%; background: var(--saffron); }
.dexcell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 11px; font-weight: 700; text-align: center; line-height: 1.3; cursor: pointer; min-width: 0; }
.dexcell em { font-style: normal; font-size: 10px; color: var(--muted); }
.dexcell em.r2 { color: #2E6FB8; } .dexcell em.r3 { color: var(--saffron); }
.dexcell.locked { cursor: default; color: var(--muted); font-weight: 400; border-style: dashed; background: transparent; }
.dexcell .q { font-family: var(--font-display); font-size: 24px; line-height: 36px; height: 36px; }

/* ガチャ */
.gacha-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; align-items: start; }
.gacha-machine { display: grid; gap: 12px; justify-items: center; text-align: center; }
.gacha-machine h2 { width: 100%; }
.machine { display: flex; justify-content: center; }
.machine.spin svg { animation: shake .25s linear infinite; }
.machine .knob { transform-origin: 100px 165px; }
.machine.spin .knob { animation: turn .5s linear infinite; }
.machine .capsule { animation: pop .5s cubic-bezier(.3,.1,.5,1.6) both; transform-box: fill-box; transform-origin: center; }
@keyframes shake { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.btn.big { font-size: 18px; padding: 14px 34px; }
.gacha-card { display: grid; gap: 10px; }
.gacha-card h2 { font-size: 22px; }
.gacha-card.r3 { box-shadow: inset 0 0 0 2px var(--saffron); border-radius: 12px; padding: 12px; }
@media (prefers-reduced-motion: reduce) { .machine.spin svg, .machine.spin .knob, .machine .capsule { animation: none; } }

/* 調理モード・カード画像(重ねて出す画面) */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(10, 16, 14, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.overlay[hidden] { display: none; }
.sheet { background: var(--surface); color: var(--ink); border-radius: 18px; width: min(680px, 100%); max-height: 100%; overflow: auto; padding: 20px; display: grid; gap: 14px; }
.sheet-head h2 { font-size: 18px; }
.sheet.cook { min-height: min(560px, 100%); grid-template-rows: auto auto 1fr auto; }
.cook-progress { display: flex; gap: 4px; }
.cook-progress i { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-2); }
.cook-progress i.past { background: var(--accent); opacity: .5; }
.cook-progress i.now { background: var(--accent); }
.cook-body { display: grid; align-content: start; gap: 14px; }
.stepno { font-size: 13px; font-weight: 700; color: var(--accent); }
.steptext { font-size: clamp(20px, 4.4vw, 26px); line-height: 1.6; margin: 0; font-weight: 500; }
.timer { background: var(--bg); border-radius: 16px; padding: 16px; display: grid; gap: 10px; text-align: center; }
.timer .label { font-weight: 700; color: var(--muted); font-size: 14px; }
.timer .label .hint { margin-left: 6px; }
.timer .time { font-family: var(--font-display); font-size: 56px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.timer.done .time { color: var(--saffron); animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .timer.done .time { animation: none; } }
.timer .ring { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.timer .ring i { display: block; height: 100%; background: var(--saffron); transition: width .25s linear; }
.cook-nav .btn { flex: 1; padding: 14px; font-size: 16px; }
.card-preview img { width: 100%; height: auto; display: block; border-radius: 12px; border: 1px solid var(--line); }

@media (max-width: 900px) {
  .my-grid, .gacha-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .overlay { padding: 0; align-items: stretch; }
  .sheet { border-radius: 0; width: 100%; }
}

/* このアプリについて */
.about { max-width: 760px; margin: 0 auto; }
.prose h2 { font-size: 22px; margin-bottom: 8px; }
.prose h3 { font-size: 16px; margin: 22px 0 6px; color: var(--accent); }
.prose p, .prose li { font-size: 14px; max-width: 65ch; }
.prose ul { padding-left: 1.3em; margin: 0; display: grid; gap: 4px; }
.foot { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; padding: 18px 16px 28px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.foot a { color: var(--accent); font-weight: 700; }
