/*
 * ハコチケ UI — Spindle（Ameba）風のポップで使いやすい見た目を素の CSS で再現
 * 主色: 緑（LINE の緑 #06C755 とは別の深めの緑）／アクセント: 黄色
 */
:root {
  --green: #0a9f5a;
  --green-strong: #077a45;
  --green-soft: #e3f5ec;
  --yellow: #ffc21a;
  --yellow-soft: #fff4d1;
  --ink: #1f2420;
  --ink-sub: #5c645f;
  --ink-mute: #8a918c;
  --line: #e2e6e3;
  --bg: #f6f7f5;
  --white: #fff;
  --red: #d93a3a;
  --red-soft: #fdeaea;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --shadow: 0 2px 0 rgba(31, 36, 32, 0.06), 0 6px 18px rgba(31, 36, 32, 0.06);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--green-strong); }
h1, h2, h3 { line-height: 1.4; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ── レイアウト ── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 800; letter-spacing: 0.04em; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; }
.wrap.wide { max-width: 1040px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap-row { flex-wrap: wrap; }
.grow { flex: 1; }
.center { text-align: center; }
.muted { color: var(--ink-sub); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.hidden { display: none !important; }
.page-title { font-size: 22px; font-weight: 800; margin-bottom: 12px; }
.section-title { font-size: 17px; font-weight: 800; margin: 28px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 6px; height: 20px; border-radius: 3px; background: var(--yellow); }
.footer { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; padding: 24px 16px 40px; font-size: 12px; }
.footer a { color: var(--ink-sub); }

/* ── カード ── */
.card { background: var(--white); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: 20px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card + .card { margin-top: 14px; }

/* チケット形（半券の切り欠き） */
.ticket {
  position: relative; background: var(--white); border-radius: var(--radius-l);
  box-shadow: var(--shadow); overflow: hidden;
}
.ticket .ticket-head { background: var(--green); color: var(--white); padding: 18px 20px 16px; }
.ticket .ticket-head .eyebrow { color: var(--yellow); font-weight: 800; font-size: 12px; letter-spacing: 0.08em; }
.ticket .ticket-head h2 { font-size: 20px; font-weight: 800; margin-top: 2px; }
.ticket .ticket-body { padding: 18px 20px 20px; }
.ticket .perforation { position: relative; height: 0; border-top: 2px dashed var(--line); margin: 0 18px; }
.ticket .perforation::before, .ticket .perforation::after {
  content: ""; position: absolute; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg);
}
.ticket .perforation::before { left: -30px; }
.ticket .perforation::after { right: -30px; }

/* 情報リスト */
.info { display: grid; grid-template-columns: 5.5em 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.info dt { color: var(--ink-sub); }
.info dd { margin: 0; font-weight: 600; }

/* ── ボタン ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 2px solid transparent;
  font-weight: 800; font-size: 16px; text-decoration: none; cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.block { display: flex; width: 100%; }
.btn.primary { background: var(--green); color: var(--white); box-shadow: 0 3px 0 var(--green-strong); }
.btn.primary:hover { background: #0b9254; }
.btn.accent { background: var(--yellow); color: var(--ink); box-shadow: 0 3px 0 #d9a10c; }
.btn.secondary { background: var(--white); color: var(--green-strong); border-color: var(--green); }
.btn.ghost { background: transparent; color: var(--ink-sub); min-height: 40px; font-size: 14px; }
.btn.danger { background: var(--white); color: var(--red); border-color: var(--red); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }

/* ── フォーム ── */
.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--ink-sub); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--radius-m);
  border: 2px solid var(--line); background: var(--white); outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--green); margin: 1px 0 0; flex: none; }
.choice { display: grid; gap: 8px; }
.choice label {
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--radius-m);
  border: 2px solid var(--line); background: var(--white); cursor: pointer; font-weight: 700;
}
.choice input { accent-color: var(--green); width: 20px; height: 20px; }
.choice label:has(input:checked) { border-color: var(--green); background: var(--green-soft); }

