/* Station — Minimal static site styles */

:root {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --muted: #666;
  --border: #e0e0e0;
  --accent: #0055cc;
  --card-bg: #fff;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Dark mode — system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1a2e;
    --fg: #e0e0e0;
    --muted: #999;
    --border: #2e2e4a;
    --accent: #5b9bd5;
    --card-bg: #22223a;
  }
}

/* Dark mode — manual override */
:root[data-theme="dark"] {
  --bg: #1a1a2e;
  --fg: #e0e0e0;
  --muted: #999;
  --border: #2e2e4a;
  --accent: #5b9bd5;
  --card-bg: #22223a;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

header p {
  color: var(--muted);
  font-size: 0.9rem;
}

nav {
  margin-top: 0.75rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}

nav a.active {
  border-bottom-color: var(--accent);
  font-weight: 600;
}

nav a:hover {
  border-bottom-color: var(--accent);
}

/* Theme toggle */

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: auto;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--fg);
}

main section {
  margin-bottom: 2rem;
}

h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.placeholder {
  color: var(--muted);
  font-style: italic;
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.card .meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.card a {
  color: var(--accent);
  text-decoration: none;
}

.card a:hover {
  text-decoration: underline;
}

.guide-entry {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.guide-entry .time {
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 5rem;
  font-variant-numeric: tabular-nums;
}

.channel-wall {
  display: grid;
  gap: 0.75rem;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  margin-left: 0.5rem;
}

.badge.live {
  background: #cc0000;
}

.badge.upcoming {
  background: #cc8800;
}

.badge.now {
  background: #00884d;
}

/* Guide date navigation */

.guide-date-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 0.5rem 0;
}

.guide-nav-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-size: 1rem;
  color: var(--accent);
}

.guide-nav-btn:hover {
  background: var(--border);
}

.guide-date-label {
  font-weight: 600;
  font-size: 0.95rem;
}

/* Guide time grid */

