/* レイアウト: 左に画面の一覧、右に編集する中身。スマホでは一覧を上の横並びのタブにする */
:root {
  --bg: #eef3f0;
  --surface: #ffffff;
  --surface-2: #e3ebe7;
  --ink: #13201a;
  --muted: #5b6b63;
  --line: #d2ddd7;
  --felt: #0f6b4f;
  --felt-ink: #ffffff;
  --felt-soft: #d6eadf;
  --danger: #c4372c;
  --danger-soft: #f8dedb;
  --gold: #b77a06;
  --gold-soft: #fbeccb;
  --phone: #0d1512;
  --shadow: 0 1px 2px rgba(19, 32, 26, .08), 0 4px 14px rgba(19, 32, 26, .06);
  --font-body: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  --font-num: "Space Grotesk", "SF Pro Rounded", system-ui, sans-serif;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1411; --surface: #13201b; --surface-2: #1b2b24; --ink: #e6efea; --muted: #8fa298;
    --line: #263a31; --felt: #34b885; --felt-ink: #06140f; --felt-soft: #173b2d;
    --danger: #ff6f61; --danger-soft: #3a1b18; --gold: #f2b440; --gold-soft: #3a2c10;
    --phone: #000000; --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1411; --surface: #13201b; --surface-2: #1b2b24; --ink: #e6efea; --muted: #8fa298;
  --line: #263a31; --felt: #34b885; --felt-ink: #06140f; --felt-soft: #173b2d;
  --danger: #ff6f61; --danger-soft: #3a1b18; --gold: #f2b440; --gold-soft: #3a2c10;
  --phone: #000000; --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.6;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--felt); outline-offset: 2px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
h1, h2, h3 { text-wrap: balance; margin: 0; line-height: 1.35; }

.envbar {
  max-width: 1120px; margin: 12px auto 0; padding: 8px 14px; border-radius: 10px;
  background: var(--gold-soft); color: var(--ink); font-size: 13px;
}
.envbar b { color: var(--gold); }

/* ログイン */
.login { max-width: 400px; margin: 40px auto; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; border-radius: 50%; background: var(--felt); display: grid; place-items: center; }
.brand-mark span { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-family: var(--font-num); font-weight: 700; font-size: 13px; color: var(--ink); }
.brand h1 { font-size: 22px; font-weight: 900; }
.brand p { margin: 0; color: var(--muted); font-size: 13px; }

/* 枠 */
.shell { max-width: 1120px; margin: 12px auto 40px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px); display: flex; flex-direction: column; gap: 14px; }
.storechip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.storechip img { width: 40px; height: 40px; border-radius: 10px; flex: none; object-fit: cover; }
.storechip b { display: block; font-size: 14px; line-height: 1.3; }
.storechip small { color: var(--muted); font-size: 12px; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-weight: 500;
}
nav a:hover { background: var(--surface-2); }
nav a[aria-current="page"] { background: var(--felt); color: var(--felt-ink); font-weight: 700; }
nav svg { width: 18px; height: 18px; flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-left: auto; }

