:root {
  color-scheme: light;
  --ink: #17120f;
  --muted: #6f655f;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --line: #ded6cb;
  --line-strong: #c5b8aa;
  --theatre-red: #97142d;
  --red-dark: #3a0d14;
  --gold: #b68a2a;
  --teal: #245a67;
  --shadow: 0 18px 50px rgba(35, 25, 16, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(151, 20, 45, 0.08), transparent 36%),
    var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: relative;
  min-height: 132px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.35rem 1.5rem;
  color: #fff8ed;
  background:
    linear-gradient(90deg, rgba(20, 11, 8, 0.88), rgba(28, 16, 12, 0.64) 48%, rgba(20, 11, 8, 0.88)),
    radial-gradient(circle at 18% 18%, rgba(255, 211, 114, 0.54) 0 0.42rem, transparent 0.48rem),
    radial-gradient(circle at 36% 22%, rgba(255, 211, 114, 0.42) 0 0.34rem, transparent 0.4rem),
    radial-gradient(circle at 64% 16%, rgba(255, 211, 114, 0.5) 0 0.38rem, transparent 0.44rem),
    radial-gradient(circle at 82% 24%, rgba(255, 211, 114, 0.44) 0 0.32rem, transparent 0.38rem),
    linear-gradient(135deg, #120c0b 0 18%, #5f1020 38%, #19100d 68%, #0e1718 100%);
  border-bottom: 1px solid rgba(182, 138, 42, 0.62);
  overflow: hidden;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 56%;
  background:
    repeating-linear-gradient(90deg, rgba(255, 248, 237, 0.06) 0 1px, transparent 1px 14.285%),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.3));
  pointer-events: none;
}

.topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 248, 237, 0.1), transparent 25% 74%, rgba(255, 248, 237, 0.08));
  pointer-events: none;
}

.hero-mark,
.hero-copy,
.topbar-meta {
  position: relative;
  z-index: 1;
}

.hero-mark {
  width: clamp(76px, 8vw, 112px);
  height: clamp(76px, 8vw, 112px);
  flex: 0 0 auto;
  display: grid;
  place-items: end center;
  border: 1px solid rgba(255, 235, 176, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 248, 237, 0.14), transparent),
    rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 -12px 30px rgba(0, 0, 0, 0.24), 0 16px 40px rgba(0, 0, 0, 0.18);
}

.hero-mark span {
  width: 16%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #ffd77c, #9b2035 62%, #2b1512);
  box-shadow: 0 0 18px rgba(255, 210, 112, 0.38);
}

.hero-mark span:nth-child(1) {
  height: 52%;
}

.hero-mark span:nth-child(2) {
  height: 74%;
}

.hero-mark span:nth-child(3) {
  height: 44%;
}

.hero-copy {
  margin-right: auto;
}

.eyebrow {
  margin: 0 0 0.24rem;
  color: #f3d88b;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2.15rem, 4.8vw, 4.6rem);
  line-height: 0.9;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.42);
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  max-width: 280px;
}

.topbar-meta span,
.source-link,
.bulk-actions button,
.category-chip {
  border: 1px solid rgba(255, 235, 176, 0.36);
  border-radius: 999px;
  padding: 0.42rem 0.72rem;
  color: inherit;
  background: rgba(0, 0, 0, 0.2);
  text-decoration: none;
}

.workspace {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(290px, 352px) minmax(0, 1fr);
}

.show-panel {
  min-height: calc(100vh - 95px);
  padding: 1rem;
  background: #fffdf9;
  border-right: 1px solid var(--line);
}

.panel-head,
.calendar-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel-head h2,
.calendar-toolbar h2 {
  margin-bottom: 0.2rem;
  font-size: 1.05rem;
}

#selected-count,
#calendar-summary {
  color: var(--muted);
  font-size: 0.86rem;
}

.search-wrap {
  display: block;
  margin: 0.9rem 0 0.75rem;
}

.search-wrap input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 0.8rem;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.search-wrap input:focus {
  border-color: var(--theatre-red);
  box-shadow: 0 0 0 3px rgba(151, 20, 45, 0.12);
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
}

.category-chip {
  border-color: var(--line);
  color: var(--ink);
  background: #f5eee5;
  font-size: 0.78rem;
}

