/*
 * oshio-kotaro 共通スタイル
 * ブランドの「藍(#1D78B8)と白」+ 丼のふちの雷紋をトーンとする。
 * ハブ・クーポン・全ミニゲームで共有するCSS変数・共通コンポーネント。
 * ゲーム固有のスタイルは各HTMLのインライン<style>に持つ。
 */

:root {
  --ai: #1d78b8;          /* ブランドの藍(ロゴから採色) */
  --ai-deep: #0f4f80;
  --ai-soft: #8cbfe3;
  --ai-pale: #e7f2fa;
  --bg: #f4f8fb;          /* 塩の白 */
  --surface: #ffffff;
  --ink: #12293d;
  --ink-2: #4a5f72;
  --ink-3: #8696a5;
  --line: rgba(18, 41, 61, 0.12);
  --line-strong: rgba(18, 41, 61, 0.22);
  --abura: #fff3d6;       /* 背脂のクリーム */
  --gold: #e3a400;        /* 特賞 */
  --gold-pale: #fff1c2;
  --red: #d8423a;         /* はずれ・警告・激辛 */
  --green: #3f9d5a;       /* もやしの芽 */
  --font-display: "Dela Gothic One", "Zen Kaku Gothic New", sans-serif;
  --font-body: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", sans-serif;
  --demo-bottom: 84px;    /* デモパネルの浮かせ位置(タブバーの上)。ゲーム画面では上書き */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* フルイドな中央寄せコンテナ(最大幅430px)。menya-koji-mile と同じ考え方で、
   .scroll だけが内部スクロールしタブバーは常に画面内に固定される。 */
.app {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  background: var(--bg);
}
.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 16px 24px;
}
/* overflow:hidden を持つ子(ヒーロー等)がフレックスで潰れないようにする */
.scroll > * { flex-shrink: 0; }

/* 丼のふちの雷紋帯(ロゴの鉢巻き模様) */
.raimon {
  flex: none;
  height: 14px;
  background-color: var(--ai);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='14' viewBox='0 0 20 14'%3E%3Cpath d='M2 12V2h12v8H7V6h4' fill='none' stroke='%23fff' stroke-width='1.6'/%3E%3C/svg%3E");
  background-size: 20px 14px;
  background-repeat: repeat-x;
}
.raimon.thin { height: 8px; background-size: 11.5px 8px; }

/* ---------- トップバー ---------- */
.topbar {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar .face {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: #fff url("../assets/kotaro-face.jpg") center / 118% no-repeat;
  box-shadow: 0 0 0 2px var(--ai);
}
.topbar .brand { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.topbar .brand .shop { font-family: var(--font-display); font-size: 17px; color: var(--ai); letter-spacing: .04em; }
.topbar .brand .sub { font-size: 10.5px; font-weight: 700; color: var(--ink-3); }
.topbar .spacer { flex: 1; }
.back-btn {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 12px; font-weight: 700; color: var(--ai);
  padding: 6px 10px 6px 4px; border-radius: 999px;
  background: none; border: 0; cursor: pointer;
}
.back-btn svg { stroke: var(--ai); }
.topbar .title { font-family: var(--font-display); font-size: 16px; color: var(--ink); letter-spacing: .03em; }

/* チャレンジ権のチップ */
.ticket-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 900;
  padding: 4px 10px; border-radius: 999px;
  color: #fff; background: var(--ai);
  white-space: nowrap;
}
.ticket-chip.off { color: var(--ink-3); background: var(--ai-pale); }
.ticket-chip.practice { color: var(--ai-deep); background: var(--gold-pale); }

/* 仮表示バッジ(特典内容が未確定であることを明示する) */
.kari {
  display: inline-block; font-size: 10px; font-weight: 900; letter-spacing: .05em;
  color: var(--red); border: 1px solid var(--red); border-radius: 4px; padding: 0 4px; line-height: 1.5;
  vertical-align: middle;
}

/* ---------- 汎用 ---------- */
.card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 0 0 1px var(--line), 0 6px 18px -12px rgba(15, 79, 128, .35);
  padding: 16px;
}
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 900; color: var(--ink-2);
  margin: 4px 2px -6px;
}
.section-title::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--ai); }
.muted { color: var(--ink-3); font-size: 11.5px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 14px 16px; border: 0; border-radius: 999px;
  font-size: 15px; font-weight: 900; letter-spacing: .04em;
  color: #fff; background: var(--ai);
  box-shadow: 0 4px 0 var(--ai-deep);
  cursor: pointer; text-align: center;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ai-deep); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; box-shadow: 0 4px 0 var(--ai-deep); }
