:root {
  --bg: #0b0d12;
  --surface: #151823;
  --surface-2: #1c2030;
  --border: #262b3d;
  --text: #e8eaf0;
  --text-sub: #9aa1b5;
  --accent: #f6b23c;
  --accent-deep: #e08c1a;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- header ---------- */
.site-header {
  padding: 44px 0 8px;
  background:
    radial-gradient(60% 120% at 50% 0%, rgba(246, 178, 60, 0.10), transparent 70%),
    var(--bg);
}
.site-header h1 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: -0.02em;
}
.site-header .logo { margin-right: 2px; }
.tagline {
  margin: 6px 0 0;
  color: var(--text-sub);
  font-size: 0.95rem;
}

/* ---------- controls ---------- */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 24px 0 4px;
}

.tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}
.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-sub);
  font: inherit;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.tab.active {
  background: var(--accent);
  color: #17130a;
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.region-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-sub);
  font-size: 0.85rem;
}
.region-select select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.region-select select:hover { border-color: var(--accent-deep); }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 0.92rem;
  user-select: none;
}
.toggle input { display: none; }
.toggle .track {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
  transition: background 0.15s;
}
.toggle .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-sub);
  transition: transform 0.15s, background 0.15s;
}
.toggle input:checked + .track {
  background: rgba(246, 178, 60, 0.25);
  border-color: var(--accent-deep);
}
.toggle input:checked + .track::after {
  transform: translateX(16px);
  background: var(--accent);
}

.stats {
  color: var(--text-sub);
  font-size: 0.88rem;
  margin: 10px 2px 18px;
  min-height: 1.2em;
}
.stats strong { color: var(--accent); font-weight: 700; }

/* ---------- grid / cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
  padding-bottom: 48px;
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.card:hover, .card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--accent-deep);
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--surface-2);
}
.poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.poster .no-img {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 2rem;
  opacity: 0.4;
}

.badge-re {
  position: absolute;
  top: 8px;
  left: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #17130a;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}
.badge-dday {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(11, 13, 18, 0.82);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.card-body { padding: 12px 12px 14px; }
.card-body .title {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-body .meta {
  margin: 0 0 8px;
  color: var(--text-sub);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta .star { color: var(--accent); }

.dates { margin: 0; font-size: 0.78rem; }
.dates .re-date {
  display: block;
  color: var(--text);
  font-weight: 600;
}
.dates .re-date.is-re { color: var(--accent); }
.dates .orig {
  display: block;
  color: var(--text-sub);
  margin-top: 2px;
}

.badge-theater {
  display: inline-block;
  margin-top: 8px;
  margin-right: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-sub);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
}
.badge-myregion {
  color: var(--accent);
  background: rgba(246, 178, 60, 0.14);
  border-color: rgba(246, 178, 60, 0.35);
}

.empty {
  text-align: center;
  color: var(--text-sub);
  padding: 60px 0 80px;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 0 28px;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-sub);
  font-size: 0.8rem;
}
.footer-link-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.8rem;
  padding: 0;
  cursor: pointer;
}
.footer-link-btn:hover { text-decoration: underline; }

/* ---------- theater modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 10, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: min(680px, 90vh);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
}
.modal-close:hover { border-color: var(--accent-deep); color: var(--accent); }

.modal-head { padding-right: 40px; margin-bottom: 16px; }
.modal-head h2 { margin: 0 0 4px; font-size: 1.25rem; letter-spacing: -0.01em; }
.modal-sub a { color: var(--accent); font-size: 0.85rem; text-decoration: none; }
.modal-sub a:hover { text-decoration: underline; }

.modal-map {
  height: 240px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--surface-2);
}

.date-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 8px;
}
.date-tab {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 44px;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-sub);
  border-radius: 8px;
  padding: 6px 4px;
  cursor: pointer;
  font: inherit;
}
.date-tab-num { font-size: 0.88rem; font-weight: 700; }
.date-tab-day { font-size: 0.68rem; }
.date-tab.active {
  background: rgba(246, 178, 60, 0.14);
  border-color: var(--accent);
  color: var(--accent);
}
/* Leaflet 팝업을 다크 테마에 맞춤 */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--surface-2);
  color: var(--text);
}
.leaflet-popup-content { font-size: 0.85rem; font-weight: 600; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-sub); }

.theater-list { list-style: none; margin: 0; padding: 0; }
.theater-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.theater-list li:last-child { border-bottom: none; }
.theater-list-empty {
  color: var(--text-sub);
  font-size: 0.85rem;
  text-align: center;
  padding: 20px 0 !important;
}

.theater-list li.region-group-header {
  padding: 16px 0 6px;
  border-bottom: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}
.theater-list li.region-group-header:first-child { padding-top: 0; }
.region-group-count {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-sub);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 1px 7px;
}

.theater-row-collapsible { padding: 0; }
.theater-row-collapsible summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 24px 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}
.theater-row-collapsible summary::-webkit-details-marker { display: none; }
.theater-row-collapsible summary::after {
  content: "▸";
  position: absolute;
  right: 2px;
  top: 10px;
  color: var(--text-sub);
  transition: transform 0.15s;
}
.theater-row-collapsible details[open] summary::after { transform: rotate(90deg); }
.theater-row-collapsible details[open] summary { padding-bottom: 2px; }
.theater-row-collapsible .theater-times { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 10px; }
.theater-name { font-weight: 700; font-size: 0.92rem; }
.theater-addr { color: var(--text-sub); font-size: 0.8rem; }
.badge-near {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(246, 178, 60, 0.14);
  border: 1px solid rgba(246, 178, 60, 0.35);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
}

.theater-times {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.theater-times.no-show {
  color: var(--text-sub);
  font-size: 0.76rem;
  font-style: italic;
}
.time-chip {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(246, 178, 60, 0.12);
  border: 1px solid rgba(246, 178, 60, 0.3);
  border-radius: 5px;
  padding: 2px 7px;
}

.modal-empty {
  text-align: center;
  color: var(--text-sub);
  font-size: 0.88rem;
  line-height: 1.7;
  padding: 24px 8px;
}
.modal-empty a {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  text-decoration: none;
}
.modal-empty a:hover { text-decoration: underline; }

.notify-steps {
  margin: 0 0 16px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.88rem;
  line-height: 1.6;
}
.notify-steps li::marker { color: var(--accent); font-weight: 700; }
.notify-steps a { color: var(--accent); }
.notify-steps code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.85em;
}
.notify-note {
  margin: 0;
  color: var(--text-sub);
  font-size: 0.8rem;
  line-height: 1.6;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.notify-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
}
.notify-section-title:first-of-type { margin-top: 0; }
.notify-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #17130a;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border-radius: 999px;
  padding: 2px 8px;
}
.notify-desc {
  margin: 0 0 10px;
  color: var(--text-sub);
  font-size: 0.8rem;
}
.feed-url-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.feed-url-box code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0;
  font-size: 0.78rem;
  color: var(--text);
}
.feed-url-box button {
  flex-shrink: 0;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.feed-url-box button:hover { border-color: var(--accent-deep); }

@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
  .site-header { padding-top: 32px; }
  .site-header h1 { font-size: 1.5rem; }
  .modal { padding: 20px; max-height: 92vh; }
}
