:root {
  --bg: #faf8f5;
  --surface: rgba(255, 252, 247, 0.9);
  --surface-strong: #fffdf9;
  --line: rgba(78, 62, 47, 0.14);
  --line-strong: rgba(78, 62, 47, 0.26);
  --text: #201a14;
  --muted: #6d6257;
  --accent: #b45c1f;
  --accent-soft: rgba(180, 92, 31, 0.1);
  --live: #9f2f22;
  --shadow: 0 18px 40px rgba(40, 28, 18, 0.08);
  --radius: 10px;
  --page-width: 1540px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans JP", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(219, 165, 98, 0.14), transparent 24rem),
    linear-gradient(180deg, #fcfbf8 0%, #f4eee7 100%);
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(100%, var(--page-width));
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.app-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 22px;
}

.brand-row,
.control-row,
.summary-row,
.panel-header,
.date-actions,
.date-cluster,
.search-box,
.meta-grid,
.detail-links,
.detail-toolbar {
  display: flex;
  gap: 12px;
}

.brand-row,
.panel-header,
.detail-toolbar {
  align-items: center;
  justify-content: space-between;
}

.control-row,
.summary-row {
  margin-top: 18px;
}

.control-row {
  align-items: end;
  gap: 18px;
}

.summary-row {
  flex-wrap: wrap;
}

.brand {
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.mobile-search-toggle,
.search-clear {
  display: none;
}

.date-cluster,
.search-cluster {
  flex: 1 1 360px;
}

.region-picker {
  flex: 0 1 240px;
}

.date-cluster {
  align-items: center;
  flex-wrap: wrap;
}

.date-actions {
  flex-wrap: wrap;
}

.date-picker,
.region-picker,
.display-picker,
.search-cluster {
  display: grid;
  gap: 8px;
}

.date-picker span,
.region-picker span,
.display-picker span,
.search-label,
.summary-label {
  color: var(--muted);
  font-size: 0.88rem;
}

.date-picker input,
.region-picker select,
.search-box input {
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  padding: 0 14px;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  padding-right: 96px;
}

.display-picker {
  min-width: 132px;
}

.display-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
}

.switch-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.switch-button + .switch-button {
  border-left: 1px solid var(--line);
}

.switch-button.is-active {
  background: var(--text);
  color: #f8f4ee;
}

.search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: reveal 160ms ease;
}

.search-results[hidden] {
  display: none;
}

.search-item {
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
}

.search-item:last-child {
  border-bottom: 0;
}

.search-item:hover,
.search-item:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.search-item-title {
  display: block;
  font-weight: 600;
}

.search-item-meta,
.empty-note,
.error-note,
.panel-copy,
.detail-note,
.detail-copy,
.meta-term {
  color: var(--muted);
}

.ghost-button,
.solid-button,
.detail-action {
  min-height: 42px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--text);
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.solid-button {
  background: var(--text);
  border-color: var(--text);
  color: #f8f4ee;
}

.ghost-button:hover,
.solid-button:hover,
.detail-action:hover,
.ghost-button:focus-visible,
.solid-button:focus-visible,
.detail-action:focus-visible,
.guide-program:focus-visible {
  outline: none;
  border-color: var(--accent);
}

.summary-block {
  flex: 1 1 150px;
  min-width: 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
}

.summary-block strong {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 0.92fr);
  gap: 24px;
  padding-top: 24px;
}

.guide-panel,
.detail-panel {
  min-width: 0;
}

.panel-header h1,
.detail-content h2,
.detail-placeholder h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.panel-copy,
.detail-placeholder p,
.detail-copy {
  margin: 6px 0 0;
  line-height: 1.55;
}

.status-line {
  min-height: 28px;
  margin: 14px 0;
  color: var(--muted);
}

.guide-wrap {
  min-width: 0;
}

