:root {
  --bg: #f0fdfa;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #d1e7e3;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --danger: #b91c1c;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 16px/1.7 "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", Meiryo, sans-serif;
}
a { color: var(--primary); }
[hidden] { display: none !important; }

.header {
  background: var(--primary); color: #fff; font-weight: bold; text-align: center;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
}
.main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 16px; }
.footer { text-align: center; font-size: .8rem; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); }
.footer a { color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 20px; box-shadow: 0 1px 3px rgba(15, 118, 110, .08);
}
.card h1 { font-size: 1.3rem; margin: 0 0 12px; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.stack label { font-size: .9rem; color: var(--muted); }

.code-input {
  font: 600 1.6rem/1.2 ui-monospace, Consolas, monospace; letter-spacing: .12em; text-align: center;
  text-transform: uppercase; padding: 14px 12px; border: 2px solid var(--border); border-radius: 10px; width: 100%;
}
.code-input:focus { outline: none; border-color: var(--primary); }

.btn {
  display: block; width: 100%; text-align: center; text-decoration: none;
  font: inherit; font-weight: bold; padding: 14px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: var(--primary); cursor: pointer;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-hover); }
.actions { display: flex; gap: 12px; margin-top: 20px; }
.actions.vertical { flex-direction: column; }

.children { list-style: none; padding: 0; margin: 12px 0; }
.children li {
  padding: 10px 14px; background: var(--bg); border-radius: 10px; margin-bottom: 8px; font-weight: bold;
}
.status { padding: 12px 14px; border-radius: 10px; background: #f3f4f6; font-weight: bold; }
.status-paid { background: #dcfce7; color: #166534; }
.status-unpaid { background: #fef3c7; color: #92400e; }
.status-installment { background: #e0f2fe; color: #075985; }
.installment-dots { display: flex; gap: 6px; margin-top: 10px; }
.installment-dots span {
  flex: 1; text-align: center; font-size: .8rem; padding: 4px 0; border-radius: 6px;
  background: #f3f4f6; color: var(--muted);
}
.installment-dots span.done { background: var(--primary); color: #fff; font-weight: bold; }
.plans { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.plan {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; cursor: pointer;
  border: 2px solid var(--border); border-radius: 12px; background: #fff;
}
.plan:has(input:checked) { border-color: var(--primary); background: var(--bg); }
.plan input { margin-top: 5px; accent-color: var(--primary); }
.plan-title { display: block; font-weight: bold; }
.plan-amount { display: block; font-size: 1.2rem; font-weight: bold; color: var(--primary); }
.plan-desc { display: block; font-size: .85rem; color: var(--muted); }
.done {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 10px;
  background: var(--primary); color: #fff; font-weight: bold; text-align: center;
}

.amount {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 20px 0 4px; padding: 14px 16px; border-top: 2px solid var(--text); border-bottom: 1px solid var(--border);
}
.amount dt { margin: 0; font-weight: bold; }
.amount dd { margin: 0; font-size: 1.8rem; font-weight: bold; font-variant-numeric: tabular-nums; }
.amount dd span { font-size: 1rem; margin-left: 2px; }

.error { color: var(--danger); font-size: .9rem; margin: 0; }
.note { color: var(--muted); font-size: .85rem; margin: 16px 0 0; }

.spinner {
  width: 36px; height: 36px; margin: 8px auto 12px; border-radius: 50%;
  border: 4px solid var(--border); border-top-color: var(--primary); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- クーポン一覧 ---- */
.card + .card, .card + .section-title, .coupon-list + .section-title { margin-top: 16px; }
.section-title { font-size: 1rem; color: var(--primary); margin: 20px 4px 8px; }
.coupon-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.coupon-item {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--primary); border-radius: var(--radius);
}
.coupon-item.is-used { border-left-color: #d1d5db; opacity: .75; }
.coupon-shop { font-size: .85rem; color: var(--muted); }
.coupon-benefit { font-size: 1.15rem; font-weight: bold; }
.coupon-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { font-size: .75rem; padding: 2px 10px; border-radius: 999px; background: var(--bg); color: var(--primary); border: 1px solid var(--border); }
.chip-warn { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.coupon-state { font-size: .8rem; color: var(--muted); }

/* ---- クーポン詳細：チケット・動く時計 ---- */
.ticket {
  position: relative; overflow: hidden; color: #fff; border-radius: var(--radius);
  padding: 22px 20px 18px; margin-bottom: 16px; background: #0f766e; box-shadow: 0 4px 14px rgba(0, 0, 0, .15);
}
.ticket-band {
  position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background: repeating-linear-gradient(115deg, #fff 0 14px, transparent 14px 44px);
  background-size: 200% 100%; animation: band 6s linear infinite;
}
@keyframes band { from { background-position: 0 0; } to { background-position: -188px 0; } }
.ticket > *:not(.ticket-band) { position: relative; }
.ticket-org { margin: 0; font-size: .8rem; opacity: .9; }
.ticket-shop { margin: 6px 0 0; font-size: 1.1rem; }
.ticket-benefit { margin: 4px 0 14px; font-size: 1.5rem; font-weight: bold; line-height: 1.4; }
.ticket-children { list-style: none; margin: 12px 0 0; padding: 0; font-size: .85rem; opacity: .95; }

.clock {
  display: flex; align-items: center; gap: 16px; padding: 12px 14px;
  background: rgba(255, 255, 255, .95); color: #111827; border-radius: 12px;
}
.clock-face { width: 84px; height: 84px; flex-shrink: 0; }
.clock-rim { fill: #fff; stroke: #111827; stroke-width: 3; }
.clock-hour { stroke: #111827; stroke-width: 5; stroke-linecap: round; }
.clock-minute { stroke: #111827; stroke-width: 3.5; stroke-linecap: round; }
.clock-second { stroke: #dc2626; stroke-width: 1.8; stroke-linecap: round; }
.clock-pin { fill: #dc2626; }
.clock-digital p { margin: 0; }
.clock-date { font-size: .95rem; font-weight: bold; }
.clock-time { font: bold 2.1rem/1.1 ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* 日替わりカラー（12色） */
.ticket.day-0 { background: #0f766e; }  .ticket.day-1 { background: #b45309; }
.ticket.day-2 { background: #1d4ed8; }  .ticket.day-3 { background: #be185d; }
.ticket.day-4 { background: #15803d; }  .ticket.day-5 { background: #7c3aed; }
.ticket.day-6 { background: #c2410c; }  .ticket.day-7 { background: #0e7490; }
.ticket.day-8 { background: #a21caf; }  .ticket.day-9 { background: #4d7c0f; }
.ticket.day-10 { background: #b91c1c; } .ticket.day-11 { background: #334155; }

.btn-large { font-size: 1.3rem; padding: 18px; }
.confirm-box h2 { margin: 0 0 8px; font-size: 1.1rem; color: #b45309; }
.used-box { text-align: center; border: 3px solid #dc2626; }
.used-title { margin: 0; font-size: 1.8rem; font-weight: bold; color: #dc2626; letter-spacing: .2em; text-align: center; }
.used-title.muted { color: var(--muted); font-size: 1.2rem; letter-spacing: 0; }
.used-time { margin: 6px 0 0; font-weight: bold; }
.used-countdown { margin: 4px 0 10px; font-variant-numeric: tabular-nums; }
.progress { height: 8px; background: #fee2e2; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 100%; background: #dc2626; transition: width 1s linear; }
.coupon-terms { margin: 0; display: grid; grid-template-columns: 5.5em 1fr; gap: 6px 10px; font-size: .9rem; }
.coupon-terms dt { color: var(--muted); }
.coupon-terms dd { margin: 0; }

/* ---- 会員証 ---- */
.membercard { text-align: center; }
.membercard-head { display: flex; justify-content: space-between; align-items: baseline; text-align: left; }
.membercard-title { margin: 0; font-size: 1.3rem; font-weight: bold; letter-spacing: .1em; }
.membercard-title span { font-size: .8rem; font-weight: normal; letter-spacing: 0; opacity: .9; margin-left: 4px; }
.membercard-children { list-style: none; margin: 14px 0 8px; padding: 0; text-align: left; }
.membercard-children li { font-size: 1.25rem; font-weight: bold; line-height: 1.5; }
.membercard-children li span { display: inline-block; min-width: 5.5em; font-size: .85rem; font-weight: normal; opacity: .9; }
.membercard-fee { display: inline-block; margin: 0 0 12px; padding: 3px 14px; border-radius: 999px; font-size: .85rem; font-weight: bold; }
.card-paid { background: #fff; color: #166534; }
.card-unpaid { background: #fef3c7; color: #92400e; }
.membercard-qr { background: #fff; border-radius: 12px; padding: 14px 14px 10px; margin: 0 auto 12px; max-width: 260px; }
.membercard-qr img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.qr-refresh { height: 4px; margin-top: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.qr-refresh-bar { height: 100%; width: 100%; background: var(--primary); }
.clock-compact { justify-content: center; padding: 8px 14px; }
.clock-compact .clock-time { font-size: 1.8rem; }

/* ---- PTAの予定 ---- */
.schedule-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.schedule-item { background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--primary); border-radius: var(--radius); padding: 12px 16px; }
.schedule-item.is-today { border-left-color: #d97706; background: #fffbeb; }
.schedule-item.is-past { opacity: .55; }
.schedule-item p { margin: 0; }
.schedule-when { font-size: .85rem; font-weight: bold; color: var(--primary); }
.schedule-title { font-size: 1.1rem; font-weight: bold; margin: 2px 0 4px !important; }
.schedule-meta { font-size: .88rem; color: var(--muted); }
.gcal-link { display: inline-block; margin-top: 8px; font-size: .85rem; font-weight: bold; color: #1a73e8; text-decoration: none; }
.feed-url { width: 100%; font: .8rem ui-monospace, Consolas, monospace; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }

/* ---- 申し込み（お手伝い・参加） ---- */
.flash-member { margin-bottom: 12px; padding: 12px 16px; border-radius: 10px; font-weight: bold; }
.flash-member.flash-success { background: #dcfce7; color: #166534; }
.flash-member.flash-error { background: #fee2e2; color: #991b1b; }
.flash-member.flash-info { background: #e0f2fe; color: #075985; }
.legend { font-size: .8rem; color: var(--muted); margin: 8px 0 0; }
.kind-tag { display: inline-block; font-size: .72rem; font-weight: bold; color: #fff; border-radius: 999px; padding: 1px 9px; margin-right: 4px; vertical-align: 1px; }
.kind-tag.help { background: #d97706; }
.kind-tag.entry { background: #2563eb; }
.role { margin-top: 10px; padding: 10px 12px; border-radius: 10px; }
.role.help { background: #fffbeb; border: 1px solid #fde68a; }
.role.entry { background: #eff6ff; border: 1px solid #bfdbfe; }
.role p { margin: 0; }
.role-title { font-weight: bold; }
.role-desc { font-size: .85rem; color: #4b5563; margin-top: 2px !important; }
.role-seats { font-size: .85rem; margin-top: 4px !important; }
.role-seats .full { color: #b91c1c; }
.role-mine { margin-top: 6px !important; font-weight: bold; color: #166534; }
.role-mine.wait { color: #92400e; }
.role-closed { margin-top: 6px !important; font-size: .85rem; color: var(--muted); }
.role-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.btn-sm { display: inline-block; width: auto; padding: 8px 16px; font-size: .9rem; }
.headcount { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.headcount select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); }
.role-deadline { font-size: .8rem; color: var(--muted); margin-top: 8px !important; }

/* ---- お知らせ ---- */
.card-title { font-size: 1.05rem; margin: 0 0 8px; }
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.notice-item:last-child { border-bottom: none; }
.notice-date { margin: 0; font-size: .8rem; color: var(--muted); }
.notice-title { display: block; margin: 2px 0 0; font-size: 1rem; font-weight: bold; color: var(--text); text-decoration: none; }
a.notice-title { color: var(--primary); }
.notice-body { margin: 8px 0 0; word-break: break-word; }
.notice-item:target { background: var(--bg); border-radius: 10px; padding-left: 10px; padding-right: 10px; }

.prose h2 { font-size: 1.05rem; margin: 24px 0 8px; padding-left: 10px; border-left: 4px solid var(--primary); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 6px; }

/* イベントチケット（SPEC §5.14） */
.ticket-price { margin: 8px 0 !important; }
.ticket-price .full { color: #b91c1c; }
.ticket-order { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-top: 1px dashed var(--border); }
.ticket-buy { margin-top: 10px; }
.card-ticket-list { list-style: none; margin: 0; padding: 0; }
.card-ticket-list li { padding: 6px 0; border-top: 1px dashed var(--border); }
.card-ticket-list li:first-child { border-top: none; }
.card-ticket-list span { display: inline-block; min-width: 3.2em; color: var(--muted); }

/* お知らせの添付（§5.7） */
.notice-images { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.notice-images a:only-child { grid-column: 1 / -1; }
.notice-images img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--bg); }
.notice-images a:only-child img { aspect-ratio: auto; }
.notice-pdf { display: inline-block; margin-top: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--primary); text-decoration: none; font-weight: bold; word-break: break-all; }

/* お店のホームページ・SNS（§5.4） */
.shop-links-title { margin: 0 0 10px; font-size: 1rem; }
.shop-links { display: flex; flex-wrap: wrap; gap: 8px; }
.shop-links .btn { flex: 1 1 40%; }
