:root {
  --bg: #02030b;
  --bg-soft: #080d2a;
  --panel-bg: rgba(7, 14, 52, 0.9);
  --panel-bg-strong: rgba(8, 18, 68, 0.96);
  --panel-border: rgba(118, 142, 255, 0.34);
  --panel-border-strong: rgba(124, 150, 255, 0.5);
  --accent: #5a59ff;
  --accent-strong: #7d7cff;
  --accent-glow: rgba(90, 89, 255, 0.35);
  --gold: #f3d53f;
  --text: #f4f6ff;
  --muted: rgba(227, 233, 255, 0.72);
  --muted-strong: rgba(240, 243, 255, 0.9);
  --grid-line: rgba(110, 129, 255, 0.32);
  --guide-channel-width: 336px;
  color-scheme: dark;
  font-family: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  font-weight: 400;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(21, 34, 113, 0.34), transparent 18%),
    radial-gradient(circle at top right, rgba(65, 77, 255, 0.28), transparent 38%),
    radial-gradient(circle at 18% 14%, rgba(43, 71, 210, 0.2), transparent 28%),
    linear-gradient(180deg, #000107 0%, #05081a 18%, #060d2d 58%, #03040d 100%);
  padding: 0 0 3rem;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03) 0,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.08;
}

.guide-page {
  background:
    linear-gradient(180deg, rgba(11, 19, 76, 0.4), transparent 16%),
    radial-gradient(circle at 78% 8%, rgba(86, 87, 255, 0.34), transparent 24%),
    linear-gradient(180deg, #000107 0%, #020616 16%, #040b2b 60%, #03040d 100%);
}

main,
.hero,
.banner {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}

.guide-page main,
.guide-page .hero,
.guide-page .banner {
  width: min(1580px, calc(100vw - 20px));
}

.guide-page main {
  padding-top: 0.85rem;
}

.hero {
  padding: 1.4rem 0 1.15rem;
}

.hero-content {
  border: 1px solid rgba(110, 129, 255, 0.18);
  border-radius: 18px;
  padding: 1.2rem 1.4rem;
  background: linear-gradient(180deg, rgba(8, 14, 48, 0.86), rgba(5, 10, 31, 0.62));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

.guide-page .hero-content {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: rgba(3, 8, 32, 0.88);
}

.hero-content h1 {
  margin: 0.25rem 0 0;
  font-size: clamp(2rem, 3vw, 3.35rem);
  line-height: 1.05;
}

.guide-page .hero-content h1 {
  font-size: clamp(1.6rem, 2.2vw, 2.4rem);
}

.hero-content p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  color: rgba(227, 233, 255, 0.58);
}

.panel {
  margin-top: 1rem;
  padding: 1.4rem;
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(7, 16, 60, 0.95), rgba(4, 10, 34, 0.94));
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(14px);
}

.panel-header,
.schedule-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
}

h2,
h3,
h4 {
  margin: 0;
}

.field-group + .field-group {
  margin-top: 1rem;
}

.field-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted-strong);
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
.sort-label select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(126, 145, 255, 0.34);
  background: rgba(4, 8, 24, 0.82);
  color: var(--text);
  padding: 0.82rem 0.95rem;
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
.sort-label select:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(109, 118, 255, 0.18), 0 0 24px rgba(90, 89, 255, 0.16);
  background: rgba(5, 11, 33, 0.96);
}

.field-grid,
.guide-form {
  display: grid;
  gap: 1rem 1.2rem;
}