.guide-time-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.guide-block {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.guide-block-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.guide-block-name {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.guide-block-time {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.guide-block-character {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

.guide-block-entries {
  padding: 0.5rem;
}

.guide-block-empty {
  padding: 0.5rem 1rem;
}

.guide-entry .guide-entry-content {
  flex: 1;
  min-width: 0;
}

.guide-entry h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.15rem 0;
}

/* Current time highlight */

.guide-entry.now-airing {
  border-left: 3px solid #00884d;
  background: #f0faf5;
}

/* Past entries are muted */

.guide-entry.past {
  opacity: 0.6;
}

/* Live entries */

.guide-entry.is-live {
  border-left: 3px solid #cc0000;
  background: #fef5f5;
}

/* Upcoming entries */

.guide-entry.is-upcoming {
  border-left: 3px solid #cc8800;
  background: #fffbf0;
}

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

/* Wall controls */

#wall-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
  flex-wrap: wrap;
}

.wall-layout-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wall-layout-switcher label {
  font-size: 0.9rem;
  font-weight: 600;
}

.wall-layout-switcher select {
  font-size: 0.9rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--fg);
}

.wall-playback-pref {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.wall-playback-pref label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

/* Wall tiles */

.wall-tile {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wall-tile-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.wall-tile-channel {
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.wall-tile-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Embedded player */

.wall-tile-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  background: #000;
}

.wall-tile-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Thumbnail fallback */

.wall-tile-thumb {
  display: block;
  position: relative;
  width: 100%;
  background: #000;
}

.wall-tile-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.wall-tile-duration {
  position: absolute;
  bottom: 0.4rem;
  right: 0.4rem;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.75rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
}

/* Tile info */

.wall-tile-info {
  padding: 0.5rem 0.75rem;
}

.wall-tile-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wall-tile-title:hover {
  color: var(--accent);
  text-decoration: underline;
}

.wall-tile-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.wall-tile-empty {
  margin: auto;
  font-size: 0.85rem;
  padding: 1.5rem;
}

/* Wall tile state indicators */

.wall-state-live {
  border-color: #cc0000;
  box-shadow: 0 0 0 1px #cc0000;
}

.wall-state-live .wall-tile-header {
  background: #fef5f5;
}

.wall-state-upcoming {
  border-color: #cc8800;
  box-shadow: 0 0 0 1px #cc8800;
}

.wall-state-upcoming .wall-tile-header {
  background: #fffbf0;
}

.wall-state-stale {
  opacity: 0.65;
}

.badge.stale {
  background: var(--muted);
}

/* Responsive wall: collapse to fewer columns on narrow screens */

@media (max-width: 768px) {
  .channel-wall {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  .channel-wall {
    grid-template-columns: 1fr !important;
  }
}

/* Receipt styles */

.receipt-nav {
  margin-bottom: 1rem;
}

.receipt-list-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.receipt-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.receipt-card:hover {
  border-color: var(--accent);
}

.receipt-card-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.receipt-card-id {
  font-size: 1rem;
  font-weight: 700;
}

.receipt-card-period {
  font-size: 0.85rem;
  color: var(--muted);
}

.receipt-card-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.receipt-card-notes {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Receipt detail view */

.receipt-header {
  margin-bottom: 1.5rem;
}

.receipt-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.receipt-period {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.receipt-stats-grid {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.receipt-stat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  min-width: 120px;
  text-align: center;
}

.receipt-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  display: block;
}

.receipt-stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  display: block;
  margin-top: 0.15rem;
}

.receipt-notes {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
}

.receipt-section {
  margin-bottom: 1.5rem;
}

.receipt-section h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.receipt-video-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.receipt-video {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
}

.receipt-video-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.receipt-video-title:hover {
  text-decoration: underline;
}

.receipt-video-channel {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.receipt-channel-dist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.receipt-channel-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.receipt-channel-count {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  font-weight: 600;
}

/* Search styles */

#search-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#search-input {
  flex: 1;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--fg);
  font-family: var(--font);
}

#search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 85, 204, 0.15);
}

#search-status {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-result {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
}

.search-result-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.search-result-thumb {
  width: 120px;
  min-width: 120px;
  border-radius: 4px;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: #000;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  display: block;
  margin-bottom: 0.25rem;
}

.search-result-title:hover {
  text-decoration: underline;
}

.search-result-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.search-result-description {
  font-size: 0.85rem;
  color: var(--fg);
  margin-top: 0.25rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-result-transcript {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem;
}

.search-result-transcript-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.search-result-segments {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.search-result-segment {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.search-result-timestamp {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  min-width: 4rem;
  flex-shrink: 0;
}

.search-result-timestamp:hover {
  text-decoration: underline;
}

.search-result-segment-text {
  font-size: 0.85rem;
  color: var(--fg);
}

.search-highlight {
  background: rgba(0, 85, 204, 0.12);
  font-weight: 600;
}

.search-result .badge {
  margin-left: 0.25rem;
  font-size: 0.7rem;
}

@media (max-width: 480px) {
  .search-result-header {
    flex-direction: column;
  }
  .search-result-thumb {
    width: 100%;
  }
}

/* Curator styles */

#curator-chat {
  margin-bottom: 1.5rem;
}

#curator-messages {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.curator-message {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 85%;
}

.curator-system {
  background: var(--bg);
  color: var(--muted);
  font-style: italic;
  align-self: center;
  text-align: center;
  max-width: 100%;
}

.curator-user {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
}

.curator-response {
  background: var(--bg);
  border: 1px solid var(--border);
  align-self: flex-start;
  white-space: pre-wrap;
}

#curator-input-area {
  display: flex;
  gap: 0.5rem;
}

#curator-input {
  flex: 1;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--fg);
  font-family: var(--font);
}

#curator-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 85, 204, 0.15);
}

#curator-state-section {
  margin-top: 1.5rem;
}

#curator-state-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.curator-state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.75rem;
}

.curator-state-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}