.guide-shell {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.guide-scroller {
  overflow: auto;
  max-height: min(74vh, 1260px);
  overscroll-behavior: contain;
}

.guide-grid {
  --time-column-width: 78px;
  --channel-width: 186px;
  --slot-height: 56px;
  position: relative;
  display: grid;
  grid-template-columns: var(--time-column-width) repeat(var(--column-count), var(--channel-width));
  grid-template-rows: 64px repeat(var(--row-count), var(--slot-height));
  min-width: calc(var(--time-column-width) + (var(--column-count) * var(--channel-width)));
  background:
    linear-gradient(180deg, rgba(250, 248, 245, 0.98), rgba(250, 248, 245, 0.9) 64px, rgba(248, 243, 237, 0.5) 64px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.2));
}

.guide-corner,
.guide-channel-header,
.guide-time-cell {
  backdrop-filter: blur(10px);
}

.guide-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.96);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.86rem;
}

.guide-channel-header {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 14px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.94);
}

.guide-channel-header strong {
  font-size: 0.96rem;
  line-height: 1.35;
}

.guide-channel-header span {
  color: var(--muted);
  font-size: 0.8rem;
}

.guide-channel-number {
  display: inline-flex;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
}

.guide-column-track {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.18)),
    linear-gradient(180deg, rgba(235, 224, 214, 0.22), rgba(235, 224, 214, 0.1));
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

.guide-time-cell {
  position: sticky;
  left: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: end;
  justify-content: start;
  gap: 2px;
  padding: 10px 10px 0 0;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.92);
  color: rgba(109, 98, 87, 0.55);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.guide-time-cell.is-major {
  color: var(--muted);
  font-weight: 600;
}

.guide-time-stamp {
  line-height: 1.1;
}

.guide-day-stamp {
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.1;
}

.guide-time-cell.is-day-boundary {
  border-top-color: var(--line-strong);
  background: rgba(255, 248, 240, 0.98);
}

.guide-day-divider {
  align-self: start;
  height: 0;
  border-top: 2px solid rgba(180, 92, 31, 0.22);
  pointer-events: none;
  z-index: 4;
}

.guide-program {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  margin: 6px;
  padding: 10px 10px 9px;
  border: 1px solid rgba(113, 88, 62, 0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(254, 249, 243, 0.9));
  box-shadow: 0 12px 22px rgba(40, 28, 18, 0.06);
  color: var(--text);
  overflow: hidden;
  text-align: left;
  cursor: pointer;
}

.guide-program.type-terrestrial {
  background: linear-gradient(180deg, rgba(255, 247, 239, 0.97), rgba(255, 241, 228, 0.9));
}

.guide-program.type-bs {
  background: linear-gradient(180deg, rgba(247, 248, 255, 0.96), rgba(234, 239, 255, 0.92));
}

.guide-program.type-cs {
  background: linear-gradient(180deg, rgba(248, 245, 255, 0.96), rgba(238, 232, 252, 0.92));
}

.guide-program.type-streaming {
  background: linear-gradient(180deg, rgba(241, 250, 244, 0.97), rgba(229, 245, 235, 0.92));
}

.guide-program.type-radio {
  background: linear-gradient(180deg, rgba(255, 249, 236, 0.96), rgba(251, 241, 217, 0.92));
}

.guide-program.type-other {
  background: linear-gradient(180deg, rgba(248, 248, 248, 0.96), rgba(239, 236, 231, 0.92));
}

.guide-program.is-selected {
  border-color: rgba(180, 92, 31, 0.5);
  box-shadow: 0 14px 28px rgba(180, 92, 31, 0.12);
}

.guide-program.is-live {
  border-color: rgba(159, 47, 34, 0.42);
}

.guide-program.is-tight {
  gap: 3px;
  padding: 7px 8px 6px;
}

.guide-program.is-tight .guide-program-note,
.guide-program.is-tight .guide-program-meta {
  display: none;
}

.guide-program.is-compact .guide-program-note {
  display: none;
}