.category-chip[aria-pressed="true"] {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.bulk-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.bulk-actions button {
  min-height: 36px;
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
  font-size: 0.8rem;
}

.show-list {
  display: grid;
  gap: 0.5rem;
  max-height: calc(100vh - 210px);
  overflow: auto;
  padding-right: 0.2rem;
}

.show-item {
  width: 100%;
  min-height: 64px;
}

.show-toggle {
  width: 100%;
  min-width: 0;
  min-height: 64px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--show-color);
  border-radius: 8px;
  padding: 0.45rem 0.55rem 0.45rem 0.45rem;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.show-item.is-selected .show-toggle {
  border-color: rgba(151, 20, 45, 0.38);
  background: #fff8f1;
  box-shadow: 0 8px 22px rgba(35, 25, 16, 0.08);
}

.show-thumb,
.performance-image {
  display: grid;
  place-items: center;
  color: #fff;
  background:
    linear-gradient(140deg, var(--show-color), #241713),
    var(--show-color);
  background-position: center;
  background-size: cover;
  font-weight: 900;
}

.show-thumb {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  font-size: 0.78rem;
}

.show-copy {
  min-width: 0;
}

.show-copy strong,
.performance-copy strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.show-copy strong {
  font-size: 0.88rem;
}

.show-copy small,
.performance-copy small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.show-copy small {
  margin-top: 0.14rem;
  font-size: 0.74rem;
}

.checkmark {
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
}

.show-item.is-selected .checkmark {
  border-color: var(--show-color);
  background: radial-gradient(circle at center, var(--show-color) 0 48%, transparent 52%);
}

.calendar-area {
  min-width: 0;
  padding: 1rem 1rem 1.4rem;
}

.calendar-toolbar {
  margin-bottom: 0.9rem;
}

.calendar-toolbar h2 {
  font-size: 1.28rem;
}

.source-link {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

.calendar-grid {
  display: grid;
  grid-template-columns: 88px repeat(7, minmax(172px, 1fr));
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--line);
  box-shadow: var(--shadow);
}

.calendar-corner,
.day-header,
.row-label,
.performance-cell {
  min-width: 0;
  background: #fff;
}

.calendar-corner,
.day-header {
  min-height: 58px;
  border-bottom: 1px solid var(--line);
}

.calendar-corner,
.row-label {
  display: grid;
  place-items: center;
  padding: 0.75rem 0.5rem;
  color: #fffaf2;
  background: #241713;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.day-header {
  display: grid;
  align-content: center;
  gap: 0.18rem;
  padding: 0.55rem 0.75rem;
  border-left: 1px solid var(--line);
}

.day-header span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.day-header strong {
  font-size: 0.98rem;
}

.row-label {
  min-height: 250px;
  height: min(36vh, 340px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.performance-cell {
  position: relative;
  min-height: 250px;
  height: min(36vh, 340px);
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
  padding: 2.2rem 0.55rem 0.55rem;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  overflow-y: auto;
}

.performance-cell.is-focused {
  background: #fffbf0;
  box-shadow: inset 0 0 0 2px rgba(182, 138, 42, 0.52);
}

.performance-cell.is-muted {
  background: #f2ebe3;
}

.focused-slot-panel {
  grid-column: span 7;
  min-width: 0;
  max-height: min(72vh, 680px);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 0.85rem;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  background: #fffbf0;
  box-shadow: inset 0 0 0 2px rgba(182, 138, 42, 0.52);
  overflow: auto;
}

.focused-slot-head {
  position: sticky;
  top: -0.85rem;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.15rem 0 0.65rem;
  background: linear-gradient(180deg, #fffbf0 74%, rgba(255, 251, 240, 0));
}

.focused-slot-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.focused-slot-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.focused-slot-head .slot-controls {
  position: static;
  margin-left: auto;
}

.focused-slot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.65rem;
  align-items: start;
}

.focused-slot-panel .performance-link {
  min-height: 68px;
}

.focused-slot-panel .performance-copy strong {
  overflow: visible;
  white-space: normal;
}

.slot-controls {
  position: absolute;
  top: 0.42rem;
  right: 0.42rem;
  z-index: 2;
  display: flex;
  gap: 0.28rem;
}

.slot-focus-button,
.slot-restore-button {
  width: 1.45rem;
  height: 1.45rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
}

.slot-focus-button:hover,
.slot-focus-button[aria-pressed="true"],
.slot-restore-button:hover {
  border-color: var(--gold);
  color: #fff;
  background: #7a5a0f;
}

.slot-restore-button {
  width: auto;
  min-width: 2.1rem;
  padding: 0 0.42rem;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.performance-card {
  flex: 0 0 auto;
  position: relative;
  border: 1px solid rgba(35, 25, 16, 0.12);
  border-left: 4px solid var(--show-color);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.performance-card.is-pinned {
  border-color: rgba(182, 138, 42, 0.72);
  background: #fff9e6;
  box-shadow: 0 9px 20px rgba(134, 92, 8, 0.15);
}

.performance-pin,
.performance-hide {
  position: absolute;
  top: 0.38rem;
  z-index: 3;
  width: 1.35rem;
  height: 1.35rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(35, 25, 16, 0.16);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.9);
}

.performance-pin {
  right: 0.38rem;
}

.performance-hide {
  right: 1.9rem;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.performance-pin::before {
  content: "\2606";
  font-size: 0.85rem;
  line-height: 1;
}

.performance-pin[aria-pressed="true"] {
  border-color: var(--gold);
  color: #6f4e00;
  background: #fff3c8;
}

.performance-pin[aria-pressed="true"]::before {
  content: "\2605";
}

.performance-hide:hover {
  border-color: var(--theatre-red);
  color: #fff;
  background: var(--theatre-red);
}

.performance-link {
  min-height: 58px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 0.52rem;
  padding: 0.42rem 1.82rem 0.42rem 0.42rem;
  text-decoration: none;
}

.performance-card.has-slot-hide .performance-link {
  padding-right: 3.25rem;
}

.performance-card:hover {
  box-shadow: 0 9px 20px rgba(35, 25, 16, 0.14);
  transform: translateY(-1px);
}

.performance-image {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  font-size: 0.7rem;
}

.performance-copy {
  min-width: 0;
}

.performance-copy strong {
  font-size: 0.78rem;
  line-height: 1.18;
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.performance-copy small {
  margin-top: 0.12rem;
  font-size: 0.68rem;
}

.popularity-score {
  position: absolute;
  right: 0.38rem;
  bottom: 0.34rem;
  z-index: 3;
  display: grid;
  min-width: 1.42rem;
  height: 1.05rem;
  place-items: center;
  border: 1px solid rgba(36, 90, 103, 0.22);
  border-radius: 999px;
  color: #245a67;
  background: rgba(36, 90, 103, 0.08);
  font-size: 0.61rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: auto;
}

.performance-copy small {
  padding-right: 1.85rem;
}

.empty-slot,
.empty-state,
.load-error {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.empty-slot {
  padding: 0.4rem;
}

.empty-state,
.load-error {
  padding: 1rem;
}

.mobile-days {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 310px minmax(0, 1fr);
  }

  .show-panel {
    min-height: calc(100vh - 95px);
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .show-list {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 210px);
  }

  .calendar-grid {
    overflow-x: auto;
  }

  .mobile-days {
    display: none;
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-meta {
    justify-content: flex-start;
  }

  .workspace {
    display: block;
  }

  .show-panel {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .show-list {
    grid-template-columns: 1fr;
    max-height: 360px;
  }

  .calendar-grid {
    display: none;
  }

  .mobile-days {
    display: grid;
    gap: 0.8rem;
  }

  .mobile-day {
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(35, 25, 16, 0.1);
  }

  .mobile-day h3 {
    margin: 0;
    padding: 0.75rem 0.85rem;
    color: #fffaf2;
    background: #241713;
    font-size: 1rem;
  }

  .mobile-part {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.7rem;
    border-top: 1px solid var(--line);
  }

  .mobile-part.is-focused {
    background: #fffbf0;
  }

  .mobile-part.is-muted {
    background: #f2ebe3;
  }

  .mobile-part-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
  }

  .mobile-part-head h4 {
    margin: 0;
    color: var(--theatre-red);
    font-size: 0.82rem;
    text-transform: uppercase;
  }

  .mobile-part .slot-controls {
    position: static;
    flex: 0 0 auto;
  }
}

@media (max-width: 520px) {
  .topbar,
  .show-panel,
  .calendar-area {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .panel-head,
  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 0.35rem;
  }

  .bulk-actions {
    grid-template-columns: 1fr;
  }
}
