/* ---------- tokens ---------- */
:root {
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #e9ecf1;
  --ink: #14181d;
  --muted: #5f6773;
  --border: #dee2e9;
  --accent: #8f5a0f;
  --accent-soft: #f7ecdb;
  --on-accent: #ffffff;
  --warn: #a8384c;
  --warn-soft: #fbe9ec;
  --sat: #2f6fb0;
  --sun: #b4485c;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(18, 22, 30, .05), 0 10px 26px -18px rgba(18, 22, 30, .35);
  --shadow-lift: 0 2px 6px rgba(18, 22, 30, .07), 0 18px 38px -20px rgba(18, 22, 30, .42);
  --header-bg: rgba(243, 244, 247, .82);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1015;
    --surface: #161b22;
    --surface-2: #1e2530;
    --ink: #e8ecf3;
    --muted: #98a2b1;
    --border: #262e3a;
    --accent: #f0b25c;
    --accent-soft: #332613;
    --on-accent: #1a1206;
    --warn: #ff8fa0;
    --warn-soft: #3a1d24;
    --sat: #79b4ee;
    --sun: #ff92a4;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 26px -18px rgba(0, 0, 0, .8);
    --shadow-lift: 0 2px 8px rgba(0, 0, 0, .55), 0 20px 40px -22px rgba(0, 0, 0, .9);
    --header-bg: rgba(13, 16, 21, .84);
  }
}