.btn.gold { color: var(--ink); background: var(--gold); box-shadow: 0 4px 0 #a87900; }
.btn.ghost { color: var(--ai); background: var(--surface); box-shadow: 0 0 0 1.5px var(--ai); }
.btn.ghost:active { transform: translateY(1px); }
.btn.small { width: auto; padding: 9px 16px; font-size: 13px; }

/* 賞品表(ゲーム開始前の案内・ハブで共通) */
.prize-table { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.prize-table li {
  display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px; background: var(--ai-pale); font-size: 12.5px;
}
.prize-table .lv { font-weight: 900; font-size: 11px; text-align: center; border-radius: 6px; padding: 2px 0; color: #fff; background: var(--ai); }
.prize-table li.top .lv { background: var(--gold); color: var(--ink); }
.prize-table .reward { font-weight: 700; }
.prize-table .cond { font-size: 11px; color: var(--ink-2); font-weight: 700; white-space: nowrap; }

/* ---------- タブバー ---------- */
.tabbar {
  display: flex; flex: none;
  border-top: 1px solid var(--line); background: var(--surface);
  padding: 8px 8px 16px;
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; }
.tab span { font-size: 10.5px; font-weight: 700; color: var(--ink-3); }
.tab svg { stroke: var(--ink-3); }
.tab.active span { color: var(--ai); }
.tab.active svg { stroke: var(--ai); }
.tab .badge {
  position: absolute; top: -4px; left: calc(50% + 6px);
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 900; line-height: 17px; text-align: center;
}

/* ---------- モーダル ---------- */
.ok-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 20px; overflow-y: auto;
  background: rgba(10, 30, 48, .62);
  animation: ok-fade .2s ease;
}
.ok-dialog {
  position: relative; width: min(100%, 360px);
  background: var(--surface); border-radius: 20px;
  padding: 22px 18px 18px;
  box-shadow: 0 20px 40px -12px rgba(0,0,0,.45);
  text-align: center;
  animation: ok-pop .28s cubic-bezier(.2, 1.4, .4, 1);
}
.ok-dialog .eyebrow { font-size: 11px; font-weight: 900; color: var(--ai); letter-spacing: .12em; }
.ok-dialog .headline { font-family: var(--font-display); font-size: 26px; line-height: 1.3; margin-top: 4px; color: var(--ink); }
.ok-dialog .headline.top { color: #b67f00; }
.ok-dialog .score { font-family: var(--font-display); font-size: 40px; color: var(--ai); line-height: 1.2; margin-top: 6px; font-variant-numeric: tabular-nums; }
.ok-dialog .score small { font-size: 16px; margin-left: 2px; }
.ok-dialog .sub { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.6; }
.ok-dialog .actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
@keyframes ok-fade { from { opacity: 0; } }
@keyframes ok-pop { from { opacity: 0; transform: scale(.88); } }

/* クーポン券(結果モーダル・クーポン一覧で共通) */
.coupon-ticket {
  position: relative;
  display: grid; grid-template-columns: 1fr auto; align-items: stretch;
  border-radius: 14px; overflow: hidden; text-align: left;
  background: var(--ai); color: #fff;
  box-shadow: 0 6px 16px -10px rgba(15, 79, 128, .8);
}
.coupon-ticket .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.coupon-ticket .from { font-size: 10px; font-weight: 700; opacity: .85; }
.coupon-ticket .name { font-family: var(--font-display); font-size: 17px; line-height: 1.35; }
.coupon-ticket .exp { font-size: 10.5px; opacity: .85; margin-top: 2px; }
.coupon-ticket .stub {
  display: grid; place-items: center; width: 64px;
  border-left: 2px dashed rgba(255,255,255,.55);
  font-family: var(--font-display); font-size: 12px; writing-mode: vertical-rl; letter-spacing: .2em;
  background: var(--ai-deep);
}
.coupon-ticket::before, .coupon-ticket::after {
  content: ""; position: absolute; right: 57px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface);
}
.coupon-ticket::before { top: -7px; }
.coupon-ticket::after { bottom: -7px; }
.coupon-ticket.top { background: linear-gradient(135deg, #f0b400, #d99500); color: var(--ink); }
.coupon-ticket.top .stub { background: #b67f00; color: #fff; }
.coupon-ticket.used { background: #b8c3cc; color: #fff; }
.coupon-ticket.used .stub { background: #98a5b0; }

/* 紙吹雪(当選演出) */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i {
  position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px;
  animation: confetti-fall 1.6s ease-in forwards;
}
@keyframes confetti-fall { to { transform: translateY(105vh) rotate(540deg); opacity: .8; } }

/* ---------- トースト ---------- */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 8px);
  max-width: calc(100% - 40px);
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 700;
  padding: 10px 18px; border-radius: 999px; box-shadow: 0 10px 20px -8px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 80;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- デモ操作パネル(モック確認用。本来のデザインには含まれない) ---------- */
.demo-panel {
  position: fixed; right: 12px; bottom: var(--demo-bottom); z-index: 40;
  max-width: calc(100vw - 24px);
  font-family: var(--font-body);
}
.demo-panel details {
  background: rgba(18, 41, 61, .92); color: #fff; border-radius: 10px;
  padding: 6px 10px; font-size: 11px; box-shadow: 0 6px 16px rgba(0,0,0,.25);
  max-height: 70vh; overflow-y: auto;
  width: fit-content; margin-left: auto;
}
.demo-panel details[open] { width: 240px; max-width: calc(100vw - 24px); }
.demo-panel summary { cursor: pointer; font-weight: 700; list-style: none; padding: 4px 0; }
.demo-panel summary::-webkit-details-marker { display: none; }
.demo-panel .demo-controls { margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.18); display: flex; flex-direction: column; gap: 10px; }
.demo-panel .demo-group { display: flex; flex-direction: column; gap: 6px; }
.demo-panel .demo-group + .demo-group { padding-top: 10px; border-top: 1px solid rgba(255,255,255,.12); }
.demo-panel .demo-group-title { font-size: 10.5px; font-weight: 700; color: var(--ai-soft); }
.demo-panel .demo-field { display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; color: rgba(255,255,255,.8); }
.demo-panel select, .demo-panel input {
  font: inherit; font-size: 11px; color: var(--ink); background: #fff;
  border: none; border-radius: 6px; padding: 6px 8px; width: 100%;
}
.demo-panel button {
  font-size: 11px; font-weight: 700; color: var(--ink); background: var(--ai-soft);
  border: none; border-radius: 999px; padding: 7px 12px; cursor: pointer;
}
.demo-panel .demo-link {
  display: block; padding: 8px 10px; border-radius: 8px; text-align: center;
  font-weight: 700; color: var(--ink); background: #fff;
}
.demo-panel #demo-reset { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }

/* ---------- ゲーム開始前の案内(OKUI.gate が描画) ---------- */
.gate-card { display: flex; flex-direction: column; gap: 12px; }
.gate-catch { margin: 0; font-family: var(--font-display); font-size: 18px; line-height: 1.4; color: var(--ai); text-align: center; }
.gate-rules { font-size: 13px; line-height: 1.75; color: var(--ink-2); }
.gate-rules ul, .gate-rules ol { margin: 0; padding-left: 1.3em; }
.gate-sub { margin: 4px 0 -4px; font-size: 12px; font-weight: 900; color: var(--ink-2); }
.gate-best { margin: 0; font-size: 12px; color: var(--ink-3); text-align: center; }
.gate-best b { color: var(--ai); font-size: 14px; }
.gate-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.gate-note { margin: -2px 0 0; font-size: 11px; color: var(--ink-3); text-align: center; }
.gate-done { margin: 0; padding: 12px; border-radius: 12px; background: var(--ai-pale); text-align: center; font-size: 13px; font-weight: 900; color: var(--ai-deep); line-height: 1.6; }
.gate-done span { font-size: 11px; font-weight: 700; color: var(--ink-2); }

/* ゲーム画面: トーストは下部の操作ボタンと重ならないよう上側に出す */
body.game-page .toast { top: 112px; bottom: auto; transform: translate(-50%, -8px); }
body.game-page .toast.show { transform: translate(-50%, 0); }
.stage {
  flex: 1; min-height: 0; position: relative; overflow: hidden;
  display: flex; flex-direction: column;
}
.hud {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 16px; font-weight: 900; font-size: 13px; color: var(--ink-2);
  background: var(--ai-pale);
}
.hud b { font-family: var(--font-display); font-weight: 400; font-size: 20px; color: var(--ai); font-variant-numeric: tabular-nums; }

/* キャンペーンサイトの下部タブ(OKUI.mountTabbar が差し込む)。プレイ中は画面を広く使うため隠す */
.stage:not([hidden]) ~ .campaign-tabbar { display: none; }
.topbar .brand .title { line-height: 1.25; }
body.game-page:has(.stage:not([hidden])) { --demo-bottom: 12px; }