.guide-program-time {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.guide-program-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  padding-bottom: 0.08em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.guide-program-meta,
.guide-program-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.guide-program.is-compact .guide-program-time {
  font-size: 0.74rem;
}

.guide-program.is-compact .guide-program-title {
  font-size: 0.86rem;
  line-height: 1.28;
  -webkit-line-clamp: 2;
}

.guide-program.is-tight {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px 5px;
  padding: 0 8px;
}

.guide-program.is-tight .guide-program-time {
  flex: 0 0 auto;
  font-size: 0.7rem;
  line-height: 1.1;
  white-space: nowrap;
}

.guide-program.is-tight .guide-program-title {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8rem;
  line-height: 1.24;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  padding-bottom: 0;
  -webkit-box-orient: initial;
  -webkit-line-clamp: unset;
}

.detail-panel {
  border-left: 1px solid var(--line);
  padding-left: 24px;
}

.detail-placeholder,
.detail-content-inner {
  position: sticky;
  top: 24px;
}

.detail-content-inner {
  display: grid;
  gap: 18px;
}

.detail-heading {
  display: grid;
  gap: 8px;
}

.detail-title {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  line-height: 1.3;
}

.detail-subtitle {
  margin: 0;
  color: var(--muted);
}

.detail-toolbar {
  flex-wrap: wrap;
}

.detail-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  text-decoration: none;
}

.detail-grid {
  display: grid;
  gap: 14px;
}

.meta-grid {
  flex-wrap: wrap;
}

.meta-card {
  flex: 1 1 150px;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.meta-value {
  display: block;
  margin-top: 6px;
  font-weight: 600;
}

.detail-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 0.96rem;
}

.detail-copy,
.detail-note {
  line-height: 1.7;
  white-space: pre-wrap;
}

.detail-links,
.detail-upcoming {
  display: grid;
  gap: 10px;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.55);
}

.upcoming-item {
  display: grid;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.upcoming-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.upcoming-time {
  font-weight: 600;
}

.mobile-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(29, 21, 16, 0.28);
  z-index: 30;
  animation: fade-in 180ms ease;
}

.mobile-sheet-backdrop[hidden] {
  display: none;
}

.empty-note,
.error-note {
  margin: 0;
  line-height: 1.6;
}

.app-shell {
  width: 100%;
  margin: 0;
  padding: 12px 16px 18px;
  min-height: 100svh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 25;
  padding-bottom: 12px;
  background: linear-gradient(180deg, rgba(250, 248, 245, 0.96), rgba(250, 248, 245, 0.9));
  backdrop-filter: blur(10px);
}

.control-row,
.summary-row {
  margin-top: 12px;
}

.summary-block {
  flex: 1 1 128px;
  padding-top: 10px;
}

.workspace {
  display: block;
  padding-top: 12px;
}

.guide-panel {
  min-width: 0;
}

.guide-shell {
  border-radius: 14px;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: min(420px, 34vw);
  min-width: 320px;
  z-index: 40;
  padding: 20px 20px 24px;
  border-left: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: 0;
  background: var(--surface-strong);
  box-shadow: -20px 0 48px rgba(40, 28, 18, 0.14);
  transform: translateX(102%);
  transition: transform 180ms ease;
  overflow-y: auto;
}

.detail-panel.is-open {
  transform: translateX(0);
}

.detail-placeholder,
.detail-content-inner {
  position: static;
}

.mobile-sheet-backdrop {
  z-index: 35;
}

@media (min-width: 821px) {
  .guide-scroller {
    max-height: calc(100svh - 206px);
  }

  .guide-grid {
    --channel-width: 194px;
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

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

  .detail-panel {
    border-left: 0;
    padding-left: 0;
  }

  .detail-placeholder {
    display: none;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 18px 16px 28px;
  }

  .control-row {
    flex-direction: column;
    align-items: stretch;
  }

  .region-picker {
    flex: 1 1 auto;
  }

  .search-cluster {
    position: relative;
  }

  .mobile-search-toggle,
  .search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .search-cluster {
    display: none;
  }

  .search-cluster.is-open {
    display: grid;
  }

  .guide-grid {
    --time-column-width: 68px;
    --channel-width: 154px;
    --slot-height: 52px;
  }

  .guide-program {
    margin: 5px;
    padding: 9px 8px 8px;
  }

  .guide-program-title {
    font-size: 0.88rem;
  }

  .guide-program-meta,
  .guide-program-note {
    font-size: 0.74rem;
  }

  .detail-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    width: auto;
    min-width: 0;
    bottom: 0;
    z-index: 40;
    background: var(--surface-strong);
    border-top: 1px solid var(--line-strong);
    box-shadow: 0 -18px 50px rgba(40, 28, 18, 0.12);
    padding: 18px 16px max(18px, env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    transform: translateY(102%);
    transition: transform 180ms ease;
    max-height: min(78vh, 760px);
    overflow-y: auto;
  }

  .detail-panel.is-open {
    transform: translateY(0);
  }

  .detail-content-inner,
  .detail-placeholder {
    position: static;
  }
}

/* Dense timetable refresh inspired by cal.syoboi.jp and AniTime */
:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --line: rgba(148, 163, 184, 0.32);
  --line-strong: rgba(100, 116, 139, 0.48);
  --text: #1f2937;
  --muted: #607087;
  --accent: #2f5db0;
  --accent-soft: rgba(47, 93, 176, 0.08);
  --live: #b42318;
  --shadow: none;
  --radius: 4px;
}