.field-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.guide-form {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.form-meta,
.schedule-actions {
  margin-top: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.9rem;
  color: var(--muted);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(125, 124, 255, 0.45);
  border-radius: 999px;
  padding: 0.78rem 1.5rem;
  background: linear-gradient(180deg, #5758ff 0%, #2f35d8 100%);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

button:hover,
.button:hover {
  transform: translateY(-1px);
  border-color: rgba(169, 176, 255, 0.7);
  box-shadow: 0 10px 24px var(--accent-glow);
}

button:disabled {
  opacity: 0.62;
  cursor: progress;
  box-shadow: none;
}

.button.ghost,
button.ghost {
  background: rgba(8, 16, 58, 0.62);
  border-color: rgba(136, 154, 255, 0.34);
}

.banner {
  margin-top: 1rem;
  padding: 0.95rem 1.15rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 102, 102, 0.42);
  background: rgba(87, 10, 18, 0.42);
  color: #ffd5d5;
}

.hidden {
  display: none;
}

.now-grid {
  display: grid;
  grid-template-columns: minmax(380px, 1.08fr) minmax(300px, 0.92fr);
  gap: 1.5rem;
  align-items: stretch;
}

.now-grid > :first-child {
  order: 2;
}

.now-grid > .embed-wrapper {
  order: 1;
}

.subtle {
  margin-top: 0.25rem;
  color: var(--muted);
}

.helper-text {
  margin-top: 0.8rem;
  font-size: 0.92rem;
}

.helper-text code {
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.guide-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.guide-nav a,
.guide-nav strong {
  color: var(--muted-strong);
  text-decoration: none;
}

.mono {
  font-family: "JetBrains Mono", "Space Mono", ui-monospace, SFMono-Regular, monospace;
  letter-spacing: 0.03em;
  color: var(--muted-strong);
}

.embed-wrapper {
  position: relative;
  min-height: 100%;
  padding-bottom: 56.25%;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(108, 128, 255, 0.24);
  background: #000;
}

.embed-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.notice {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px dashed rgba(130, 147, 255, 0.34);
  background: rgba(14, 22, 63, 0.55);
  color: var(--muted-strong);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-value {
  margin: 0.35rem 0 0;
  font-size: 1.28rem;
}

.playlist-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.playlist-card {
  padding: 1rem 1.1rem;
  text-align: left;
  border-radius: 16px;
  border: 1px solid rgba(111, 130, 255, 0.24);
  background: linear-gradient(180deg, rgba(10, 18, 54, 0.84), rgba(5, 10, 29, 0.84));
  cursor: pointer;
}

.playlist-card:hover {
  background: linear-gradient(180deg, rgba(18, 32, 95, 0.92), rgba(9, 18, 54, 0.92));
}

.playlist-card h4 {
  margin: 0 0 0.25rem;
  color: var(--muted-strong);
  font-size: 1rem;
  word-break: break-word;
}

.playlist-card p {
  margin: 0.1rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
}

th,
td {
  padding: 0.78rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid rgba(110, 129, 255, 0.18);
}

th {
  color: rgba(227, 233, 255, 0.62);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 500;
}

tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(34, 50, 123, 0.28);
}

tr.active {
  background: rgba(64, 81, 184, 0.42);
}

tr.future td {
  color: rgba(227, 233, 255, 0.82);
}

.title-cell {
  font-weight: 500;
}

.channel-nav {
  width: min(1580px, calc(100vw - 20px));
  margin: 0.85rem auto 0;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.channel-nav button {
  min-width: 158px;
}

.player-panel {
  display: grid;
  grid-template-columns: minmax(520px, 1.2fr) minmax(320px, 0.8fr);
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.player-media {
  padding: 0;
  min-height: 420px;
  background: #000;
}

.player-meta {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.85rem;
  padding: 2.2rem 2rem;
  background:
    linear-gradient(180deg, rgba(20, 17, 208, 0.98) 0%, rgba(19, 16, 160, 0.96) 42%, rgba(22, 15, 188, 0.97) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
  position: relative;
}

.player-meta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 26%, transparent 74%, rgba(255, 255, 255, 0.05));
  pointer-events: none;
}

.player-meta > * {
  position: relative;
}

.player-meta .eyebrow {
  color: rgba(243, 213, 63, 0.82);
}

.player-meta h2 {
  font-size: clamp(2rem, 3.8vw, 3.1rem);
  line-height: 1.02;
}

.guide-embed,
.large-embed {
  border: 0;
  border-radius: 0;
  height: 100%;
}

.large-embed {
  padding-bottom: 0;
  min-height: 420px;
}

.schedule-panel {
  padding: 1rem 0 0;
  overflow: hidden;
}

.schedule-header {
  padding: 0 1rem 1rem;
}

.sort-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.sort-label select {
  width: auto;
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
}

.schedule-shell {
  overflow-x: auto;
  border-top: 1px solid rgba(110, 129, 255, 0.18);
  background: linear-gradient(180deg, rgba(7, 13, 46, 0.8), rgba(3, 7, 25, 0.82));
}

.guide-ruler,
.guide-table {
  min-width: 1120px;
}

.guide-ruler-row,
.guide-row {
  display: grid;
  grid-template-columns: var(--guide-channel-width) minmax(0, 1fr);
}

.guide-ruler-row {
  min-height: 54px;
  border-bottom: 1px solid var(--grid-line);
  background: rgba(7, 14, 55, 0.94);
}

.guide-ruler-spacer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: rgba(227, 233, 255, 0.52);
  border-right: 1px solid var(--grid-line);
}

.guide-ruler-track {
  display: flex;
  min-width: 0;
}

.guide-ruler-slot {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0.75rem 0.7rem;
  border-right: 1px solid var(--grid-line);
  color: rgba(240, 243, 255, 0.85);
  font-size: 0.95rem;
  font-weight: 600;
}

.guide-ruler-slot span {
  white-space: nowrap;
}

.guide-grid-shell {
  position: relative;
}

.guide-now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ff3a38;
  box-shadow: 0 0 16px rgba(255, 58, 56, 0.45);
  left: calc(var(--guide-channel-width) + (100% - var(--guide-channel-width)) * var(--guide-progress, 0));
  z-index: 4;
  pointer-events: none;
}

.guide-table {
  display: flex;
  flex-direction: column;
}

.guide-row {
  min-height: 72px;
  border-bottom: 1px solid var(--grid-line);
  background: rgba(4, 10, 36, 0.76);
}

.guide-row:nth-child(even) {
  background: rgba(6, 12, 44, 0.9);
}

.guide-row.active-row .guide-channel {
  background: rgba(16, 25, 86, 0.92);
}

.guide-channel {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0.8rem 0.9rem;
  border-right: 1px solid var(--grid-line);
  background: rgba(5, 10, 36, 0.82);
}

.channel-badge {
  width: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  align-self: stretch;
  border-radius: 10px;
  background: rgba(240, 243, 255, 0.04);
  color: var(--gold);
  font-size: 1.45rem;
  font-weight: 700;
}

.channel-meta {
  min-width: 0;
}

.channel-name,
.channel-hint {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-name {
  font-size: 0.88rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(240, 243, 255, 0.96);
}

.channel-hint {
  margin-top: 0.15rem;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: rgba(227, 233, 255, 0.62);
}

.guide-timeline {
  display: flex;
  min-width: 0;
  overflow: hidden;
}

.guide-segment {
  min-width: 0;
  padding: 0.78rem 0.58rem;
  border: 0;
  border-right: 1px solid rgba(111, 130, 255, 0.45);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(30, 39, 122, 0.78), rgba(17, 24, 85, 0.78));
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.2rem;
  cursor: pointer;
  min-height: 72px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.guide-segment:hover,
.guide-segment:focus-visible {
  outline: none;
  background: linear-gradient(180deg, rgba(42, 54, 148, 0.86), rgba(22, 32, 105, 0.86));
}

.guide-segment strong,
.guide-segment span {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guide-segment strong {
  font-size: 0.92rem;
  color: var(--muted-strong);
}

.guide-segment span {
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: rgba(227, 233, 255, 0.65);
}

.guide-segment.compact,
.guide-segment.tight {
  padding-inline: 0.42rem;
}

.guide-segment.compact span,
.guide-segment.tight span,
.guide-segment.micro span {
  display: none;
}

.guide-segment.tight strong {
  font-size: 0.8rem;
}

.guide-segment.micro {
  padding-inline: 0.24rem;
}

.guide-segment.micro strong {
  display: none;
}

.guide-segment.live {
  background: linear-gradient(180deg, rgba(58, 74, 190, 0.94), rgba(31, 42, 136, 0.94));
}

.guide-segment.live strong,
.guide-segment.active strong {
  color: #fff;
}

.guide-segment.active {
  background: linear-gradient(180deg, rgba(72, 98, 255, 0.98), rgba(39, 58, 184, 0.98));
  box-shadow: inset 0 0 0 2px rgba(243, 213, 63, 0.9);
}

.guide-segment.standby {
  background: rgba(10, 15, 46, 0.72);
  color: rgba(227, 233, 255, 0.58);
  font-style: italic;
}

.guide-segment.standby strong,
.guide-segment.standby span {
  color: inherit;
}

.timezone-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.88rem;
  border-radius: 999px;
  border: 1px solid rgba(134, 151, 255, 0.26);
  background: rgba(8, 14, 49, 0.66);
}

@media (max-width: 1100px) {
  .player-panel,
  .now-grid {
    grid-template-columns: 1fr;
  }

  .player-media,
  .large-embed {
    min-height: 320px;
  }

  .player-meta h2 {
    font-size: 2rem;
  }
}

@media (max-width: 900px) {
  main,
  .hero,
  .banner,
  .guide-page main,
  .guide-page .hero,
  .guide-page .banner,
  .channel-nav {
    width: min(100vw - 18px, 100%);
  }

  .guide-ruler,
  .guide-now-line {
    display: none;
  }

  .guide-row {
    grid-template-columns: 1fr;
  }

  .guide-channel {
    border-right: 0;
    border-bottom: 1px solid var(--grid-line);
  }

  .schedule-header,
  .form-meta,
  .schedule-actions {
    align-items: stretch;
  }
}