.curator-state-card h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.curator-state-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.2rem 0;
  font-size: 0.85rem;
}

.curator-state-item .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.curator-state-score {
  display: inline-block;
  min-width: 3rem;
  text-align: right;
  font-weight: 600;
  color: var(--accent);
}

.curator-decisions {
  margin-top: 0.75rem;
}

.curator-decision {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.curator-decision-action {
  font-weight: 600;
  color: var(--accent);
}

.curator-decision-date {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Multi-screen coordination (Phase 8) */

/* Playback notification bar for cross-tab video selection */

.station-playback-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  border-radius: 0 0 6px 6px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.station-playback-link {
  color: #fff;
  text-decoration: underline;
  font-weight: 600;
}

.station-playback-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}

/* Guide screen: collapse to list on narrow screens */

@media (max-width: 600px) {
  .guide-block-header {
    flex-direction: column;
    gap: 0.25rem;
  }

  .guide-entry {
    flex-direction: column;
    gap: 0.25rem;
  }

  .guide-entry .time {
    min-width: auto;
    font-size: 0.8rem;
  }

  .guide-date-nav {
    gap: 0.5rem;
  }

  .guide-date-label {
    font-size: 0.85rem;
    text-align: center;
    flex: 1;
  }
}

/* Playback screen: fill viewport on mobile */

@media (max-width: 480px) {
  body[data-screen-role="guide"] {
    padding: 1rem 0.5rem;
  }

  body[data-screen-role="wall"] {
    padding: 1rem 0.5rem;
  }

  .wall-tile-embed {
    padding-bottom: 56.25%;
  }

  .wall-tile-info {
    padding: 0.4rem 0.5rem;
  }

  .wall-tile-title {
    font-size: 0.8rem;
  }
}

/* Curator screen: clean conversation on all screen sizes */

@media (max-width: 600px) {
  #curator-messages {
    min-height: 150px;
    max-height: 300px;
  }

  .curator-message {
    max-width: 95%;
    font-size: 0.85rem;
  }

  .curator-state-grid {
    grid-template-columns: 1fr;
  }
}

/* Wide screen: expand wall grid */

@media (min-width: 1200px) {
  body[data-screen-role="wall"] {
    max-width: 1600px;
  }
}

/* Dark mode overrides for hardcoded colours */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .guide-entry.now-airing {
    background: #1a2e26;
  }
  :root:not([data-theme="light"]) .guide-entry.is-live {
    background: #2e1a1a;
  }
  :root:not([data-theme="light"]) .guide-entry.is-upcoming {
    background: #2e2a1a;
  }
  :root:not([data-theme="light"]) .wall-state-live .wall-tile-header {
    background: #2e1a1a;
  }
  :root:not([data-theme="light"]) .wall-state-upcoming .wall-tile-header {
    background: #2e2a1a;
  }
  :root:not([data-theme="light"]) .search-highlight {
    background: rgba(91, 155, 213, 0.2);
  }
  :root:not([data-theme="light"]) #search-input:focus,
  :root:not([data-theme="light"]) #curator-input:focus {
    box-shadow: 0 0 0 2px rgba(91, 155, 213, 0.25);
  }
}

:root[data-theme="dark"] .guide-entry.now-airing {
  background: #1a2e26;
}

:root[data-theme="dark"] .guide-entry.is-live {
  background: #2e1a1a;
}

:root[data-theme="dark"] .guide-entry.is-upcoming {
  background: #2e2a1a;
}

:root[data-theme="dark"] .wall-state-live .wall-tile-header {
  background: #2e1a1a;
}

:root[data-theme="dark"] .wall-state-upcoming .wall-tile-header {
  background: #2e2a1a;
}

:root[data-theme="dark"] .search-highlight {
  background: rgba(91, 155, 213, 0.2);
}

:root[data-theme="dark"] #search-input:focus,
:root[data-theme="dark"] #curator-input:focus {
  box-shadow: 0 0 0 2px rgba(91, 155, 213, 0.25);
}