body {
  background: #eef2f7;
}

.app-shell {
  padding: 0 8px 12px;
}

.app-header {
  padding: 8px 8px 6px;
  background: #f7f9fd;
  border-bottom: 1px solid #c7d0db;
  backdrop-filter: none;
}

.brand {
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

.control-row {
  margin-top: 8px;
  gap: 8px;
}

.date-actions {
  gap: 6px;
}

.ghost-button,
.solid-button,
.detail-action {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 4px;
  background: #ffffff;
}

.solid-button {
  background: #24364d;
  border-color: #24364d;
  color: #ffffff;
}

.date-picker input,
.region-picker select,
.search-box input {
  min-height: 34px;
  border-radius: 4px;
  background: #ffffff;
  padding: 0 10px;
}

.date-picker span,
.region-picker span,
.display-picker span,
.search-label,
.summary-label {
  font-size: 0.74rem;
}

.region-picker {
  flex: 0 1 320px;
}

.display-switch {
  min-height: 34px;
  border-radius: 4px;
  background: #ffffff;
}

.switch-button {
  color: #607087;
}

.switch-button.is-active {
  background: #24364d;
  color: #ffffff;
}

.summary-row {
  display: none;
}

.workspace {
  padding-top: 8px;
}

.panel-header {
  padding: 0 4px;
}

.panel-header h1 {
  font-size: 0.94rem;
}

.panel-copy {
  display: none;
}

.status-line {
  min-height: auto;
  margin: 4px 4px 6px;
  font-size: 0.74rem;
}

.guide-shell {
  border: 1px solid #b8c2cf;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.guide-scroller {
  max-height: calc(100svh - 124px);
}

.guide-grid {
  --time-column-width: 52px;
  --channel-width: 150px;
  --slot-height: 64px;
  background: #ffffff;
}

.guide-corner,
.guide-channel-header,
.guide-time-cell {
  backdrop-filter: none;
}

.guide-corner {
  background: #f3f5fa;
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 0.68rem;
}

.guide-channel-header {
  gap: 1px;
  padding: 3px 6px 4px;
  border-left: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #fbe0ea, #f7d1dd);
}

.guide-channel-header strong {
  font-size: 0.78rem;
  line-height: 1.16;
}

.guide-channel-header span {
  font-size: 0.66rem;
  color: #667085;
}

.guide-channel-number {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #7b8798;
  font-size: 0.66rem;
  font-weight: 600;
}

.guide-column-track {
  background: #ffffff;
  border-left: 1px solid #e2e8f0;
  border-top: 1px solid #edf2f7;
}

.guide-time-cell {
  align-items: center;
  justify-content: flex-start;
  gap: 1px;
  padding: 5px 0 0;
  background: #f8fafc;
  border-top: 1px solid #edf2f7;
  border-right: 1px solid #cbd5e1;
  color: #7b8798;
  font-size: 0.66rem;
}

.guide-time-cell.is-major {
  color: #475569;
}

.guide-time-cell.is-day-boundary {
  background: #eef4ff;
  border-top: 2px solid #94a3b8;
  color: #31435f;
}

.guide-time-stamp {
  line-height: 1.02;
}

.guide-day-stamp {
  color: #3c5c90;
  font-size: 0.54rem;
  font-weight: 700;
  line-height: 1;
}

.guide-day-divider {
  border-top: 2px solid #9db1cf;
}

.guide-program {
  margin: 1px;
  padding: 2px 4px 3px;
  gap: 1px;
  border: 1px solid #c4b471;
  border-radius: 2px;
  background: linear-gradient(180deg, #fff9cf, #fff2ad);
  box-shadow: none;
}

.guide-program.type-bs,
.guide-program.type-cs,
.guide-program.type-streaming,
.guide-program.type-radio,
.guide-program.type-other {
  background: linear-gradient(180deg, #fff8d8, #fff3b9);
}

.guide-program.is-selected {
  border-color: #d94841;
  background: linear-gradient(180deg, #fff3bd, #ffe58b);
  box-shadow: none;
}

.guide-program.is-live {
  border-color: #b42318;
}

.guide-program-time {
  font-size: 0.63rem;
  line-height: 1.02;
  color: #4b5563;
}

.guide-program-title {
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: 0;
  padding-bottom: 0;
  -webkit-line-clamp: 4;
}

.guide-program-meta,
.guide-program-note {
  font-size: 0.64rem;
  line-height: 1.08;
  color: #556378;
}

.guide-program.is-tight,
.guide-program.is-compact {
  display: grid;
  align-content: start;
  margin: 1px;
  padding: 2px 4px 3px;
  gap: 1px;
}

.guide-program.is-tight .guide-program-time,
.guide-program.is-compact .guide-program-time {
  font-size: 0.62rem;
  line-height: 1;
}

.guide-program.is-tight .guide-program-title {
  display: -webkit-box;
  font-size: 0.71rem;
  line-height: 1.08;
  white-space: normal;
  text-overflow: clip;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.guide-program.is-compact .guide-program-title {
  font-size: 0.72rem;
  line-height: 1.1;
  -webkit-line-clamp: 5;
}

.guide-program.is-tight .guide-program-note,
.guide-program.is-tight .guide-program-meta,
.guide-program.is-compact .guide-program-note {
  display: none;
}

.detail-panel {
  width: min(360px, 30vw);
  min-width: 300px;
  padding: 16px 16px 20px;
  background: #ffffff;
  border-left: 1px solid #cbd5e1;
  box-shadow: -8px 0 20px rgba(15, 23, 42, 0.08);
}

.detail-title {
  font-size: 1.24rem;
}

.detail-link {
  border-radius: 4px;
  background: #ffffff;
}

.search-results {
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

@media (min-width: 821px) {
  .guide-grid {
    --channel-width: 156px;
  }

  .guide-scroller {
    max-height: calc(100svh - 118px);
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 0 0 18px;
  }

  .app-header {
    padding: 10px 12px 8px;
  }

  .brand-row {
    gap: 10px;
  }

  .brand {
    font-size: 1rem;
  }

  .control-row {
    margin-top: 10px;
    gap: 10px;
  }

  .date-cluster,
  .region-picker,
  .search-cluster {
    flex: 0 1 auto;
  }

  .display-picker {
    min-width: 0;
  }

  .guide-grid {
    --time-column-width: 48px;
    --channel-width: 138px;
    --slot-height: 58px;
  }

  .guide-channel-header {
    padding: 4px 5px;
  }

  .guide-program,
  .guide-program.is-tight,
  .guide-program.is-compact {
    margin: 1px;
    padding: 2px 4px 3px;
  }

  .guide-program-title,
  .guide-program.is-tight .guide-program-title,
  .guide-program.is-compact .guide-program-title {
    font-size: 0.7rem;
    line-height: 1.08;
  }

  .guide-program-time,
  .guide-program.is-tight .guide-program-time,
  .guide-program.is-compact .guide-program-time {
    font-size: 0.6rem;
  }

  .guide-day-stamp {
    font-size: 0.5rem;
  }

  .detail-panel {
    width: auto;
    min-width: 0;
    border-left: 0;
    border-top: 1px solid #cbd5e1;
    box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.12);
  }
}