/* 枚数ステッパー */
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border-radius: 999px; padding: 4px; }
.stepper button {
  width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--white);
  font-size: 20px; font-weight: 800; color: var(--green-strong); cursor: pointer; box-shadow: 0 1px 0 var(--line);
}
.stepper button:disabled { color: var(--ink-mute); cursor: not-allowed; }
.stepper output { min-width: 30px; text-align: center; font-weight: 800; font-size: 18px; }

.type-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.type-row:last-child { border-bottom: none; }
.type-row .name { font-weight: 800; }
.type-row .price { font-weight: 800; color: var(--green-strong); font-size: 17px; }

/* ── バッジ・お知らせ ── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--bg); color: var(--ink-sub); }
.badge.green { background: var(--green-soft); color: var(--green-strong); }
.badge.yellow { background: var(--yellow-soft); color: #8a6200; }
.badge.red { background: var(--red-soft); color: var(--red); }
.note { padding: 12px 14px; border-radius: var(--radius-m); background: var(--yellow-soft); font-size: 14px; }
.note.green { background: var(--green-soft); }
.note.red { background: var(--red-soft); color: #8f1f1f; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--white); padding: 12px 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* ── ヒーロー（購入LP） ── */
.hero { background: var(--green); color: var(--white); border-radius: 0 0 var(--radius-l) var(--radius-l); padding: 24px 20px 28px; position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%;
  background: var(--yellow); opacity: 0.9;
}
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { display: inline-block; background: var(--yellow); color: var(--ink); font-weight: 800; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.hero h1 { font-size: 26px; font-weight: 900; margin-top: 10px; }
.hero .artist { opacity: 0.92; font-weight: 700; margin-top: 4px; }
.hero .when { margin-top: 14px; font-weight: 800; font-size: 16px; }

/* 下部固定の購入バー */
.buybar {
  position: sticky; bottom: 0; z-index: 9; margin: 20px -16px -48px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line); backdrop-filter: blur(8px);
}
.total { font-weight: 900; font-size: 20px; }

/* 決済シート */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20, 24, 21, 0.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--white);
  border-radius: var(--radius-l) var(--radius-l) 0 0; padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }

/* ── LIFF マイチケット ── */
.live-ticket { position: relative; overflow: hidden; border-radius: var(--radius-l); color: var(--white); box-shadow: var(--shadow); }
.live-ticket .bg {
  position: absolute; inset: -50%;
  background: conic-gradient(from 0deg, #0a9f5a, #13b86b, #ffc21a, #0f8d52, #0a9f5a);
  animation: spin 6s linear infinite; opacity: 0.95;
}
.live-ticket .bg::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,0.08) 0 12px, transparent 12px 24px);
  animation: slide 2.4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide { to { background-position: 34px 0; } }
.live-ticket .inner { position: relative; padding: 18px 18px 20px; }
.live-ticket.used .bg { animation: none; background: #6f7671; }
.live-ticket.used .bg::after { animation: none; }
.clock { font-variant-numeric: tabular-nums; font-weight: 900; font-size: 34px; letter-spacing: 0.04em; text-shadow: 0 2px 0 rgba(0,0,0,0.15); }
.clock .sec { font-size: 22px; opacity: 0.9; }
.number-big { font-size: 46px; font-weight: 900; line-height: 1; }
.pill-white { display: inline-block; background: rgba(255,255,255,0.92); color: var(--green-strong); font-weight: 800; font-size: 12px; border-radius: 999px; padding: 3px 10px; }

/* スワイプ */
.swipe { position: relative; height: 62px; border-radius: 999px; background: rgba(255,255,255,0.25); border: 2px solid rgba(255,255,255,0.7); overflow: hidden; touch-action: none; user-select: none; }
.swipe .label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 14px 0 60px; font-weight: 800; letter-spacing: 0.04em; font-size: 14px; text-align: center; line-height: 1.3; }
.swipe .knob {
  position: absolute; left: 4px; top: 4px; width: 50px; height: 50px; border-radius: 50%; background: var(--yellow);
  display: flex; align-items: center; justify-content: center; color: var(--ink); font-weight: 900; font-size: 22px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.18); cursor: grab;
}
.swipe.disabled { opacity: 0.55; }
.used-stamp {
  display: inline-block; border: 4px solid var(--white); color: var(--white); font-weight: 900; font-size: 26px;
  padding: 4px 18px; border-radius: 12px; transform: rotate(-8deg); letter-spacing: 0.1em;
}
.qr-box { background: var(--white); border-radius: var(--radius-m); padding: 12px; display: inline-block; }
.qr-box img, .qr-box svg { width: 200px; height: 200px; }

