:root {
  --bg-primary: #0a0a0c;
  --bg-card: #141418;
  --bg-card-hover: #1a1a20;
  --bg-card-active: #1c1e2a;
  --border: #222230;
  --border-active: #3b82f6;
  --text-primary: #e8e8ed;
  --text-secondary: #8888a0;
  --text-muted: #555568;
  --accent: #1d9bf0;
  --accent-glow: rgba(29, 155, 240, 0.15);
  --live-color: #22c55e;
  --live-glow: rgba(34, 197, 94, 0.25);
  --upcoming-color: #f59e0b;
  --sub-color: #f472b6;
  --sub-glow: rgba(244, 114, 182, 0.15);
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-display);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

.page-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  z-index: 9999;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* Header */
header {
  margin-bottom: 2rem;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.tagline {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.1rem;
}

h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-family: var(--font-mono);
  font-weight: 400;
}

#local-clock {
  color: var(--accent);
}

.live-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.live-status.hidden {
  display: none;
}

.day-status .live-meta {
  display: block;
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  font-weight: 500;
}

/* Toggle */
.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.65rem;
  cursor: pointer;
  user-select: none;
}

.toggle-label {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  transition: color 0.15s;
}

.toggle-row:hover .toggle-label {
  color: var(--text-secondary);
}

.toggle-row input {
  display: none;
}

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  transition: background 0.2s;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.2s;
}

.toggle-row input:checked + .toggle-switch {
  background: var(--accent);
}

.toggle-row input:checked + .toggle-switch::after {
  left: 19px;
  background: #fff;
}

/* Dashboard link (hidden by default) */
.dashboard-link {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  transition: all 0.15s;
  text-decoration: none;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.dashboard-link:hover {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.12);
}

body.show-dashboard .dashboard-link {
  display: flex;
}

.dashboard-divider {
  display: none;
  width: 1px;
  height: 14px;
  background: var(--border);
  margin: 0 0.5rem;
  flex-shrink: 0;
}

.dashboard-chip-icon {
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.06);
  transition: all 0.15s;
  flex-shrink: 0;
  font-size: 0.6rem;
  cursor: pointer;
}

.dashboard-chip-icon:hover {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.18);
}

body.show-dashboard .dashboard-divider {
  display: inline-block;
}

body.show-dashboard .dashboard-chip-icon {
  display: inline-flex;
}

/* Live Now Banner */
.now-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(34, 197, 94, 0.03));
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  animation: bannerSlide 0.4s ease-out;
}

.now-banner.hidden {
  display: none;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--live-color);
  flex-shrink: 0;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--live-glow); }
  50% { box-shadow: 0 0 0 8px transparent; }
}

@keyframes bannerSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

#now-text a {
  color: var(--live-color);
  text-decoration: none;
  font-weight: 600;
}

#now-text a:hover {
  text-decoration: underline;
}

/* Schedule Grid */
.schedule-grid {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 2.5rem;
}

.day-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
}

.day-card:hover {
  background: var(--bg-card-hover);
  border-color: #333340;
}

.day-card.is-today {
  border-color: var(--border-active);
  background: var(--bg-card-active);
  box-shadow: 0 0 20px var(--accent-glow), inset 0 1px 0 rgba(29, 155, 240, 0.08);
}

.day-card.is-live {
  border-color: var(--live-color);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.06), var(--bg-card));
  box-shadow: 0 0 24px var(--live-glow);
}

.day-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.day-card.is-today .day-label,
.day-card.is-live .day-label {
  color: var(--text-secondary);
}

.day-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.host-line {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.host-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.05rem;
  transition: color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.host-link:hover {
  color: var(--accent);
}

.day-card.is-live .host-link {
  color: var(--live-color);
}

.host-handle {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.space-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.time-local {
  color: var(--accent);
  font-weight: 600;
}

.time-local.tentative {
  color: var(--text-secondary);
  font-weight: 400;
}

.time-sep {
  color: var(--text-muted);
}

.time-ct {
  color: var(--text-muted);
}

/* Info tooltip */
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  color: var(--text-muted);
  font-size: 0.65rem;
  margin-left: 0.1rem;
  transition: color 0.15s;
}

.info-tip:hover,
.info-tip:focus {
  color: var(--text-secondary);
  outline: none;
}

.info-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.info-tip:hover::after,
.info-tip:focus::after {
  opacity: 1;
}

.day-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.status-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
}

.status-badge.live {
  background: rgba(34, 197, 94, 0.15);
  color: var(--live-color);
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.status-badge.upcoming {
  background: rgba(245, 158, 11, 0.12);
  color: var(--upcoming-color);
}

.status-badge.today {
  background: var(--accent-glow);
  color: var(--accent);
}

.status-badge.maybe {
  background: rgba(245, 158, 11, 0.12);
  color: var(--upcoming-color);
  font-style: italic;
}

.sub-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
  background: var(--sub-glow);
  color: var(--sub-color);
}

.sub-badge i {
  font-size: 0.6rem;
  margin-right: 0.2rem;
}

.cal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  transition: all 0.15s;
  flex-shrink: 0;
  font-size: 0.75rem;
  cursor: pointer;
}

.cal-btn:hover {
  color: var(--accent);
  background: var(--accent-glow);
}

