:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --panel: #ffffff;
  --border: #deded8;
  --text: #1f2328;
  --muted: #646a73;
  --accent: #0f766e;
  --accent-soft: #e4f4f1;
  --chip: #eeeeea;
  --shadow: 0 10px 30px rgba(31, 35, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.toolbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

.summary {
  margin-top: 8px;
  color: var(--muted);
}

.controls {
  display: grid;
  gap: 12px;
  width: min(460px, 100%);
}

.search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
}

.search input,
.clearFilters {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--panel);
  font: inherit;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.filters legend {
  flex: 0 0 100%;
  margin-bottom: 2px;
  color: var(--muted);
  font-weight: 700;
}

.filterToggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filterToggle span,
.clearFilters {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 13px;
  background: var(--panel);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.filterToggle input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.filterToggle input:focus-visible + span,
.clearFilters:focus-visible,
.search input:focus-visible,
.nativeFilter select:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: 2px;
}

.clearFilters {
  width: auto;
  border-radius: 999px;
  color: var(--muted);
}

.clearFilters:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.nativeFilters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.nativeFilter {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-weight: 700;
}

.nativeFilter select {
  width: 100%;
  min-height: 118px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.fallback {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid #e2c044;
  border-radius: 8px;
  background: #fff8db;
}

.hidden {
  display: none;
}

.filePicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-weight: 700;
}

.movies {
  display: grid;
  gap: 14px;
}

.movie {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.posterWrap {
  position: relative;
  overflow: hidden;
  align-self: start;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  background: #e9e9e3;
}

.poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.posterFallback {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.posterWrap.isMissing .poster {
  display: none;
}

.posterWrap.isMissing .posterFallback {
  display: grid;
}

.movieBody {
  min-width: 0;
}

.movieHeader {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.titleJa {
  font-size: 22px;
  line-height: 1.25;
}

.titleOrig {
  margin-top: 4px;
  color: var(--muted);
}

.idBadge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--chip);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.meta div,
.formats span,
.time {
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--chip);
}

.meta dt,
.meta dd {
  display: inline;
  margin: 0;
}

.meta dt {
  color: var(--muted);
  font-weight: 700;
}

.meta dt::after {
  content: ": ";
}

.schedule {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.schedule summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
}

.theaterList {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.theater {
  display: grid;
  gap: 10px;
}

.theater h3 {
  font-size: 17px;
}

.theaterId {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
}

.showing {
  display: grid;
  gap: 8px;
  padding-left: 12px;
  border-left: 3px solid var(--accent-soft);
}

.formats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.formats span {
  background: var(--accent-soft);
  color: #115e59;
  font-weight: 700;
}

.dateRow {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin-top: 6px;
}

.date {
  color: var(--muted);
  font-weight: 800;
}

.times {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.empty {
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
  }

  .controls {
    width: 100%;
  }

  .filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .filters legend {
    grid-column: 1 / -1;
  }

  .filterToggle span,
  .clearFilters {
    width: 100%;
    min-height: 40px;
    padding-inline: 8px;
    white-space: nowrap;
  }

  .nativeFilters {
    grid-template-columns: 1fr;
  }

  .nativeFilter select {
    min-height: 96px;
  }

  .movie {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .titleJa {
    font-size: 18px;
  }

  .movieHeader {
    flex-direction: column;
    gap: 8px;
  }

  .idBadge {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .meta {
    gap: 6px;
  }

  .meta div {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .theaterList {
    gap: 14px;
  }

  .theater h3 {
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  .dateRow {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 430px) {
  body {
    font-size: 14px;
  }

  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .clearFilters {
    grid-column: 1 / -1;
  }

  .movie {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
  }

  .posterWrap {
    border-radius: 5px;
  }

  .titleJa {
    font-size: 17px;
  }

  .titleOrig {
    font-size: 13px;
  }

  .schedule summary {
    min-height: 34px;
    display: flex;
    align-items: center;
  }
}
