:root {
  color-scheme: dark;
  font-family: Pretendard, "Noto Sans KR", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #09090b;
  color: #fafafa;
  font-synthesis: none;
  --surface: rgba(24, 24, 27, .84);
  --surface-2: #202024;
  --line: rgba(255, 255, 255, .1);
  --muted: #a1a1aa;
  --accent: #f43f5e;
  --accent-2: #fb7185;
  --available: #f4f4f5;
  --sold: #3f3f46;
  --special: #7c3aed;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #09090b; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: radial-gradient(circle at 75% -10%, rgba(244,63,94,.14), transparent 36rem), #09090b; }
html.detail-open, body.detail-open { overflow: hidden; }
button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }

.topbar { height: 70px; padding: 0 clamp(18px, 5vw, 72px); display: flex; align-items: center; justify-content: flex-start; border-bottom: 1px solid var(--line); background: rgba(9,9,11,.8); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 20px; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #be123c); box-shadow: 0 8px 25px rgba(244,63,94,.25); }
nav { display: flex; height: 100%; gap: 14px; position: absolute; top: 0; left: 50%; transform: translateX(-50%); }
nav a { color: var(--muted); text-decoration: none; display: grid; place-items: center; padding: 0 20px; font-size: 17px; font-weight: 800; border-bottom: 3px solid transparent; white-space: nowrap; }
nav a:hover, nav a.active { color: #fff; border-color: var(--accent); }

main { width: min(1420px, calc(100% - 36px)); margin: 0 auto; padding: 70px 0 100px; }
.hero { max-width: 740px; margin-bottom: 46px; }
.eyebrow { color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: .18em; margin: 0 0 12px; }
.hero h1 { font-size: clamp(38px, 6vw, 72px); line-height: 1.04; letter-spacing: -.065em; margin: 0; }
.hero > p:not(.eyebrow) { color: var(--muted); font-size: clamp(15px, 2vw, 18px); line-height: 1.7; max-width: 620px; margin: 24px 0 18px; }
.connection-badge { display: inline-flex; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: #d4d4d8; font-size: 12px; background: rgba(255,255,255,.03); }
.connection-badge.live { color: #86efac; border-color: rgba(34,197,94,.3); background: rgba(34,197,94,.08); }
.connection-badge.error { color: #fda4af; border-color: rgba(244,63,94,.3); background: rgba(244,63,94,.08); }

.search-panel { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: var(--surface); box-shadow: 0 24px 70px rgba(0,0,0,.26); }
.step { padding: 20px; border-right: 1px solid var(--line); min-width: 0; }
.step:last-child { border-right: 0; }
.step label { display: block; color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: .1em; margin-bottom: 10px; }
.step label strong { color: #d4d4d8; margin-left: 6px; letter-spacing: 0; }
select { width: 100%; min-width: 0; height: 45px; border: 0; border-radius: 10px; color: #fff; background: #27272a; padding: 0 36px 0 13px; outline: none; white-space: nowrap; text-overflow: ellipsis; }
select:focus { box-shadow: 0 0 0 2px var(--accent); }
select:disabled { color: #71717a; opacity: .72; }

.notice { margin: 18px 0; min-height: 24px; color: var(--muted); font-size: 14px; }
.notice.error { color: #fda4af; }
.notice.success { color: #86efac; }
.results { margin-top: 62px; }
.results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.results h2 { font-size: clamp(25px, 4vw, 38px); letter-spacing: -.05em; margin: 0 0 7px; }
.results-summary, #last-updated { color: var(--muted); font-size: 13px; margin: 0; }
.refresh-group { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
button { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: #fff; background: #27272a; cursor: pointer; font-weight: 750; }
button:hover:not(:disabled) { border-color: rgba(255,255,255,.28); background: #323237; }
button:disabled { opacity: .55; cursor: wait; }
#refresh-all { background: var(--accent); border-color: var(--accent); }
#refresh-all:hover:not(:disabled) { background: #e11d48; }

.showtime-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; align-items: start; }
.showtime-card { min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; cursor: pointer; transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.showtime-card:hover, .showtime-card:focus-visible { border-color: rgba(244,63,94,.62); background: rgba(39,39,42,.94); outline: none; transform: translateY(-1px); }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; padding: 13px 14px 8px; }
.time { font-size: 18px; font-weight: 850; letter-spacing: -.03em; white-space: nowrap; }
.screen { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.remaining { color: #fda4af; font-size: 13px; font-weight: 750; white-space: nowrap; }
.card-refresh { padding: 6px 9px; font-size: 11px; flex: none; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; min-height: 22px; padding: 0 14px 7px; color: var(--muted); font-size: 10px; }
.card-error { color: #fda4af; }
.seat-stage { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 20px 18px; overscroll-behavior-x: contain; scrollbar-color: #52525b transparent; }
.seat-content { width: 100%; min-width: 0; margin: 0 auto; transition: width .15s ease; }
.screen-line { width: 72%; height: 21px; margin: 0 auto 23px; display: grid; place-items: start center; color: #71717a; font-size: 9px; font-weight: 800; letter-spacing: .3em; border-top: 4px solid #71717a; border-radius: 50%; box-shadow: 0 -5px 18px rgba(255,255,255,.08); }
.seat-map { position: relative; width: 100%; min-width: 0; aspect-ratio: var(--map-ratio, 2 / 1); margin: 0 auto; }
.seat { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); min-width: var(--seat-min-width, 20px); min-height: var(--seat-min-height, 18px); padding: 1px; display: grid; place-items: center; overflow: hidden; white-space: nowrap; border: 1px solid rgba(255,255,255,.1); border-radius: 4px 4px 2px 2px; background: var(--sold); color: #f4f4f5; font-size: var(--seat-font-size, 11px); font-weight: 900; line-height: 1; letter-spacing: -.04em; transform: scale(.86); transform-origin: center; transition: transform .12s ease, background .12s ease; }
.seat.available { color: #18181b; background: var(--available); border-color: rgba(255,255,255,.3); box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.seat.special { color: #fff; background: var(--special); }
.seat:hover { z-index: 2; transform: scale(1.08); background: var(--accent); color: #fff; overflow: visible; }
.seat-placeholder { min-height: 250px; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; padding: 30px; }
.legend { display: flex; justify-content: center; gap: 18px; color: var(--muted); font-size: 11px; padding: 0 18px 18px; }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--available); margin-right: 6px; }
.legend .unavailable::before { background: var(--sold); }
.legend .special::before { background: var(--special); }
.seat-preview-stage { width: 100%; overflow: hidden; padding: 8px 10px 12px; pointer-events: none; }
.seat-preview-content { width: 100%; margin: 0 auto; }
.seat-preview-stage .screen-line { height: 8px; margin-bottom: 7px; border-top-width: 2px; font-size: 0; box-shadow: 0 -3px 8px rgba(255,255,255,.06); }
.seat-preview-stage .seat-map { width: 100%; min-width: 0; }
.seat-preview-stage .seat { min-width: 0; min-height: 0; padding: 0; border-width: 0; border-radius: 1px; font-size: 0; transform: scale(.78); transition: none; }
.seat-preview-stage .seat:hover { transform: scale(.78); }
.seat-preview-placeholder { min-height: 112px; display: grid; place-items: center; padding: 15px; color: var(--muted); font-size: 11px; text-align: center; }

.detail-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.76); backdrop-filter: blur(9px); }
.detail-overlay[hidden] { display: none; }
.detail-dialog { width: min(1200px, 96vw); max-height: calc(100dvh - 48px); overflow-y: auto; overflow-x: hidden; border: 1px solid rgba(255,255,255,.14); border-radius: 20px; background: #111114; box-shadow: 0 30px 100px rgba(0,0,0,.65); }
.detail-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: rgba(17,17,20,.96); backdrop-filter: blur(14px); }
.detail-time { display: block; font-size: clamp(20px, 3vw, 28px); letter-spacing: -.04em; }
.detail-head p { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 5px 0 0; color: var(--muted); font-size: 13px; }
#detail-remaining { color: #fda4af; font-weight: 750; }
.detail-actions { display: flex; align-items: center; gap: 8px; }
.detail-close-top { width: 42px; height: 42px; padding: 0; display: grid; place-items: center; border-radius: 50%; font-size: 27px; line-height: 1; }
.detail-status { min-height: 20px; padding: 10px 20px 0; color: #fda4af; font-size: 12px; }
.detail-seat { min-width: 0; }
.detail-seat .seat-stage { padding-top: 12px; }
.detail-footer { padding: 12px 20px calc(20px + env(safe-area-inset-bottom)); }
#detail-close-bottom { width: 100%; min-height: 50px; background: var(--accent); border-color: var(--accent); }
#detail-close-bottom:hover { background: #e11d48; }
footer { color: #52525b; border-top: 1px solid var(--line); padding: 30px clamp(18px,5vw,72px); font-size: 12px; }

@media (max-width: 1399px) {
  .showtime-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 1000px) {
  .showtime-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  main { padding-top: 48px; }
  .search-panel { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .step:nth-child(2) { border-right: 0; }
  .step:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 620px) {
  .topbar { height: auto; min-height: 64px; padding: 13px 16px; align-items: center; flex-direction: column; gap: 10px; }
  .brand { font-size: 17px; padding-top: 2px; }
  nav { width: 100%; height: auto; gap: 4px; position: static; transform: none; flex-wrap: nowrap; justify-content: center; }
  nav a { padding: 9px 10px; font-size: 14px; border-bottom: 0; border-radius: 8px; }
  nav a.active { background: #27272a; }
  main { width: min(100% - 24px, 1420px); padding: 38px 0 70px; }
  .hero { margin-bottom: 30px; }
  .hero h1 { font-size: 38px; }
  .search-panel { grid-template-columns: 1fr; border-radius: 16px; }
  .step { border-right: 0; border-bottom: 1px solid var(--line); padding: 15px; }
  .step:last-child { border-bottom: 0; }
  .results { margin-top: 42px; }
  .results-head { align-items: stretch; flex-direction: column; }
  .refresh-group { align-items: stretch; }
  .showtime-grid { grid-template-columns: 1fr; gap: 13px; }
  .card-head { padding: 12px 13px 7px; }
  .screen { order: 3; flex-basis: 100%; }
  .seat-preview-stage { padding: 6px 9px 10px; }
  .seat-stage { padding: 10px 5px 14px; }
  .screen-line { margin-bottom: 16px; }
  .legend { gap: 10px; padding: 0 6px 12px; font-size: 10px; }
  .detail-overlay { place-items: stretch; padding: 0; }
  .detail-dialog { width: 100%; max-height: 100dvh; min-height: 100dvh; border: 0; border-radius: 0; }
  .detail-head { padding: 13px 14px; }
  .detail-actions > #detail-refresh { padding: 9px 10px; font-size: 12px; }
  .detail-close-top { width: 40px; height: 40px; }
  .detail-status { padding: 8px 14px 0; }
  .detail-footer { padding: 14px 14px calc(16px + env(safe-area-inset-bottom)); }
}
