/*
 * 配色は変数だけで決まる。店舗ロゴと喧嘩しないよう、ベースは無彩色に寄せ、色はアクセント1色に絞る。
 * アクセントは抑えた朱(墨紺・苔と比較して決定)。
 */
:root {
  --bg: #f5f5f2;
  --panel: #ffffff;
  --ink: #1f1f1d;
  --muted: #6d6c66;
  --line: #e3e2dc;
  --line-strong: #cfcdc5;
  --accent: #a8473a;
  --accent-dark: #86372c;
  --accent-soft: #f6ecea;
  --good-bg: #edf3ec;
  --good-ink: #2f5a2c;
  --info-bg: #f1f0eb;
  --info-ink: #4a4842;
  --warn-bg: #fbf3e2;
  --warn-ink: #6b4a0f;
  --radius: 10px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.7;
  letter-spacing: .02em;
  font-feature-settings: "palt";
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 16px 88px;
}

h1, h2, p { margin: 0; }

h2 {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: 12px;
}

a { color: var(--accent); text-underline-offset: 3px; }

/* ---- ヘッダー ---- */
.event-header { padding: 28px 4px 20px; text-align: center; }
/* カード画面の左上。standalone表示では戻る操作がないため、一覧(トップ)への導線を置く */
.back-nav { padding: 12px 4px 0; font-size: .8rem; }
.back-nav a { color: var(--muted); text-decoration: none; display: inline-block; padding: 6px 0; }
.back-nav + .event-header { padding-top: 12px; }
/* ロゴは高さを固定し、横長・縦長・正方形のどれでも枠内に収める */
.event-logo {
  display: block;
  width: auto;
  max-width: min(240px, 70%);
  height: 64px;
  margin: 0 auto 16px;
  object-fit: contain;
}
.eyebrow {
  font-size: .7rem;
  letter-spacing: .3em;
  color: var(--muted);
  margin-bottom: 6px;
}
.event-header h1 { font-size: 1.35rem; line-height: 1.45; font-weight: 700; }
.period {
  display: inline-block;
  color: var(--muted);
  font-size: .8rem;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-strong);
  font-variant-numeric: tabular-nums;
}

/* ---- パネルと通知 ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}
.message-panel { margin-top: 40px; text-align: center; padding: 32px 20px; }
.message-panel h1 { font-size: 1.1rem; margin-bottom: 12px; }
.message-panel p { color: var(--muted); }
.confirm-panel { text-align: center; padding: 28px 20px; }
.confirm-panel .button { margin: 20px 0 16px; }

.notice {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  font-weight: 600;
  font-size: .9rem;
}
.notice-good { background: var(--good-bg); color: var(--good-ink); }
.notice-info { background: var(--info-bg); color: var(--info-ink); }
.notice-warn { background: var(--warn-bg); color: var(--warn-ink); font-weight: 400; }
.notice-warn strong { display: block; margin-bottom: 4px; }

/* ---- スタンプカード ---- */
.progress {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .12em;
  margin-bottom: 16px;
}
.progress strong {
  color: var(--accent);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0;
  margin-right: 2px;
  font-variant-numeric: tabular-nums;
}

