:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-alt: #f0f3f8;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --border: #d1d5db;
  --shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, rgba(96, 165, 250, 0.14), transparent 28%),
    radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.08), transparent 20%),
    var(--bg);
  color: var(--text);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

button, select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 0 0 auto;
}

.logo-placeholder {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.18);
}

.title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.campus-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  flex: 0 0 auto;
  white-space: normal;
}

.campus-info {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1;
}

.campus-select-shell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-left: 0.8rem;
  padding-right: 1.9rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.campus-select-prefix {
  color: rgba(15, 23, 42, 0.5);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.campus-select-shell::after {
  content: '';
  position: absolute;
  right: 0.9rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid rgba(100, 116, 139, 0.9);
  border-bottom: 2px solid rgba(100, 116, 139, 0.9);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

#campus-select {
  min-width: 0;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 0.52rem 0;
  background: transparent;
  color: var(--text);
  appearance: none;
  line-height: 1.2;
  font-weight: 600;
  outline: none;
}

#campus-select:focus {
  box-shadow: none;
}

.campus-select-shell:focus-within {
  border-color: rgba(37, 99, 235, 0.38);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.5rem;
  margin-left: auto;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.topnav a,
.topnav a:link,
.topnav a:visited {
  color: rgba(15, 23, 42, 0.78);
  text-decoration: none;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  transition: color 0.2s ease;
}

.topnav a:hover,
.topnav a:focus-visible {
  color: var(--primary);
}

.page-main {
  max-width: 1800px;
  margin: 0 auto;
  padding: 2rem 1.5rem 2.5rem;
  display: grid;
  gap: 1.75rem;
}

.live-view {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(340px, 1fr);
  gap: 1.75rem;
  align-items: start;
}

.video-panel,
.tab-panel {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.video-panel {
  align-self: start;
}

.video-frame {
  position: relative;
  padding-top: 56.25%;
  overflow: hidden;
  border-radius: 20px;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.tab-panel {
  display: flex;
  flex-direction: column;
  min-height: clamp(42rem, calc(100vh - 10rem), 70rem);
  padding: 0;
  gap: 0;
}

.tabs {
  --active-index: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: #ffffff;
  position: relative;
}

.tabs::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 33.333%;
  height: 2px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: 1px;
  transform: translateX(calc(var(--active-index) * 100%));
  transition: transform 0.3s ease;
}

.tab {
  flex: 1;
  border: none;
  border-radius: 0;
  padding: 0.95rem 1rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s ease;
  text-align: center;
  font-weight: 600;
  position: relative;
}

.tab.active {
  color: var(--primary);
}

.tab-content {
  padding: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tab-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tab-pane.hidden {
  display: none;
}

#panel-chat,
#panel-bible,
#panel-schedule {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: #ffffff;
  border-radius: 20px;
}

#chat-frame,
#bible-frame {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  border-radius: 0;
}

#panel-schedule {
  padding: 1rem;
}

#panel-schedule .schedule-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

#panel-schedule .schedule-list {
  flex: 1;
  display: grid;
  gap: 1rem;
  align-content: start;
  overflow: auto;
  padding: 0;
}

#panel-schedule .section-header {
  margin: 0 0 1rem;
}

.schedule-tab-countdown {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.96));
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.08);
}

.schedule-tab-countdown-header {
  display: grid;
  gap: 0.35rem;
}

.schedule-tab-countdown-label {
  margin: 0;
  color: rgba(15, 23, 42, 0.68);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.schedule-tab-countdown-message {
  margin: 0;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.4;
}

.schedule-tab-countdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.schedule-live-status {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(239, 68, 68, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.schedule-live-dot {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 rgba(239, 68, 68, 0.5);
  animation: live-pulse 1.6s ease-out infinite;
}

.schedule-live-text {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.schedule-time-box {
  display: grid;
  gap: 0.35rem;
  place-items: center;
  padding: 0.9rem 0.75rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.schedule-time-value {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  color: var(--text);
  line-height: 1;
}

.schedule-tab-countdown.is-live .schedule-tab-countdown-grid {
  display: none;
}

.schedule-tab-countdown.is-live .schedule-live-status {
  display: flex;
}

.schedule-time-unit {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@keyframes live-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.schedule-item {
  display: grid;
  gap: 0.5rem;
  align-self: start;
  padding: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), #ffffff);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.schedule-item h3 {
  font-size: 1.05rem;
}

.schedule-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.schedule-time {
  font-weight: 700;
  color: var(--text);
}

.no-schedule {
  margin: 0;
  color: var(--muted);
}

.tab-placeholder {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-content: start;
  min-height: 0;
}

.tab-icon {
  font-size: 2rem;
}

.tab-detail {
  background: var(--surface-alt);
  padding: 0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.countdown-section,
.schedule-section {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.06);
  padding: 1.75rem;
}

.countdown-card {
  display: grid;
  gap: 1rem;
  text-align: center;
  padding: 1.5rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.95));
  border: 1px solid rgba(37, 99, 235, 0.14);
}

.countdown-label {
  color: rgba(15, 23, 42, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.85rem;
}

.countdown-message {
  color: var(--muted);
  font-size: 1rem;
}

.countdown-label {
  color: var(--muted);
  font-size: 0.95rem;
}

.countdown-timer {
  font-size: clamp(2.5rem, 4vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.05em;
}

.countdown-message {
  color: var(--muted);
  font-size: 1rem;
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.section-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

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

.schedule-list {
  display: grid;
  gap: 1rem;
}

.schedule-item {
  display: grid;
  gap: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-alt);
}

.schedule-item h3 {
  margin: 0;
  font-size: 1rem;
}

.schedule-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.schedule-time {
  font-weight: 600;
  color: var(--text);
}

.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .live-view {
    grid-template-columns: 1fr;
  }

  .tab-panel {
    min-height: 360px;
  }
}

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

  .topbar-left {
    flex-direction: column;
    align-items: stretch;
    gap: 0.9rem;
  }

  .brand {
    justify-content: center;
  }

  .campus-panel {
    justify-content: flex-start;
    flex-wrap: wrap;
    white-space: normal;
  }

  .topnav {
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin-left: 0;
    white-space: normal;
  }

  #campus-select {
    width: 100%;
  }

  .countdown-timer {
    font-size: 2.5rem;
  }
}
