/* One-screen layout: tabs + a view that fills the rest, no page scroll. */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { display: flex; flex-direction: column; height: 100dvh; }
.tabs { flex: none; display: flex; gap: 6px; background: #fff; border-top: 1px solid var(--line); padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 4px; border-radius: 14px; font-weight: 700; font-size: 12px; color: var(--muted); text-decoration: none; min-height: 50px; }
.tab-ico { width: 22px; height: 22px; }
.tabs a[aria-current] { color: var(--accent-dark); background: #fde9dc; }
body { padding-top: env(safe-area-inset-top); }
main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 8px 10px; max-width: 560px; margin: 0 auto; overflow: hidden; }
.view-title { font-size: 1.3em; color: var(--accent-dark); margin: 4px 0 8px; }
.loading { text-align: center; padding: 40px 0; }
.small { font-size: .85em; }
.start { margin: auto 0; text-align: center; padding: 8px; }

/* ---------- app header (approved layout) ---------- */
.app-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: #fdf8f1; border-bottom: 1px solid #eadfd2; }
.app-logo { width: 30px; height: 30px; flex: none; }
.app-names { flex: 1; min-width: 0; }
.app-name { margin: 0; font-weight: 800; color: #8a5a3c; font-size: 16px; line-height: 1.2; }
.app-sub { margin: 0; font-size: 11px; color: #9b8b7c; }
.menu-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid #e3d5c4; background: #fff; font: inherit; font-size: 18px; font-weight: 800; color: #8a5a3c; cursor: pointer; }

/* ---------- bingo card: approved structure, paper-card cells ---------- */
.card-fit { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: flex-start; container-type: size; }
/* The card is about 1.42x as tall as wide; everything inside scales with cqw. */
.bingo-card { container-type: inline-size; position: relative; width: min(100cqw, 70cqh); margin: 0; padding: 2.4cqw; border-radius: 12px; background: #fffaf3; border: 1px solid #eadfd2; box-shadow: 0 2px 8px rgba(80, 40, 10, .08); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 2cqw; padding: 0 1cqw 1.6cqw; }
.card-titles { min-width: 0; }
.card-titles p, .card-titles h1 { margin: 0; }
.ct-sub { font-size: 3.2cqw; color: #8a6a55; letter-spacing: .08em; }
.ct-title { font-size: 7.4cqw; font-weight: 900; color: #e8643c; line-height: 1.2; white-space: nowrap; }
.ct-pill { margin: 1cqw 0 !important; }
.ct-pill span { display: inline-block; padding: .6cqw 2.6cqw; border-radius: 999px; background: #f6b54a; color: #fff; font-weight: 800; font-size: 3.3cqw; outline: 2px dotted #fff; outline-offset: -1cqw; }
.ct-hint { font-size: 3cqw; color: #8a6a55; }
.mascot { margin: 0; flex: none; width: 27cqw; text-align: center; }
.mascot img { display: block; width: 18cqw; height: auto; margin: 0 auto; }
.mascot figcaption { font-size: 1.9cqw; line-height: 1.3; color: #333; white-space: nowrap; }
.mascot figcaption b { font-size: 2.6cqw; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); border: 2px solid #111; background: #111; gap: 2px; }
.cell-slot { display: block; }
.cell { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; aspect-ratio: 1 / .96; border: 0; padding: 1cqw .8cqw 0; background: #fff; color: #222; font: inherit; cursor: pointer; overflow: hidden; touch-action: manipulation; -webkit-tap-highlight-color: rgba(232, 100, 60, .25); }
.cell.bg-salmon { background: #f79d89; }
.cell.bg-lightblue { background: #aae1fe; }
.cell.bg-white { background: #fff; }
.cell-no { position: absolute; left: .8cqw; top: .6cqw; width: 4.6cqw; height: 4.6cqw; border: .4cqw solid #111; border-radius: 50%; background: #fff; font-size: 3.2cqw; font-weight: 900; line-height: 3.8cqw; text-align: center; z-index: 2; }
.cell-label { position: relative; z-index: 1; margin-top: 4.4cqw; font-size: 3.4cqw; font-weight: 900; line-height: 1.5; text-align: center; letter-spacing: -.02em; white-space: nowrap; }
.cell-label rt { font-size: 1.5cqw; font-weight: 700; letter-spacing: 0; }
.cell-illus { display: block; flex: 1; min-height: 0; width: 86%; object-fit: contain; object-position: center bottom; margin-top: .4cqw; }
.cell.deco-top .cell-illus { position: absolute; top: 0; left: 0; width: 100%; height: 33%; margin: 0; object-fit: cover; object-position: center top; }
.cell.deco-top .cell-label { margin-top: 8.4cqw; }
.cell:active { filter: brightness(.94); }
.cell:focus-visible { outline: 4px solid var(--focus); outline-offset: -4px; }
/* 達成済み: the organisers' sticker (Good Job etc.) covers the cell. */
.cell-done { position: absolute; inset: 1.5%; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255, 255, 255, .94); box-shadow: 0 .5cqw 1.4cqw rgba(0, 0, 0, .25); transform: rotate(-6deg); pointer-events: none; }
.cell-done img { display: block; width: 92%; height: auto; }
.cell-done-text { position: absolute; bottom: 4%; padding: .2cqw 2cqw; border-radius: 999px; background: #e8643c; color: #fff; font-size: 2.6cqw; font-weight: 900; letter-spacing: .06em; }
.line-bar { display: flex; justify-content: space-between; align-items: center; margin: 2cqw 0 0; padding: 1.4cqw 3cqw; border-radius: 10px; background: #fbefd9; border: 1px solid #f0dcbc; }
.lb-left { color: #8a6a55; font-size: 3.4cqw; }
.lb-num { font-size: 7cqw; font-weight: 900; color: #8a5a3c; margin-right: 1cqw; font-family: Georgia, "Times New Roman", serif; }
.lb-right { font-weight: 800; color: #c2442b; font-size: 3.6cqw; }
.lb-right b { font-size: 1.2em; }
.lb-right.is-used { color: #fff; background: var(--danger); padding: .4cqw 2cqw; border-radius: 6px; }
.rule { text-align: center; margin: 1.2cqw 0 0; font-size: 2.6cqw; color: var(--muted); }
.cell-sheet { text-align: center; }
.cell-sheet .btn { width: 100%; min-height: 56px; font-size: 1.1em; }

/* おがっきぃ cheer after a stamp */
.cheer { position: fixed; inset: auto 0 22vh; margin: 0 auto; width: min(60vw, 260px); padding: 0; border: 0; border-radius: 50%; background: transparent; box-shadow: none; pointer-events: none; animation: cheer-in .35s ease-out; }
.cheer img { display: block; width: 100%; height: auto; border-radius: 50%; background: #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .2); }
@keyframes cheer-in { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cheer { animation: none; } }

.card-bar { flex: none; padding-top: 6px; }
.tap-hint { text-align: center; margin: 0 0 6px; font-size: .85em; color: var(--muted); }
.big { font-size: 1.5em; color: var(--accent-dark); margin: 0 .1em; }
.bar-buttons { display: grid; grid-template-columns: 1fr; gap: 8px; }
.cell:active { filter: brightness(.95); }
.cell-sheet { text-align: center; }
.cell-sheet .btn { width: 100%; min-height: 56px; font-size: 1.1em; }
.qr-sheet { text-align: center; }
.card-qr { width: min(70vw, 260px); height: auto; background: #fff; image-rendering: pixelated; }

/* ---------- map: fills the view ---------- */
.view-map { padding: 0; max-width: none; }
.map-root { position: absolute; inset: 0; overflow: hidden; background: #eceef1; touch-action: none; user-select: none; -webkit-user-select: none; }
.map3d-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map3d .plate-top { fill: #e4e7eb; }
.map3d .plate-front { fill: #d3d7dd; }
.map3d .plate-side { fill: #c5cad1; }
.map3d .floor { fill: #e9ecef; stroke: none; }
.map3d .face { stroke: rgba(90, 100, 115, .35); stroke-width: .8; stroke-linejoin: round; }
.map3d .place-area .face-top { stroke: #c9ced6; stroke-width: 1.5; }
.map3d .place { cursor: pointer; }
.map3d .place:focus { outline: none; }
.map3d .place:focus-visible .face-top, .map3d .place.is-selected .face-top { stroke: #1a5fb4; stroke-width: 4; }
.map3d-labels { position: absolute; inset: 0; pointer-events: none; }
.map3d-label { position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: auto; max-width: 11em; overflow: hidden; text-overflow: ellipsis;
  font: inherit; font-size: 12px; font-weight: 700; line-height: 1.25; padding: 2px 7px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, .96); color: #333; cursor: pointer; box-shadow: 0 1px 3px rgba(40, 50, 70, .25); }
.map3d-label.label-stage { background: #fff; color: #b9431f; font-size: 13px; }
.map3d-label.label-outdoor { background: #f1ecfa; }
.map3d-label.label-area { background: transparent; box-shadow: none; color: #8a93a0; font-weight: 600; }
.map3d-label.is-hidden { visibility: hidden; }
.map3d-label.is-selected { background: #1a5fb4; color: #fff; border-color: #0d3d7a; z-index: 2; }
.map-controls { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 6px; }
.map-btn { width: 50px; min-height: 50px; border-radius: 12px; border: 2px solid #557a55; background: #fff; font-size: 20px; font-weight: 800; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; color: #222; }
.map-btn-text { font-size: 10px; margin-top: 2px; }
.map-hint { position: absolute; left: 8px; right: 66px; top: 8px; margin: 0; background: rgba(255, 255, 255, .92); padding: 6px 10px; border-radius: 8px; font-weight: 700; font-size: .9em; pointer-events: none; }
.list-kind { font-size: 1em; margin: 10px 0 4px; }
.place-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.place-item { width: 100%; text-align: left; min-height: 46px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.kind-tag { display: inline-block; font-size: .8em; font-weight: 700; border: 1px solid var(--muted); border-radius: 6px; padding: 0 6px; color: var(--muted); margin: 0 0 6px; }

/* ---------- detail sheet ---------- */
#detail { margin: auto auto 0; border-radius: 16px 16px 0 0; max-height: 85dvh; }
.sheet-body { overflow-y: auto; }
@media (min-width: 700px) { #detail { margin: auto; border-radius: 16px; } }
.sheet { padding: 16px; overflow-wrap: anywhere; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; position: sticky; top: 0; background: #fff; }
.sheet-head h2 { margin: 0; font-size: 1.2em; }
.sheet-head .btn { white-space: nowrap; flex-shrink: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
.facts dt { font-weight: 700; color: var(--muted); }
.facts dd { margin: 0; white-space: pre-wrap; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--band); }
.tl-item { display: grid; grid-template-columns: 6.5em 1fr; gap: 8px; padding: 8px 0 8px 12px; border-bottom: 1px dashed var(--line); }
.tl-time { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.tl-title { margin: 0; font-weight: 800; }
.tl-body p { margin: 0 0 4px; }
.is-cancelled .tl-title { text-decoration: line-through; }

fieldset { border: 1px solid var(--line); border-radius: 10px; }
.radio { display: flex; gap: 8px; align-items: center; font-weight: 600; min-height: 44px; }
.radio input { min-height: auto; width: 22px; height: 22px; }

.survey { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.ages { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 8px; margin: 0; padding: 4px 10px 8px; }
.survey textarea { min-height: 4.5em; }
.map-pick { position: absolute; left: 8px; right: 8px; bottom: 8px; background: rgba(255, 255, 255, .96); border: 1px solid var(--line); border-radius: 12px; padding: 4px 10px 8px; }
.map-pick label { display: block; font-size: 12px; }
.map-pick select { width: 100%; }
.view-map .map-root { bottom: 66px; }
.view-map .map-pick { bottom: 6px; }

/* ---------- closing notice: same look as the organisers' POP ---------- */
.closing-banner { flex: none; margin: 0; padding: 6px 10px; background: #fff3e6; border-bottom: 2px solid #ff6600; color: #b23c00; font-weight: 800; text-align: center; font-size: .95em; }
.pop-dlg { padding: 0; max-width: min(96vw, 720px); background: #fff; }
.pop { container-type: inline-size; background: #fff; }
.pop-border { height: 7cqw; background:
  linear-gradient(to bottom, transparent 0 50%, #a0522d 50% 100%),
  repeating-linear-gradient(to right, #ffd84d 0 7.5cqw, #fff 7.5cqw 11.5cqw, #ff9955 11.5cqw 17.5cqw, #fff 17.5cqw 23cqw); }
.pop-border-bottom { transform: scaleY(-1); }
.pop-body { padding: 4cqw 4cqw 2cqw; color: #595959; font-weight: 900; line-height: 1.15; }
.pop-body p { margin: 0; }
.pop-body rt { font-size: .32em; color: #595959; }
.pop-line1 { font-size: 11cqw; white-space: nowrap; }
.pop-time { color: #ff6600; font-size: 1.45em; border-bottom: .6cqw solid #ff6600; margin-left: .1em; }
.pop-line2 { font-size: 11cqw; margin-top: 3cqw !important; padding-left: 18cqw; }
.pop-em { color: #ff6600; text-decoration: underline; text-decoration-thickness: .6cqw; text-underline-offset: .12em; }
.pop-em rt { color: #ff6600; }
.pop-close { border-radius: 0; }
.pop-reason { font-size: 6.5cqw; color: #595959; margin-bottom: 2cqw !important; }
/* Deliberately small and low-contrast: for staff, not visitors. */
.admin-link { display: block; width: max-content; margin: 4px 0 0 auto; padding: 2px 6px; font-size: 10px; color: #b9aea6; text-decoration: none; }

/* survey: fixed choices, fits one phone screen */
.survey { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.survey fieldset { border: 0; margin: 0; padding: 0; }
.survey legend { font-weight: 800; font-size: .95em; padding: 0; margin-bottom: 2px; }
.opts { display: grid; gap: 4px; }
.opts-4 { grid-template-columns: repeat(4, 1fr); }
.opts-5 { grid-template-columns: repeat(5, 1fr); }
.chip-opt { position: relative; display: block; }
.chip-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; min-height: 0; cursor: pointer; }
.chip-opt span { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 38px; padding: 2px; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; font-weight: 700; text-align: center; line-height: 1.2; }
.chip-opt.sat span { min-height: 48px; font-size: 11px; }
.chip-opt.sat b { font-size: 18px; color: var(--accent-dark); }
.chip-opt input:checked + span { border-color: var(--accent-dark); background: #fde2d6; color: var(--accent-dark); }
.chip-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.small-label { font-size: .9em; }
.survey textarea { min-height: 3.2em; }
.view-survey-scroll { overflow: scroll; }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: .85em; font-weight: 600; }
.consent input { width: 22px; height: 22px; min-height: 0; flex: none; }
.tl-list { list-style: none; margin: 0; padding: 0; }
.tl-list > li { padding: 2px 0; }
.tl-list > li + li { border-top: 1px dotted var(--line); }
.tl-list .is-cancelled .tl-title { text-decoration: line-through; }
.scale-hint { display: flex; justify-content: space-between; margin: 2px 2px 0; font-size: .8em; color: var(--muted); }
.survey .rate legend { font-size: .92em; }
.survey .rate .chip-opt span { min-height: 34px; font-size: 16px; }
