:root {
  --bg: #f4f4f2; --fg: #1b1b1b; --muted: #6b6b6b; --line: #dcdcd8; --card: #fff;
  --accent: #b0263a; --mubi: #0a2bd6; --chip: #ececea; --off: #b9b9b5;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151515; --fg: #ececec; --muted: #9a9a9a; --line: #2e2e2e; --card: #1e1e1e;
    --accent: #e0566b; --mubi: #7f93ff; --chip: #2a2a2a; --off: #555; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0 auto; max-width: 640px; background: var(--card); color: var(--fg);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }

.top { position: sticky; top: 0; z-index: 5; background: var(--card); padding: 12px 14px 8px;
  padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
.brand { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 19px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 13px; font-weight: 500; }
.seg button { padding: 4px 10px; }
.seg button.on { background: var(--fg); color: var(--card); }

.strip { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip[hidden] { display: none; }
.pill { flex: none; white-space: nowrap; padding: 5px 11px; border-radius: 999px; background: var(--chip); font-size: 14px; }
.pill.on { background: var(--fg); color: var(--card); }
.pill.add { background: none; border: 1px dashed var(--muted); color: var(--muted); }
.days .pill { border-radius: 8px; text-align: center; line-height: 1.15; padding: 4px 10px; }
.days small { display: block; font-size: 11px; opacity: .75; }
.filters .pill { font-size: 13px; padding: 3px 10px; background: none; border: 1px solid var(--line); }
.filters .pill.on { background: var(--fg); border-color: var(--fg); color: var(--card); }
.filters .pill.mubi.on { background: var(--mubi); border-color: var(--mubi); color: #fff; }

.msg { padding: 24px 16px; color: var(--muted); text-align: center; }

.film { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.poster { width: 84px; height: 47px; flex: none; border-radius: 4px; object-fit: cover; background: var(--chip); }
.body { flex: 1; min-width: 0; }
.head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.head h2 { margin: 0; font-size: 15px; }
.lb { font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.lb b { color: var(--fg); }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--chip); color: var(--muted); margin: 3px 3px 0 0; }
.tag.mubi { background: var(--mubi); color: #fff; font-weight: 600; }
.where { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.when { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 8px; }
.times { display: flex; flex-wrap: wrap; }
.time { text-align: center; border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; margin: 4px 4px 0 0; font-weight: 600; font-size: 14px; line-height: 1.25; }
.time small { display: block; font-weight: 400; font-size: 10px; color: var(--muted); }
.time.mubi { border-color: var(--mubi); }
.time.out, .time.out small { color: var(--off); border-style: dashed; }

.shade { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 10; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-width: 640px; margin: 0 auto; max-height: 85vh; overflow-y: auto;
  background: var(--card); border-radius: 18px 18px 0 0; padding: 14px 16px; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 10px; }
.sheet h3 { margin: 0; font-size: 18px; }
.sheet .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
textarea, input[type=text] { width: 100%; font: inherit; font-size: 16px; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-top: 6px; }
textarea { min-height: 90px; }
.btn { display: block; width: 100%; text-align: center; margin-top: 14px; padding: 12px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; }
.btn.off { background: var(--chip); color: var(--muted); pointer-events: none; }
.btn.small { display: inline-block; width: auto; margin: 8px 8px 0 0; padding: 7px 14px; font-size: 14px; }
.btn.plain { background: var(--chip); color: var(--fg); }
.link { display: inline-block; margin-top: 10px; margin-right: 14px; font-size: 13px; color: var(--muted); text-decoration: underline; }
.err { color: var(--accent); font-size: 13px; margin-top: 6px; }
.cin { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.cin input { width: 20px; height: 20px; }

:root { --good: #1f9d55; --avoidc: #c62f43; }
@media (prefers-color-scheme: dark) { :root { --good: #3ddc84; --avoidc: #ff6b6b; } }
.seatmap { margin-top: 12px; }
.sm-head { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.sm-key { color: var(--muted); font-size: 12px; flex: 1; }
.sm-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 3px 0 6px; vertical-align: -1px; }
.sm-key i.good { background: var(--good); }
.sm-key i.avoid { background: var(--avoidc); }
.sm-edit { font-size: 13px; border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; }
.sm-edit.on { background: var(--fg); color: var(--card); border-color: var(--fg); }
.sm-svg { display: block; width: 100%; height: min(52vh, 380px); margin-top: 6px; background: var(--bg); border-radius: 8px; touch-action: manipulation; }
.sm-svg.editing { outline: 2px solid var(--accent); }
.sm-screen { fill: var(--muted); }
.sm-label { fill: var(--muted); font-size: 5px; text-anchor: middle; }
.sm-row { fill: var(--muted); font-size: 5px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.sm-seat { fill: var(--card); stroke: var(--line); stroke-width: .6; cursor: pointer; }
.sm-seat.good { fill: var(--good); stroke: var(--good); }
.sm-seat.avoid { fill: var(--avoidc); stroke: var(--avoidc); }
.sm-seat.picked { stroke: var(--fg); stroke-width: 1.4; }
.sm-feature { fill: var(--muted); opacity: .55; }
.sm-flabel { fill: var(--card); font-size: 2.4px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.sm-caption { font-size: 12px; color: var(--muted); margin-top: 4px; min-height: 16px; }
.sm-seat.wheelchair, .sm-seat.companion { stroke-dasharray: 1.4 1; stroke: var(--muted); }
.sm-key i.wc { border: 1px dashed var(--muted); width: 8px; height: 8px; }

/* Every showing sheet is the same height; the seat map takes whatever space is left. */
.sheet.showing { height: min(88vh, 680px); display: flex; flex-direction: column; overflow: hidden; }
.sheet.showing > * { flex: none; }
.sheet.showing .seatmap { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.sheet.showing .sm-svg { flex: 1 1 0; min-height: 0; height: auto; }
.sheet.showing .btn { margin-top: 10px; }
.sheet[hidden], .shade[hidden] { display: none; }