/* ダイアログ */
dialog { border: none; border-radius: var(--radius-l); padding: 22px; max-width: 360px; width: calc(100% - 32px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(20, 24, 21, 0.5); }

/* ── 受付スキャン ── */
.scan-body { background: #101412; color: var(--white); min-height: 100vh; }
.scan-body .topbar { background: rgba(16, 20, 18, 0.92); border-color: #2a302c; }
.scan-body .brand { color: var(--white); }
.scan-video { position: relative; border-radius: var(--radius-l); overflow: hidden; background: #000; aspect-ratio: 1 / 1; }
.scan-video video { width: 100%; height: 100%; object-fit: cover; }
.scan-video .frame { position: absolute; inset: 18%; border: 4px solid var(--yellow); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,0.25); }
.scan-result { border-radius: var(--radius-l); padding: 18px; text-align: center; font-weight: 800; }
.scan-result .big { font-size: 30px; font-weight: 900; }
.scan-result.ok { background: var(--green); }
.scan-result.ng { background: var(--red); }
.scan-result.warn { background: var(--yellow); color: var(--ink); }
.scan-result.idle { background: #1d2420; color: #b9c2bc; }
.dark-card { background: #1b211d; border-radius: var(--radius-l); padding: 16px; }
.dark-card .input { background: #101412; border-color: #343c37; color: var(--white); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--ink-mute); }
.status-dot.on { background: #3ad37f; }
.status-dot.off { background: var(--yellow); }

/* ── 管理画面 ── */
.admin-body { background: var(--bg); }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.tabs button { border: none; background: var(--white); border-radius: 999px; padding: 8px 16px; font-weight: 800; color: var(--ink-sub); cursor: pointer; white-space: nowrap; box-shadow: 0 1px 0 var(--line); }
.tabs button[aria-selected="true"] { background: var(--green); color: var(--white); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--white); border-radius: var(--radius-m); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: #fafbfa; color: var(--ink-sub); font-size: 12px; font-weight: 800; }
.table-scroll { overflow-x: auto; border-radius: var(--radius-m); box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: var(--white); border-radius: var(--radius-m); padding: 12px 14px; box-shadow: var(--shadow); }
.stat .v { font-size: 24px; font-weight: 900; }
.stat .k { font-size: 12px; color: var(--ink-sub); font-weight: 700; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

/* 法務ページ */
.legal-list { display: grid; grid-template-columns: 1fr; gap: 0; background: var(--white); border-radius: var(--radius-l); padding: 6px 18px; box-shadow: var(--shadow); }
.legal-list dt { font-weight: 800; padding-top: 14px; font-size: 14px; }
.legal-list dd { margin: 4px 0 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.legal-list dd:last-child { border-bottom: none; }
.legal h2 { font-size: 16px; margin: 22px 0 8px; }

@media (prefers-reduced-motion: reduce) {
  .live-ticket .bg, .live-ticket .bg::after { animation-duration: 20s; }
}

/* 狭い画面: 表は横スクロール・ボタンは折り返さない */
.btn { white-space: nowrap; }
.table-scroll .table { min-width: 720px; }
.table th, .table td { white-space: nowrap; }
.table td details pre { white-space: pre-wrap; }
.stat .k { line-height: 1.4; }
