/* KODAMA（こだま）体験版 — 深い青緑 × 生成り × 朱 */
:root {
  --teal: #2F5D62;
  --teal-deep: #1F4246;
  --teal-pale: #E3EEEC;
  --cream: #F7F3EA;
  --paper: #FFFDF8;
  --coral: #C9693F;
  --coral-pale: #F8E7DD;
  --ink: #2C3638;
  --ink-soft: #5D6A6B;
  --line: #E0DACD;
  --ok: #2E7D5B;
  --danger: #A3402F;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(44, 54, 56, .08);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.7; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
[hidden] { display: none !important; }
small { font-size: .82em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- 体験版の帯 ---- */
.demo-band { position: sticky; top: 0; z-index: 50; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 14px; padding: 6px 16px; background: var(--teal-deep); color: #F3EFE6; font-size: 13px; line-height: 1.5; text-align: center; }
.band-link { color: #F6D9B8; font-weight: 700; white-space: nowrap; }
.band-link:hover { color: #fff; }

/* ---- ヘッダー ---- */
.app-head { background: var(--paper); border-bottom: 1px solid var(--line); padding: 12px 16px 0; }
.head-row { max-width: 1200px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--teal); color: #fff; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--font-serif); font-size: 21px; letter-spacing: .14em; font-weight: 700; line-height: 1.3; }
.brand-name small { font-size: 13px; letter-spacing: .1em; color: var(--ink-soft); margin-left: 4px; }
.brand-sub { font-size: 12px; color: var(--ink-soft); line-height: 1.4; }
.head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.store-pick { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.store-pick select { min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 4px 8px; font-size: 15px; color: var(--ink); }
.btn-reset { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 14px; min-height: 40px; }
.view-tabs { max-width: 1200px; margin: 10px auto 0; display: flex; gap: 4px; overflow-x: auto; }
.view-tab { flex: none; border: 0; background: transparent; padding: 10px 16px 9px; border-bottom: 3px solid transparent; font-size: 15px; font-weight: 700; color: var(--ink-soft); display: flex; flex-direction: column; align-items: flex-start; line-height: 1.3; }
.view-tab small { font-weight: 400; font-size: 11px; }
.view-tab[aria-current="page"] { color: var(--teal-deep); border-bottom-color: var(--coral); }

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 40px; outline: none; }
.app-foot { max-width: 1200px; margin: 0 auto; padding: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-soft); }
.foot-small { font-size: 12px; }

/* ---- 共通の部品 ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 1px solid transparent; font-size: 16px; font-weight: 700; text-decoration: none; }
.btn--main { background: var(--teal); color: #fff; }
.btn--main:hover:not(:disabled) { background: var(--teal-deep); }
.btn--sub { background: #fff; color: var(--teal-deep); border-color: var(--teal); }
.btn--ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn--warn { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn--sm { min-height: 40px; padding: 6px 12px; font-size: 14px; }
.btn--full { width: 100%; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.h2 { font-size: 20px; margin: 0 0 12px; font-family: var(--font-serif); letter-spacing: .04em; }
.h3 { font-size: 16px; margin: 18px 0 8px; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.note { background: var(--teal-pale); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.6; }
.note--warn { background: var(--coral-pale); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--teal-pale); color: var(--teal-deep); margin-right: 4px; white-space: nowrap; }
.tag--coral { background: var(--coral-pale); color: #8A4426; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack > * + * { margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.field { display: block; margin: 12px 0; }
.field > span { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.field .opt { font-weight: 400; font-size: 12px; color: var(--ink-soft); margin-left: 6px; }
.field .req { font-weight: 400; font-size: 12px; color: #fff; background: var(--coral); border-radius: 4px; padding: 0 6px; margin-left: 6px; }
input[type="text"], input[type="number"], input[type="month"], select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 10px 12px; font-size: 16px; }
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.err { color: var(--danger); font-size: 14px; font-weight: 700; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.tbl th { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.tbl-wrap { overflow-x: auto; }

/* ---- お客様の画面：スマホの枠と説明 ---- */
.cust-layout { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 28px; align-items: start; }
.phone { width: 100%; max-width: 400px; margin: 0 auto; background: #fff; border: 10px solid #26302F; border-radius: 34px; min-height: 700px; box-shadow: 0 12px 30px rgba(0,0,0,.18); overflow: hidden; display: flex; flex-direction: column; }
.phone-top { height: 26px; background: #26302F; display: flex; justify-content: center; }
.phone-top::after { content: ""; width: 90px; height: 16px; border-radius: 0 0 12px 12px; background: #111; }
.screen { flex: 1; padding: 20px 18px 24px; display: flex; flex-direction: column; }
.screen-store { font-size: 12px; color: var(--ink-soft); letter-spacing: .06em; margin: 0 0 6px; }
.screen h2 { font-size: 21px; margin: 0 0 10px; line-height: 1.5; font-family: var(--font-serif); }
.screen .lead { font-size: 16px; margin: 0 0 14px; }
.screen-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.progress { height: 6px; background: var(--teal-pale); border-radius: 999px; margin: 0 0 16px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--teal); border-radius: 999px; }
.choice { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-height: 52px; margin-bottom: 8px; box-shadow: var(--shadow); }
.choice .t { display: block; font-weight: 700; font-size: 16px; }
.choice .d { display: block; font-size: 13px; color: var(--ink-soft); }
.choice--main { border-color: var(--teal); background: var(--teal-pale); }
.choice[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-pale); outline: 2px solid var(--teal); }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-btn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 10px 14px; min-height: 44px; font-size: 15px; }
.opt-btn[aria-pressed="true"] { background: var(--teal); color: #fff; border-color: var(--teal); }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale .opt-btn { border-radius: 10px; padding: 10px 0; font-weight: 700; font-size: 18px; }
.scale-lb { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.fair { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; margin: 10px 0 0; }
.explain { position: sticky; top: 64px; }
.explain .step-name { font-size: 12px; color: var(--coral); font-weight: 700; letter-spacing: .08em; }
.explain h3 { margin: 4px 0 8px; font-size: 18px; }
.explain ul { padding-left: 1.2em; margin: 8px 0; }
.explain li { margin: 4px 0; }

/* QR 見本 */
.qr { width: 100%; max-width: 180px; aspect-ratio: 1; margin: 6px auto 10px; display: block; }
.qr-cap { text-align: center; font-size: 12px; color: var(--ink-soft); margin: 0 0 10px; }
.place-pick { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }

/* 遊び */
.fortune-res { text-align: center; background: var(--teal-pale); border-radius: 14px; padding: 18px 14px; margin: 10px 0; }
.fortune-color { display: inline-block; width: 46px; height: 46px; border-radius: 50%; border: 3px solid #fff; box-shadow: var(--shadow); vertical-align: middle; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.mcard { aspect-ratio: 3 / 4; border-radius: 10px; border: 0; background: var(--teal); color: #fff; font-size: 26px; display: grid; place-items: center; box-shadow: var(--shadow); transition: transform .15s; }
.mcard[data-open="1"] { background: #fff; border: 2px solid var(--teal); color: inherit; }
.mcard[data-done="1"] { background: var(--teal-pale); border: 2px solid var(--teal-pale); }
.mcard:active { transform: scale(.96); }
.hitokoto-box { min-height: 120px; display: grid; place-items: center; text-align: center; background: var(--coral-pale); border-radius: 14px; padding: 18px; font-size: 17px; margin: 10px 0; }

/* お礼・終わり */
.gift { border: 2px dashed var(--coral); border-radius: 14px; padding: 16px; text-align: center; background: #fff; }
.gift .what { font-size: 22px; font-weight: 700; color: #8A4426; margin: 4px 0; }
.gift .when { font-size: 15px; font-weight: 700; }
.code { font-family: ui-monospace, "Consolas", monospace; font-size: 26px; letter-spacing: .2em; font-weight: 700; color: var(--teal-deep); text-align: center; background: var(--teal-pale); border-radius: 10px; padding: 6px; }
.done-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-size: 28px; margin: 6px auto 10px; }

/* ---- お店の画面 ---- */
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 16px; }
.subtab { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 14px; min-height: 40px; }
.subtab[aria-current="page"] { background: var(--teal); color: #fff; border-color: var(--teal); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 26px; line-height: 1.2; color: var(--teal-deep); }
.stat span { font-size: 12px; color: var(--ink-soft); }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 52px 1fr 40px; gap: 8px; align-items: center; font-size: 13px; }
.bar i { display: block; height: 14px; background: var(--teal); border-radius: 4px; min-width: 2px; }
.ans { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 12px; margin-bottom: 8px; }
.ans-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; }
.ans-body { margin-top: 8px; font-size: 14px; }
.ans-body dt { font-size: 12px; color: var(--ink-soft); }
.ans-body dd { margin: 0 0 6px; white-space: pre-wrap; word-break: break-word; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.draft-opt { white-space: pre-wrap; }
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.qr-card { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 14px; text-align: center; }
.takehome { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 16px; max-width: 420px; font-size: 14px; }

/* ---- 小窓・お知らせ ---- */
#modal-root { position: fixed; inset: 0; z-index: 80; background: rgba(20, 30, 30, .45); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--paper); border-radius: 16px; max-width: 520px; width: 100%; max-height: 85vh; overflow: auto; padding: 20px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.on { opacity: 1; }

/* ---- 狭い画面 ---- */
@media (max-width: 860px) {
  .cust-layout { grid-template-columns: 1fr; }
  .explain { position: static; }
}
@media (max-width: 480px) {
  main { padding: 12px 0 32px; }
  .phone { border: 0; border-radius: 0; box-shadow: none; min-height: 0; }
  .phone-top { display: none; }
  .explain { margin: 0 12px; }
  .shop-wrap, .admin-wrap { padding: 0 12px; }
}

/* ---- 印刷（QRの印刷） ---- */
@media print {
  .demo-band, .app-head, .app-foot, .subtabs, .no-print { display: none !important; }
  body { background: #fff; }
  .qr-card, .takehome { break-inside: avoid; }
}
