:root {
  --ink: #2a1f1a;
  --ink-soft: #7a6a60;
  --bg: #f2ebe4;
  --paper: #ffffff;
  --line: #e4d8cc;
  --red: #c8302e;
  --red-dark: #8e1f1d;
  --wood: #5a3a22;
  --gold: #e8a830;
  --good: #3f8a4a;
  --font: "Zen Kaku Gothic New", system-ui, sans-serif;
  --brush: "Dela Gothic One", "Zen Kaku Gothic New", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-weight: 500; line-height: 1.7; line-break: strict; }
[hidden] { display: none !important; }
.g-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; max-width: 540px; margin: 0 auto; font-size: 13px; font-weight: 900; }
.g-brand { color: var(--ink-soft); text-decoration: none; }
.g-title { flex: 1; text-align: center; font-family: var(--brush); font-weight: 400; }
.g-head [data-mg-account] a { color: var(--red); text-decoration: none; }
main { max-width: 540px; margin: 0 auto; padding: 0 12px 24px; }

/* お店 */
.shopbox { position: relative; border-radius: 16px; overflow: hidden; box-shadow: 0 8px 22px rgba(42, 31, 26, 0.18); }
.scene svg { display: block; width: 100%; height: auto; }
.scene .walker { animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-2px); } }
.scene .steam { animation: steam 2.2s ease-in-out infinite; }
@keyframes steam { 50% { opacity: 0.3; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .scene * { animation: none !important; } }
.noren { position: absolute; left: 10px; top: 10px; padding: 3px 14px; border-radius: 6px; background: var(--red); color: #fff; font: 400 15px/1.4 var(--brush); letter-spacing: 0.08em; }
.stats { display: grid; grid-template-columns: 1.2fr 1fr; gap: 8px; margin-top: 10px; }
.stats > div { background: var(--paper); border-radius: 14px; padding: 8px 12px; }
.lbl { display: block; font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.stats b { font-size: 22px; font-weight: 900; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stats small { display: block; font-size: 11px; color: var(--ink-soft); line-height: 1.45; }
.bar { height: 6px; margin: 2px 0 3px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.sat[data-lv="3"], .sat[data-lv="2"] { color: var(--good); font-weight: 900; }
.sat[data-lv="0"] { color: var(--red); font-weight: 900; }
.trend[data-up="1"] { color: var(--good); } .trend[data-up="-1"] { color: var(--red); }
.busy { margin: 6px 2px 0; font-size: 12px; font-weight: 700; color: var(--red); }
.busy:empty { display: none; }
.critic { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; padding: 8px 12px; border-radius: 14px; background: #fff5e2; border: 2px solid #f0c878; font-size: 12px; line-height: 1.55; }
.critic.done { background: #eef6ec; border-color: #9cc77f; }
.c-tag { flex: none; padding: 1px 8px; border-radius: 999px; background: var(--wood); color: #fff; font-weight: 900; font-size: 11px; }
.voices-box { margin-top: 8px; background: var(--paper); border-radius: 14px; padding: 8px 12px; }
.voices { list-style: none; margin: 2px 0 0; padding: 0; }
.voices li { font-size: 13px; line-height: 1.6; animation: in 0.4s ease-out; }
.voices li:not(:first-child) { color: var(--ink-soft); font-size: 12px; }
.voices li b { margin-right: 2px; }
.voices li.good b { color: var(--good); } .voices li.bad b { color: var(--red); }
@keyframes in { from { opacity: 0; transform: translateY(-4px); } }
.goal { margin-top: 8px; background: var(--paper); border-radius: 14px; padding: 8px 12px 10px; }
.goal-text { margin: 0 0 4px; font-size: 12px; font-weight: 900; text-wrap: pretty; word-break: keep-all; overflow-wrap: anywhere; }
.goal-track { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.goal-track span { display: block; height: 100%; background: var(--red); border-radius: 999px; }

/* タブ */
.tabs { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 12px 0 8px; padding: 6px 0; background: var(--bg); }
.tabs button { padding: 10px 2px; border: 0; border-radius: 12px; background: var(--paper); color: var(--ink-soft); font: 900 13px/1.2 var(--font); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--red); color: #fff; }
.sub-h { margin: 12px 2px 6px; font-size: 14px; font-weight: 900; }
.sub-h small { font-weight: 700; color: var(--ink-soft); margin-left: 4px; }
.sub-h b { color: var(--red); }
.hint { margin: 8px 2px 0; font-size: 12px; color: var(--ink-soft); line-height: 1.6; }

/* メニュー */
.slots { display: flex; gap: 6px; margin-bottom: 8px; }
.slots:empty { display: none; }
.slot { flex: 1; padding: 8px; border: 2px solid var(--line); border-radius: 12px; background: var(--paper); font: 900 13px var(--font); color: var(--ink-soft); cursor: pointer; }
.slot.on { border-color: var(--red); color: var(--red); }
.bowlbox { display: flex; align-items: center; gap: 12px; background: var(--paper); border-radius: 16px; padding: 10px 12px; }
.bowl { flex: none; width: 128px; }
.bowl svg { display: block; width: 100%; height: auto; }
.bowl-info { flex: 1; min-width: 0; }
.bowl-info > b { font-size: 15px; line-height: 1.4; text-wrap: balance; }
@media (max-width: 359px) { .bowl { width: 96px; } .bowl-info > b { font-size: 14px; } .pbtn { width: 34px; height: 34px; } .price { gap: 6px; } }
.mei { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; background: var(--gold); color: #3a2400; font-size: 11px; font-weight: 900; vertical-align: 2px; }
.profit { margin: 2px 0 6px; font-size: 11px; color: var(--ink-soft); line-height: 1.5; }
.price { display: flex; align-items: center; gap: 8px; }
.price span { font-size: 13px; font-weight: 900; white-space: nowrap; }
.price b { font-size: 22px; font-variant-numeric: tabular-nums; }
.pbtn { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--bg); font: 900 20px/1 var(--font); color: var(--ink); cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 7px 12px; border: 2px solid var(--line); border-radius: 999px; background: var(--paper); font: 900 13px/1.2 var(--font); color: var(--ink); cursor: pointer; }
.chip.on { border-color: var(--red); background: var(--red); color: #fff; }
.chip:disabled { opacity: 0.4; cursor: default; }

/* 研究・お店 */
.res { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.res li { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--paper); border-radius: 12px; padding: 6px 10px; font-size: 14px; }
.res li.have span { font-size: 12px; color: var(--good); font-weight: 900; }
.grow { background: var(--paper); border-radius: 16px; padding: 12px; }
.grow b { font-size: 16px; }
.grow p { margin: 4px 0 8px; font-size: 13px; color: var(--ink-soft); }
.ups { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ups li { display: flex; align-items: center; gap: 10px; background: var(--paper); border-radius: 14px; padding: 8px 10px; }
.ups li > div { flex: 1; min-width: 0; }
.ups b { font-size: 14px; }
.ups .lv { margin-left: 6px; font-size: 12px; font-weight: 900; color: var(--red); }
.ups p { margin: 0; font-size: 12px; color: var(--ink-soft); }
.book { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.book li { display: flex; flex-direction: column; align-items: center; text-align: center; background: var(--paper); border-radius: 14px; padding: 8px 6px; }
.book svg { width: 100px; height: auto; }
.book b { font-size: 13px; line-height: 1.4; }
.book small { font-size: 10px; color: var(--ink-soft); line-height: 1.45; text-wrap: balance; }
.book .q { width: 100px; height: 69px; display: grid; place-items: center; font: 400 28px var(--brush); color: #c9bcb0; background: var(--bg); border-radius: 50% 50% 40% 40%; }
.book li.no b { color: #a89a8e; }
.panel { margin-top: 12px; display: grid; gap: 10px; }
.panel .mg-box { background: var(--paper); border-color: transparent; }

/* ボタン */
.btn { display: block; width: 100%; margin: 8px 0 0; padding: 13px 10px; border: 0; border-radius: 14px; font: 900 16px/1.2 var(--font); cursor: pointer; background: var(--bg); color: var(--ink); }
.btn.primary { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-dark); }
.btn.primary:disabled { background: #d8cfc6; color: #8a7d72; box-shadow: none; cursor: default; font-size: 13px; }
.btn.small { width: auto; flex: none; margin: 0; padding: 7px 12px; font-size: 12px; border-radius: 10px; background: var(--red); color: #fff; }
.btn.small:disabled { background: #e2d8ce; color: #8a7d72; cursor: default; }
.btn.ghost { background: transparent; border: 2px solid var(--line); color: var(--ink-soft); }
.dlg { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(42, 31, 26, 0.55); }
.dlg-in { width: 100%; max-width: 380px; background: var(--paper); border-radius: 18px; padding: 20px 18px 16px; text-align: center; }
.dlg h2 { margin: 0 0 10px; font: 400 24px/1.35 var(--brush); color: var(--red); }
.dlg p { margin: 0 0 10px; font-size: 14px; text-align: left; }
.dlg .aw { text-align: center; font-size: 15px; line-height: 1.9; }
.dlg .aw b { font-size: 20px; color: var(--red); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; width: max-content; max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 16px; background: rgba(42, 31, 26, 0.94); color: #fff; font-weight: 900; font-size: 14px; text-align: center; pointer-events: none; }

/* 下の解説 */
.guide { margin-top: 28px; background: var(--paper); border-radius: 18px; padding: 22px 20px 12px; font-size: 15px; line-height: 1.85; }
.guide p { margin: 0 0 1em; }
.guide h2 { font-size: 19px; margin: 32px 0 12px; padding-left: 10px; border-left: 5px solid var(--red); line-height: 1.4; }
.guide h2:first-child { margin-top: 0; }
.guide h3 { font-size: 16px; margin: 22px 0 6px; line-height: 1.5; }
.guide .steps { list-style: none; padding: 0; margin: 0 0 1em; }
.guide .steps li { display: flex; align-items: baseline; gap: 6px; margin: 6px 0; }
.guide .steps .num { flex: none; font-weight: 900; color: var(--red); }
.guide details { border-top: 1px solid var(--line); padding: 12px 0; }
.guide details p { margin: 8px 0 4px; }
.guide summary { font-weight: 900; cursor: pointer; }
.reset-row { text-align: center; margin-top: 16px !important; }
.reset-row .btn { display: inline-block; width: auto; padding: 8px 16px; font-size: 13px; }
.g-foot { max-width: 540px; margin: 0 auto; padding: 14px 16px 28px; font-size: 12px; text-align: center; }
.g-foot a { color: var(--ink-soft); }