main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.bar h2 { font-size: 20px; font-weight: 900; margin-right: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--felt-soft); color: var(--felt); }
.pill.warn { background: var(--gold-soft); color: var(--gold); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--felt); border-color: var(--felt); color: var(--felt-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn svg { width: 16px; height: 16px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--felt); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card h3 { font-size: 16px; font-weight: 900; }
.card .lead { margin: -8px 0 0; color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

/* 項目 */
.fields { display: flex; flex-direction: column; }
.field { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 6px 18px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.field:first-child { border-top: 0; padding-top: 0; }
.field > label, .field > .label { font-weight: 700; padding-top: 8px; font-size: 14px; }
.field .req { color: var(--danger); font-size: 12px; margin-left: 4px; }
.control { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.err { color: var(--danger); font-size: 12px; margin: 0; font-weight: 700; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="tel"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
}
textarea { min-height: 84px; resize: vertical; }
input.bad { border-color: var(--danger); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row > input[type="number"] { width: 110px; }
.row > input[type="date"] { width: auto; flex: 1 1 150px; }
.count { margin-left: auto; color: var(--muted); font-size: 12px; }
.count.over { color: var(--danger); font-weight: 700; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 5px; width: 16px; height: 16px; accent-color: var(--felt); }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 11px; background: var(--surface-2); }
.seg button { border: 0; background: none; min-height: 34px; padding: 0 12px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 700; }
.swatch i { width: 24px; height: 24px; border-radius: 50%; display: block; }
.swatch[aria-pressed="true"] { border-color: var(--ink); }

.logo-edit { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.logo-edit img { width: 88px; height: 88px; border-radius: 18px; object-fit: cover; border: 1px solid var(--line); }

/* ホーム */
.status { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.status .big { font-size: 15px; }
.changes { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.changes li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.changes li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); flex: none; }
.history { display: flex; flex-direction: column; }
.history .item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.history .item:first-child { border-top: 0; }
.history .v { font-family: var(--font-num); font-weight: 700; width: 52px; }
.history .when { color: var(--muted); font-size: 13px; width: 130px; }
.history .what { flex: 1 1 200px; font-size: 13px; min-width: 0; }
.shortcuts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.shortcut { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--surface-2); color: var(--ink); text-decoration: none; }
.shortcut b { font-size: 14px; }
.shortcut span { color: var(--muted); font-size: 12px; }
.shortcut:hover { outline: 2px solid var(--felt); }
.qrmini { width: 96px; height: 96px; padding: 6px; background: #ffffff; border-radius: 8px; flex: none; }
.qrmini img, .qrmini canvas { width: 100% !important; height: 100% !important; }

/* 店ルール */
.gamelist { display: flex; flex-direction: column; }
.gamerow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.gamerow:first-child { border-top: 0; }
.gamerow .pos { width: 22px; color: var(--muted); font-family: var(--font-num); text-align: right; }
.gamerow .name { flex: 1; font-weight: 700; }
.gamerow .off { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.iconbtn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.iconbtn:disabled { opacity: .35; cursor: not-allowed; }
.iconbtn svg { width: 16px; height: 16px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); transition: transform .15s; }
.switch input:checked + span { background: var(--felt); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--felt); outline-offset: 2px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 0 -18px; padding: 0 18px; }
.tabs button { border: 0; background: none; padding: 10px 12px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--felt); }
.sets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.settab { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 13px; }
.settab[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.settab small { font-weight: 400; margin-left: 4px; opacity: .8; }
.lockbox { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.lockbox p { margin: 0; flex: 1 1 220px; font-size: 13px; color: var(--muted); }

/* プレビュー */
.phones { display: flex; flex-wrap: wrap; gap: 24px; justify-content: center; }
.phonewrap { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.phonewrap > b { font-size: 13px; color: var(--muted); }
.phone { width: 300px; max-width: 100%; aspect-ratio: 9 / 19; background: var(--phone); border-radius: 40px; padding: 12px; box-shadow: var(--shadow); }
.screen { height: 100%; border-radius: 30px; overflow: hidden; background: #eef3f0; color: #13201a; display: flex; flex-direction: column; font-size: 12px; }
.screen .sb { height: 26px; flex: none; display: flex; justify-content: space-between; align-items: center; padding: 0 22px; font-family: var(--font-num); font-weight: 700; font-size: 11px; }
.screen .band { padding: 10px 14px 14px; display: flex; align-items: center; gap: 10px; color: #ffffff; }
.screen .band img { width: 40px; height: 40px; border-radius: 10px; background: #ffffff; object-fit: cover; }
.screen .band b { font-size: 15px; display: block; line-height: 1.3; }
.screen .band small { opacity: .85; font-size: 10px; }
.screen .body { flex: 1; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.screen .notice { background: #fbeccb; border-radius: 10px; padding: 8px 10px; font-size: 11px; line-height: 1.5; }
.screen .notice b { display: block; font-size: 10px; color: #8a5b00; }
.screen .lbl { font-size: 10px; color: #5b6b63; font-weight: 700; letter-spacing: .04em; margin-top: 2px; }
.screen .gbtn { background: #ffffff; border-radius: 10px; padding: 9px 12px; font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 2px rgba(19, 32, 26, .08); }
.screen .gbtn small { font-weight: 400; color: #5b6b63; font-size: 10px; }
.screen .more { color: #5b6b63; font-size: 11px; padding: 2px 4px; }
.screen .foot { padding: 8px 12px 14px; display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; }
.screen .nav { padding: 8px 14px; display: flex; align-items: center; justify-content: space-between; background: #ffffff; border-bottom: 1px solid #d2ddd7; font-weight: 700; font-size: 13px; }
.screen .nav span { font-size: 11px; font-weight: 700; }
.screen .srow { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 7px 10px; background: #ffffff; border-top: 1px solid #e3ebe7; font-size: 11px; }
.screen .srow:first-child { border-top: 0; }
.screen .srow em { font-style: normal; font-weight: 700; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.screen .srow svg { width: 11px; height: 11px; }
.screen .group { border-radius: 10px; overflow: hidden; }
.screen .pick { display: flex; gap: 4px; flex-wrap: wrap; }
.screen .pick span { padding: 3px 9px; border-radius: 999px; background: #ffffff; font-weight: 700; font-size: 11px; }
.screen .pick span.on { color: #ffffff; }
.screen .cta { margin-top: auto; text-align: center; color: #ffffff; border-radius: 12px; padding: 10px; font-weight: 700; font-size: 13px; }

/* QR */
.qrlayout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.code { font-family: var(--font-num); font-weight: 700; font-size: 34px; letter-spacing: .18em; }
.urlbox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.urlbox code { padding: 6px 10px; background: var(--surface-2); border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; min-width: 0; }
.poster { width: 100%; aspect-ratio: 210 / 297; background: #ffffff; color: #13201a; border-radius: 6px; box-shadow: var(--shadow); padding: 9% 8%; display: flex; flex-direction: column; align-items: center; gap: 4%; text-align: center; }
.poster img.logo { width: 26%; border-radius: 14%; }
.poster h4 { margin: 0; font-size: 20px; font-weight: 900; }
.poster .qr { width: 56%; aspect-ratio: 1; }
.poster .qr img, .poster .qr canvas { width: 100% !important; height: 100% !important; }
.poster p { margin: 0; font-size: 12px; line-height: 1.6; }
.poster .pcode { font-family: var(--font-num); font-weight: 700; font-size: 18px; letter-spacing: .2em; }
.confirm { padding: 12px; border-radius: 12px; border: 2px solid var(--danger); background: var(--danger-soft); display: flex; flex-direction: column; gap: 10px; }
.confirm p { margin: 0; font-size: 13px; }

/* 公開の確認・通知 */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(5, 10, 8, .5); display: grid; place-items: center; padding: 16px; }
.dialog { width: min(460px, 100%); background: var(--surface); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.dialog h3 { font-size: 18px; font-weight: 900; }
.dialog p { margin: 0; font-size: 14px; }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
  nav a { white-space: nowrap; padding: 8px 12px; }
  .storechip { display: none; }
  .grid2, .qrlayout { grid-template-columns: minmax(0, 1fr); }
  .qrlayout .card:last-child { max-width: 340px; width: 100%; margin: 0 auto; }
}
@media (max-width: 620px) {
  .field { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .field > label, .field > .label { padding-top: 0; }
  .shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar h2 { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* 保存の状態・止まっているお店などの帯 */
.saved { color: var(--muted); font-size: 12px; white-space: nowrap; }
.saved.bad { color: var(--danger); font-weight: 700; }
.banner { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); background: var(--danger-soft); color: var(--ink); font-size: 14px; }
.banner.info { background: var(--gold-soft); }
.banner p { margin: 0; flex: 1 1 240px; }
.loading { max-width: 400px; margin: 80px auto; text-align: center; color: var(--muted); }
.sample { position: relative; }
.sample::after { content: "見本"; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 28px; color: var(--danger); background: rgba(255, 255, 255, .55); letter-spacing: .2em; }

/* ポスターだけを印刷する */
@media print {
  @page { size: A4; margin: 0; }
  body { background: #ffffff; padding: 0; }
  body > *:not(#app), .envbar, .side, .bar, .qrlayout > .card:first-child, .poster-head, .toast { display: none !important; }
  .shell, main, .qrlayout { display: block !important; margin: 0 !important; max-width: none !important; }
  .qrlayout > .card:last-child { box-shadow: none !important; padding: 0 !important; max-width: none !important; }
  .poster { box-shadow: none; border-radius: 0; width: 210mm; height: 297mm; aspect-ratio: auto; }
  .poster h4 { font-size: 30pt; }
  .poster p { font-size: 14pt; }
  .poster .pcode { font-size: 24pt; }
}
