/* TenPo 来店ポイント — 単色(温オフホワイト)＋1アクセント / 明朝見出し / SVGアイコン */
:root {
  --bg: #fbf7f0;
  --surface: #ffffff;
  --surface-2: #f4eee3;
  --ink: #1a1a1a;
  --ink-2: #4a443b;
  --muted: #8f8676;
  --line: #e8e0d3;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --good: #2e7d52;
  --danger: #b3261e;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 50, 35, 0.06), 0 8px 24px rgba(60, 50, 35, 0.06);
  --serif: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); }

.app { min-height: 100dvh; }
.boot { display: grid; place-items: center; min-height: 100dvh; color: var(--muted); }

/* ===== レイアウト ===== */
.shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}
@media (min-width: 520px) {
  .shell { box-shadow: var(--shadow); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
.topbar {
  padding: max(18px, env(safe-area-inset-top)) 20px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.topbar .store {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: none;
}
.topbar .owner-link { font-size: 12px; color: var(--muted); text-decoration: none; border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; }
.screen { flex: 1; padding: 4px 20px 108px; }
.page-title { font-family: var(--serif); font-size: 24px; font-weight: 700; letter-spacing: 0.02em; margin: 6px 0 18px; }

/* ===== ボタン ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 13px 18px; border-radius: 12px; font-size: 15px; font-weight: 600; text-decoration: none;
  width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { width: auto; padding: 9px 14px; font-size: 13px; border-radius: 10px; }

/* ===== カード ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.muted { color: var(--muted); }
.section-label { font-size: 12px; letter-spacing: 0.1em; color: var(--muted); margin: 26px 4px 10px; }

/* ===== ホーム：ポイントリング ===== */
.points-hero { display: flex; flex-direction: column; align-items: center; padding: 14px 18px 22px; }
.ring-wrap { position: relative; width: 220px; height: 220px; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 14; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.ring-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-center .pt { font-family: var(--serif); font-size: 56px; font-weight: 700; line-height: 1; }
.ring-center .unit { font-size: 14px; color: var(--muted); margin-top: 6px; letter-spacing: 0.08em; }
.next-line { text-align: center; margin-top: 16px; font-size: 14px; color: var(--ink-2); }
.next-line b { color: var(--accent); }
.redeem-now { text-align: center; margin-top: 10px; font-size: 14px; color: var(--good); font-weight: 700; }

/* ===== 履歴リスト ===== */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.row .ico { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.row .body { flex: 1; min-width: 0; }
.row .ttl { font-size: 14px; font-weight: 600; }
.row .sub { font-size: 12px; color: var(--muted); }
.row .delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.row .delta.plus { color: var(--good); }
.row .delta.minus { color: var(--ink-2); }
.empty { text-align: center; color: var(--muted); padding: 28px 8px; font-size: 14px; }

/* ===== icon ===== */
.svgico { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ===== タブバー ===== */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 8px 6px max(8px, env(safe-area-inset-bottom));
  z-index: 20;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: none; color: var(--muted); padding: 6px 0; font-size: 10px; }
.tab .svgico { width: 24px; height: 24px; }
.tab.active { color: var(--accent); }
.tab.scan { position: relative; }
.tab.scan .pill { width: 46px; height: 36px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.tab.scan .pill .svgico { stroke: #fff; }

/* ===== ログイン ===== */
.auth { padding: 8vh 24px 24px; max-width: 480px; margin: 0 auto; }
.brandmark { width: 64px; height: 64px; border-radius: 18px; background: var(--accent); display: grid; place-items: center; color: #fff; margin-bottom: 22px; }
.brandmark .svgico { width: 34px; height: 34px; stroke: #fff; }
.auth h1 { font-family: var(--serif); font-size: 28px; margin: 0 0 6px; }
.auth p.lead { color: var(--ink-2); margin: 0 0 26px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 14px; font-size: 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink);
}
.field input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
.fineprint { font-size: 12px; color: var(--muted); margin-top: 16px; line-height: 1.7; }

/* ===== reward ===== */
.reward { display: flex; align-items: center; gap: 14px; }
.reward .cost { flex: none; width: 64px; text-align: center; }
.reward .cost .n { font-family: var(--serif); font-size: 26px; font-weight: 700; line-height: 1; }
.reward .cost .u { font-size: 11px; color: var(--muted); }
.reward .info { flex: 1; min-width: 0; }
.reward .info .t { font-weight: 700; font-size: 15px; }
.reward .info .d { font-size: 12.5px; color: var(--muted); }
.reward .act { flex: none; }
.reward-locked { opacity: 0.6; }

/* ===== scan ===== */
.scanview { display: flex; flex-direction: column; align-items: center; }
.cam-frame { position: relative; width: 100%; max-width: 360px; aspect-ratio: 1; border-radius: 20px; overflow: hidden; background: #000; margin: 8px 0 18px; }
.cam-frame video { width: 100%; height: 100%; object-fit: cover; }
.cam-frame .reticle { position: absolute; inset: 14%; border: 2px solid rgba(255,255,255,0.85); border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(0,0,0,0.28); }
.scan-hint { color: var(--ink-2); font-size: 14px; text-align: center; }
.scan-err { color: var(--danger); font-size: 13px; text-align: center; margin-top: 8px; }

/* ===== modal / toast ===== */
.modal-bg { position: fixed; inset: 0; background: rgba(26,22,16,0.5); display: grid; place-items: center; z-index: 50; padding: 24px; }
.modal { background: var(--surface); border-radius: 20px; padding: 26px 22px; width: 100%; max-width: 360px; text-align: center; box-shadow: var(--shadow); }
.modal h3 { font-family: var(--serif); font-size: 22px; margin: 10px 0 6px; }
.code-big { font-family: var(--serif); font-size: 40px; font-weight: 700; letter-spacing: 0.18em; margin: 14px 0; color: var(--accent); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 92px; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); }

/* 来店成功の演出 */
.celebrate { animation: pop .5s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.plusburst { font-family: var(--serif); font-size: 48px; font-weight: 700; color: var(--good); }

/* ===== kiosk ===== */
.kiosk { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; background: var(--bg); }
.kiosk .k-store { font-family: var(--serif); font-size: 30px; font-weight: 700; }
.kiosk .k-sub { color: var(--ink-2); margin: 6px 0 26px; font-size: 16px; }
.kiosk .qbox { background: #fff; padding: 22px; border-radius: 22px; box-shadow: var(--shadow); }
.kiosk .qbox img, .kiosk .qbox canvas { display: block; width: min(64vw, 380px); height: auto; image-rendering: pixelated; }
.kiosk .k-foot { margin-top: 24px; color: var(--muted); font-size: 13px; }
.kiosk .k-exit { position: fixed; top: 16px; right: 16px; font-size: 12px; color: var(--muted); text-decoration: none; border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; }

/* ===== admin ===== */
.admin { max-width: 720px; margin: 0 auto; padding: 16px 16px 40px; }
.admin h1 { font-family: var(--serif); font-size: 22px; margin: 8px 4px 14px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 4px; }
.tabs button { white-space: nowrap; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); padding: 8px 14px; border-radius: 999px; font-size: 13px; }
.tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat .n { font-family: var(--serif); font-size: 28px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.tbl th { text-align: left; background: var(--surface-2); color: var(--ink-2); font-weight: 600; padding: 10px; font-size: 12px; }
table.tbl td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.badge.issued { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.badge.used { color: var(--muted); }
.adm-form { display: grid; gap: 10px; }
.adm-form input, .adm-form textarea, .adm-form select { padding: 11px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; font-family: inherit; background: var(--surface); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-btn { background: none; border: none; color: var(--accent); font-size: 13px; padding: 4px; }
.link-btn.danger { color: var(--danger); }

.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .ring-fg { transition: none; }
  .celebrate { animation: none; }
}