:root[data-theme="dark"] {
  --bg: #0d1015;
  --surface: #161b22;
  --surface-2: #1e2530;
  --ink: #e8ecf3;
  --muted: #98a2b1;
  --border: #262e3a;
  --accent: #f0b25c;
  --accent-soft: #332613;
  --on-accent: #1a1206;
  --warn: #ff8fa0;
  --warn-soft: #3a1d24;
  --sat: #79b4ee;
  --sun: #ff92a4;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 26px -18px rgba(0, 0, 0, .8);
  --shadow-lift: 0 2px 8px rgba(0, 0, 0, .55), 0 20px 40px -22px rgba(0, 0, 0, .9);
  --header-bg: rgba(13, 16, 21, .84);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

button { font: inherit; color: inherit; }

a { color: var(--accent); }

:where(button, a, input, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 940px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-header h1 {
  margin: 0;
  font-family: "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.reel {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid var(--accent);
  position: relative;
  flex: 0 0 auto;
}
.reel::after {
  content: "";
  position: absolute;
  inset: 4.5px;
  border-radius: 50%;
  background: var(--accent);
}

.container {
  max-width: 940px;
  margin: 0 auto;
  padding: 14px 16px 56px;
}

/* ---------- date tabs ---------- */
.date-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
  margin-bottom: 14px;
}
.date-tabs::-webkit-scrollbar { display: none; }

.date-tab {
  flex: 0 0 auto;
  min-width: 66px;
  padding: 7px 12px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  display: grid;
  gap: 1px;
  justify-items: center;
  line-height: 1.25;
  transition: background .15s, border-color .15s, transform .12s;
}
.date-tab .dow { font-size: .68rem; color: var(--muted); letter-spacing: .08em; }
.date-tab .dnum {
  font-family: "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
  font-size: .94rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.date-tab .dlabel { font-size: .62rem; color: var(--muted); }
.date-tab.is-sat .dow { color: var(--sat); }
.date-tab.is-sun .dow { color: var(--sun); }
.date-tab:hover { border-color: var(--accent); }
.date-tab[aria-current="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.date-tab[aria-current="true"] .dow,
.date-tab[aria-current="true"] .dlabel { color: var(--on-accent); opacity: .85; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.search-field {
  position: relative;
  flex: 1 1 210px;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}
#searchInput {
  width: 100%;
  padding: 10px 40px 10px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: .92rem;
  -webkit-appearance: none;
  appearance: none;
}
#searchInput::-webkit-search-cancel-button,
#searchInput::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
#searchInput::placeholder { color: var(--muted); }

.clear-btn {
  position: absolute;
  right: 7px;
  width: 30px;
  height: 30px;
  padding: 5px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.clear-btn svg { width: 100%; height: 100%; }
.clear-btn:hover { color: var(--ink); }

.view-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  flex: 0 0 auto;
}
.view-switch button {
  padding: 9px 13px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.view-switch button + button { border-left: 1px solid var(--border); }
.view-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

/* ---------- theater filter ---------- */
.theater-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 12px;
  padding: 0;
  border: none;
}
.theater-filter legend { display: none; }

.theater-chip {
  position: relative; /* contains the visually-hidden checkbox */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .78rem;
  cursor: pointer;
  user-select: none;
  transition: background .15s, color .15s, border-color .15s;
}
.theater-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.theater-chip .tick {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  border: 1.5px solid currentColor;
  flex: 0 0 auto;
  position: relative;
}
.theater-chip.is-checked {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--ink);
}
.theater-chip.is-checked .tick { background: var(--ink); border-color: var(--ink); }
.theater-chip.is-checked .tick::after {
  content: "";
  position: absolute;
  left: 3.6px;
  top: .8px;
  width: 3.4px;
  height: 7px;
  border: solid var(--surface);
  border-width: 0 1.9px 1.9px 0;
  transform: rotate(42deg);
}
.theater-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.theater-chip .far-tag {
  font-size: .64rem;
  color: var(--warn);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 5px;
}

.result-meta {
  margin: 0 0 12px;
  font-size: .76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: .66rem;
  line-height: 1.5;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.chip--special {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
  font-weight: 700;
  letter-spacing: .02em;
}
.chip--warn {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
  color: var(--warn);
  font-weight: 700;
}

/* ---------- poster grid ---------- */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
  gap: 18px 12px;
}
@media (max-width: 380px) {
  .poster-grid { grid-template-columns: repeat(2, 1fr); gap: 16px 10px; }
}

.poster-card {
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.poster-thumb {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.poster-card:hover .poster-thumb { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.poster-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  color: var(--muted);
}
.poster-count {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(10, 12, 16, .72);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(4px);
}
.poster-title {
  font-size: .84rem;
  font-weight: 700;
  line-height: 1.38;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.poster-times {
  font-size: .72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- movie (list) view ---------- */
.movie-list { display: flex; flex-direction: column; gap: 10px; }

.movie-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.movie-head {
  width: 100%;
  display: flex;
  gap: 12px;
  padding: 12px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
}
.movie-head:hover { background: var(--surface-2); }
.thumb {
  flex: 0 0 auto;
  width: 54px;
  height: 81px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .poster-fallback { font-size: 1.05rem; }
.thumb--sm { width: 38px; height: 57px; border-radius: 6px; }
.thumb--sm .poster-fallback { font-size: .85rem; }

.movie-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.movie-title { font-size: .95rem; font-weight: 700; line-height: 1.4; }
.movie-meta { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.movie-note { font-size: .72rem; color: var(--warn); }
.expand-hint {
  font-size: .72rem;
  color: var(--accent);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.showtimes { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px; }
.showtime {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid transparent;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.showtime:hover { border-color: var(--accent); background: var(--accent-soft); }
.showtime .st-time {
  font-family: "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
  font-weight: 700;
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
}
.showtime .st-meta { font-size: .66rem; color: var(--muted); }

/* ---------- time view ---------- */
.time-list { display: flex; flex-direction: column; gap: 8px; }
.time-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s, transform .12s;
}
.time-row:hover { border-color: var(--accent); transform: translateX(2px); }
.time-col {
  flex: 0 0 auto;
  font-family: "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
  font-weight: 700;
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
  width: 52px;
}
.time-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.time-title { font-size: .88rem; font-weight: 700; line-height: 1.4; overflow-wrap: break-word; }
.time-sub { font-size: .72rem; color: var(--muted); }

/* ---------- empty / meta ---------- */
.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 44px 16px;
  font-size: .88rem;
}
.updated-at {
  margin-top: 26px;
  text-align: center;
  font-size: .72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: .72rem;
  color: var(--muted);
}
.site-footer p { margin: 0; }
.footer-links { margin-top: 6px; display: flex; gap: 8px; justify-content: center; }

/* ---------- detail sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 10, 14, .58);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .18s ease;
}
@media (min-width: 640px) {
  .sheet-backdrop { align-items: center; padding: 20px; }
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-lift);
  animation: slide-up .22s cubic-bezier(.22, .9, .3, 1);
}
@media (min-width: 640px) {
  .sheet { border-radius: 20px; animation: fade .18s ease; }
}

.sheet-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  padding: 6px;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}
.sheet-close svg { width: 100%; height: 100%; }
.sheet-close:hover { color: var(--ink); }

.sheet-head { display: flex; gap: 14px; margin-bottom: 14px; padding-right: 34px; }
.sheet-head .thumb { width: 74px; height: 111px; border-radius: 10px; }
.sheet-title {
  margin: 0 0 6px;
  font-family: "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
}
.sheet-sub { font-size: .76rem; color: var(--muted); margin-bottom: 6px; font-variant-numeric: tabular-nums; }

.sheet-theater { margin-top: 14px; }
.sheet-theater h3 {
  margin: 0 0 7px;
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}
.sheet-theater .area { font-weight: 400; color: var(--muted); font-size: .7rem; }
.sheet .showtimes { padding: 0; }

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes slide-up { from { transform: translateY(14px); opacity: .6 } to { transform: none; opacity: 1 } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