.profile-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  transition: all 0.15s;
  text-decoration: none;
  flex-shrink: 0;
}

.profile-link:hover {
  color: var(--accent);
  background: var(--accent-glow);
}

/* Additional Hosts */
.additional-hosts {
  margin-bottom: 2rem;
}

.additional-hosts h2 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.host-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.4rem 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s;
}

.chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.chip i {
  font-size: 0.7rem;
}

.chip.live {
  border-color: var(--live-color);
  color: var(--live-color);
}

.chip-live-pill {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(34, 197, 94, 0.15);
  color: var(--live-color);
  white-space: nowrap;
  animation: pulse-badge 2s ease-in-out infinite;
}

.live-pulse {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent, #60a5fa);
  margin-right: 0.45rem;
  vertical-align: middle;
  animation: live-pulse-blink 1.2s ease-in-out infinite;
}

@keyframes live-pulse-blink {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50%      { opacity: 1;    transform: scale(1.15); }
}

/* Footer */
footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: var(--font-mono);
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

footer p {
  margin-bottom: 0.5rem;
}

footer .credits {
  font-size: 0.75rem;
  margin-top: 0.75rem;
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Multi-host day cards */
.day-card--multi {
  grid-template-columns: 5.5rem 1fr;
  align-items: start;
}

.day-card--multi .day-label {
  padding-top: 0.5rem;
}

.day-hosts {
  display: flex;
  flex-direction: column;
}

.host-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 0;
}

.host-row + .host-row {
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
  padding-top: 0.6rem;
}

.host-row .day-info {
  flex: 1;
  min-width: 0;
}

/* Host note */
.host-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.15rem;
  line-height: 1.4;
}

.host-note a {
  color: var(--text-muted);
  text-decoration: none;
}

.host-note a:hover {
  color: var(--accent);
}

/* Suggest button in footer */
.suggest-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.45rem 1rem;
  background: rgba(29, 155, 240, 0.08);
  border: 1px solid rgba(29, 155, 240, 0.25);
  border-radius: 20px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.suggest-btn:hover {
  background: rgba(29, 155, 240, 0.15);
  border-color: var(--accent);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  animation: overlayIn 0.2s ease-out;
}

@media (min-width: 521px) {
  .modal-overlay {
    align-items: center;
  }
}

.modal-overlay[hidden] {
  display: none;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalUp 0.25s ease-out;
}

@keyframes modalUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0;
}

.modal-header h2 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}

.modal-header h2 i {
  color: var(--accent);
  font-size: 0.85rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.modal-close:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.25rem;
}

/* Form elements */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.form-optional {
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.form-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: 0.55rem 0.75rem;
  transition: border-color 0.15s;
  appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--text-muted);
}

textarea.form-input {
  resize: vertical;
  min-height: 60px;
  font-family: var(--font-display);
  font-size: 0.85rem;
}

select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555568' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  cursor: pointer;
}

.input-prefix-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.input-prefix-wrap:focus-within {
  border-color: var(--accent);
}

.input-prefix {
  padding: 0.55rem 0 0.55rem 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.input-prefix-wrap .form-input {
  border: none;
  border-radius: 0;
  padding-left: 0.2rem;
}

.input-prefix-wrap .form-input:focus {
  outline: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.radio-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.radio-option input[type="radio"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.checkbox-option input[type="checkbox"] {
  accent-color: var(--sub-color);
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}

.suggest-hint {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.btn-post {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-post:hover {
  background: #1a8cd8;
}

.btn-post:active {
  opacity: 0.85;
}

/* Mobile adjustments */
@media (max-width: 520px) {
  .container {
    padding: 1.5rem 1rem 3rem;
  }

  h1 {
    font-size: 1.4rem;
  }

  /* Single-host cards: 2 columns, status drops to its own row */
  .day-card {
    grid-template-columns: 4rem 1fr;
    grid-template-rows: auto auto;
    padding: 0.85rem 1rem;
    gap: 0.35rem 0.75rem;
  }

  .day-card > .day-label {
    grid-column: 1;
    grid-row: 1 / -1;
    align-self: start;
    padding-top: 0.15rem;
  }

  .day-card > .day-info {
    grid-column: 2;
    grid-row: 1;
  }

  .day-card > .day-status {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  /* Multi-host cards */
  .day-card--multi {
    grid-template-columns: 4rem 1fr;
    grid-template-rows: auto;
  }

  .day-card--multi > .day-label {
    grid-row: 1;
  }

  /* Host rows wrap status to its own line */
  .host-row {
    flex-wrap: wrap;
  }

  .host-row .day-status {
    justify-content: flex-start;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.15rem;
  }

  /* Let host name + handle wrap naturally */
  .host-line {
    flex-wrap: wrap;
    gap: 0.15rem 0.4rem;
  }

  .day-label {
    font-size: 0.68rem;
  }

  .host-link {
    font-size: 0.95rem;
  }

  .host-handle {
    font-size: 0.65rem;
  }

  .space-title {
    font-size: 0.7rem;
  }

  .time-row {
    font-size: 0.72rem;
  }

  .status-badge,
  .sub-badge {
    font-size: 0.62rem;
    padding: 0.2rem 0.45rem;
  }

  .cal-btn,
  .dashboard-link,
  .profile-link {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }
}