.stamps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: 14px;
  margin: 0 0 20px;
  padding: 0;
}
.stamp {
  aspect-ratio: 1;
  border: 1.5px dashed var(--line-strong);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--line-strong);
}
.stamp-number { font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
/* 判子風: 外枠と内側の細い線の二重丸 */
.stamp.is-filled {
  border: 2px solid var(--accent);
  box-shadow: inset 0 0 0 3px var(--panel), inset 0 0 0 4px var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  transform: rotate(-8deg);
}
.stamp-mark { font-size: 1.3rem; font-weight: 700; line-height: 1.1; }
.stamp-date { font-size: .65rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stamp.is-new { animation: press .5s cubic-bezier(.2, .8, .3, 1.2); }

@keyframes press {
  0% { transform: scale(1.8) rotate(-8deg); opacity: 0; }
  70% { transform: scale(.94) rotate(-8deg); opacity: 1; }
  100% { transform: scale(1) rotate(-8deg); }
}
@media (prefers-reduced-motion: reduce) {
  .stamp.is-new { animation: none; }
}

/* ---- ボタン ---- */
.button {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  letter-spacing: .06em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s;
}
.button:hover { background: var(--accent-dark); }
.button:disabled { opacity: .5; cursor: default; }
.button-light { background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong); }
.button-light:hover { background: var(--bg); }

.status { text-align: center; color: var(--muted); font-weight: 600; font-size: .9rem; }
.error { color: #a3352b; margin-top: 12px; font-size: .875rem; }

/* ---- 特典 ---- */
.rewards { list-style: none; margin: 0; padding: 0; }
.reward { display: flex; gap: 14px; align-items: flex-start; }
.reward + .reward { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.reward p { font-size: .875rem; color: var(--muted); }
.reward-badge {
  flex: none;
  min-width: 60px;
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: .75rem;
  text-align: center;
  white-space: nowrap;
}
.reward.is-achieved .reward-badge { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.reward p.reward-hint { color: var(--accent); font-weight: 600; }
.reward p.reward-done { color: var(--good-ink); font-weight: 600; }
.reward.is-redeemed .reward-badge { background: var(--good-bg); border-color: var(--good-bg); color: var(--good-ink); font-weight: 600; }
.reward-body { flex: 1; min-width: 0; }
.reward-body .button { margin-top: 10px; }

/* ---- 引換ダイアログ ---- */
.redeem {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 20, 18, .6);
}
.redeem-box {
  width: min(100%, 420px);
  max-height: 100%;
  overflow-y: auto;
  padding: 24px 20px;
  border-radius: 14px;
  background: var(--panel);
}
.redeem-box h2 { font-size: 1rem; color: var(--ink); letter-spacing: .04em; }
.redeem-reward { font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.redeem-box label { display: block; margin-top: 16px; font-weight: 600; font-size: .875rem; }
.redeem-box input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: inherit;
  font-size: 1.25rem;
  letter-spacing: .3em;
  text-align: center;
  background: #fff;
}
.redeem-box input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.redeem-box .button { margin-top: 12px; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: .65rem;
  letter-spacing: .3em;
  padding-top: 16px;
}
.footer a { color: inherit; }

/* ---- トップページ ---- */
.site-header h1 { font-size: 1.5rem; letter-spacing: .08em; }
.lead { margin-top: 12px; color: var(--muted); font-size: .875rem; }
.event-list { list-style: none; margin: 0; padding: 0; }
.event-list li + li { border-top: 1px solid var(--line); }
.event-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  color: inherit;
  text-decoration: none;
}
.event-list li:first-child .event-item { padding-top: 0; }
.event-list li:last-child .event-item { padding-bottom: 0; }
.event-thumb {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.2rem;
}
.event-thumb img { width: 100%; height: 100%; padding: 4px; object-fit: contain; }
.event-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.event-item-title { font-weight: 600; line-height: 1.45; }
.event-item-meta { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.phase {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: .7rem;
}
.phase-open { border-color: var(--accent); color: var(--accent); }
.event-item-count { flex: none; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.event-item-count strong { color: var(--accent); font-size: 1.25rem; }
.event-item::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-top: 1.5px solid var(--line-strong);
  border-right: 1.5px solid var(--line-strong);
  transform: rotate(45deg);
}
.hint, .empty { margin-top: 14px; font-size: .8rem; color: var(--muted); }
.empty { margin-top: 0; }

/* ---- ホーム画面に追加する案内 ---- */
.a2hs { border-color: var(--accent); background: var(--accent-soft); }
.a2hs h2 { color: var(--accent); }
.a2hs p { font-size: .875rem; }
.a2hs .a2hs-steps { margin-top: 10px; }
.share-icon {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  vertical-align: -.2em;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.a2hs-actions { display: flex; gap: 8px; margin-top: 14px; }
.a2hs-actions .button { min-height: 44px; }
.a2hs-actions .button-light { flex: none; width: auto; padding: 8px 20px; }

/* ---- アプリ内ブラウザの案内 ---- */
.in-app { margin-top: 12px; }
.in-app p { font-size: .875rem; }
.in-app .button { margin-top: 12px; min-height: 44px; }

/* ---- ご利用の前に ---- */
.howto {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  counter-reset: howto;
}
.howto li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
  line-height: 1.5;
  text-align: center;
  counter-increment: howto;
}
.howto li + li::before {
  content: "";
  position: absolute;
  top: 26px;
  left: -10px;
  width: 8px;
  height: 8px;
  border-top: 1.5px solid var(--line-strong);
  border-right: 1.5px solid var(--line-strong);
  transform: rotate(45deg);
}
.howto svg {
  width: 56px;
  height: 56px;
  padding: 6px;
  border-radius: 50%;
  background: var(--accent-soft);
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cautions { margin: 0; padding: 0; list-style: none; font-size: .825rem; color: var(--muted); }
.cautions li { position: relative; padding-left: 16px; }
.cautions li + li { margin-top: 8px; }
.cautions li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .7em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.cautions strong { color: var(--ink); font-weight: 600; }

/* ---- カメラ ---- */
.camera {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background: #111;
  color: #fff;
}
.camera-frame {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 14px;
  background: #000;
}
.camera-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-guide {
  position: absolute;
  inset: 15%;
  border: 2px solid rgba(255, 255, 255, .85);
  border-radius: 12px;
}
.camera-message { text-align: center; min-height: 3.4em; }
.camera .button { width: min(100%, 420px); }
.camera .button-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }

/* ---- デバッグバー(production では出ない) ---- */
.debug-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background: #1f1f1d;
  color: #fff;
  font-size: .8rem;
}
.debug-bar input, .debug-bar button, .debug-bar select { font: inherit; padding: 2px 6px; }
