@import url('https://fonts.googleapis.com/css2?family=Righteous&display=swap');

/* TV Home - pairing and session selection */
:root {
  --tv-bg: radial-gradient(circle at 15% 10%, rgba(14, 165, 233, 0.35) 0%, transparent 35%),
    radial-gradient(circle at 80% 20%, rgba(244, 114, 182, 0.25) 0%, transparent 40%),
    linear-gradient(135deg, #0b1223 0%, #151f35 50%, #1e2a42 100%);
  --tv-panel: rgba(12, 18, 34, 0.75);
  --tv-panel-strong: rgba(15, 23, 42, 0.9);
  --tv-border: rgba(59, 130, 246, 0.25);
  --tv-accent: #38bdf8;
  --tv-text: rgba(248, 250, 252, 0.95);
  --tv-muted: rgba(148, 163, 184, 0.85);
}

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

.d-none {
  display: none !important;
}

.tv-home-body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--tv-bg);
  color: var(--tv-text);
  min-height: 100vh;
}

.tv-home-shell {
  min-height: 100vh;
  padding: 24px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tv-home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.tv-home-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.onparty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, rgba(248, 113, 113, 0.9), rgba(190, 24, 93, 0.8));
  color: #fff;
  border: 1px solid rgba(248, 113, 113, 0.75);
  box-shadow: 0 0 16px rgba(248, 113, 113, 0.65);
}

.onparty-badge-logo {
  gap: 0.15rem;
  padding: 0.25rem 0.8rem;
}

.onparty-letter {
  font-size: 1.5rem;
  line-height: 1;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.9);
  mix-blend-mode: screen;
}

.onparty-letter-pair {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.onparty-letter svg {
  width: 1em;
  height: 1em;
  display: block;
}

.onparty-letter-n {
  font-size: 1.7em;
  line-height: 1;
}

.tv-home-brand .onparty-letter-n {
  position: relative;
  top: -0.05em;
}

.onparty-letter + .onparty-letter {
  margin-left: 0.05rem;
}

.tv-home-title {
  font-family: 'Righteous', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 600;
}

.tv-home-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--tv-panel);
  border-radius: 12px;
  border: 1px solid var(--tv-border);
  box-shadow: 0 12px 24px rgba(3, 7, 18, 0.6);
}

.tv-user-emoji {
  font-size: 1.5rem;
}

.tv-user-name {
  font-size: 1rem;
  color: var(--tv-muted);
}

.tv-home-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tv-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: var(--tv-text);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.tv-action-btn i {
  font-size: 1rem;
}

.tv-action-btn:hover {
  background: rgba(56, 189, 248, 0.3);
  border-color: rgba(125, 211, 252, 0.7);
}

.tv-action-secondary {
  background: rgba(15, 23, 42, 0.6);
}

.tv-home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
}

.tv-panel {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) minmax(240px, 1fr);
  gap: 24px;
  flex: 1;
  min-height: 0;
}

#tvSessionsPanel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.tv-panel-card {
  background: var(--tv-panel-strong);
  border-radius: 18px;
  border: 1px solid var(--tv-border);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(3, 7, 18, 0.7);
}

.tv-panel-card h2,
.tv-panel-card h3 {
  margin-bottom: 12px;
}

.tv-muted {
  color: var(--tv-muted);
}

.tv-code-block {
  margin-top: 24px;
  padding: 20px;
  border-radius: 16px;
  background: rgba(5, 10, 24, 0.65);
  border: 1px solid rgba(56, 189, 248, 0.25);
  text-align: center;
}

.tv-code-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
  color: var(--tv-muted);
}

.tv-code {
  font-size: 2.8rem;
  letter-spacing: 0.3em;
  font-weight: 700;
  margin: 18px 0 12px;
  color: var(--tv-accent);
  font-family: 'Courier New', Courier, monospace;
}

.tv-code-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.tv-primary-btn {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.3), rgba(59, 130, 246, 0.4));
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: var(--tv-text);
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.tv-primary-btn:hover {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.45), rgba(59, 130, 246, 0.55));
}

.tv-pairing-status {
  margin-top: 12px;
  font-size: 0.95rem;
  color: var(--tv-muted);
}

.tv-instructions ol {
  margin-left: 18px;
  color: var(--tv-muted);
  display: grid;
  gap: 6px;
}

.tv-sessions-section {
  background: var(--tv-panel-strong);
  border-radius: 18px;
  border: 1px solid var(--tv-border);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(3, 7, 18, 0.7);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tv-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.tv-count {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.tv-session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
}

.tv-session-card {
  background: rgba(8, 13, 28, 0.7);
  border-radius: 16px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 14px 26px rgba(3, 7, 18, 0.6);
  text-decoration: none;
  color: var(--tv-text);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
}

.tv-session-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 18px 32px rgba(3, 7, 18, 0.75);
}

.tv-session-card:focus {
  outline: 2px solid rgba(56, 189, 248, 0.6);
  outline-offset: 2px;
}

.tv-session-header {
  background: rgba(56, 189, 248, 0.16);
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.tv-session-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.tv-session-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--tv-muted);
}

.tv-session-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--tv-muted);
  font-size: 0.95rem;
  justify-content: center;
}

.tv-session-line i {
  color: rgba(226, 232, 240, 0.8);
}

.tv-session-sep {
  opacity: 0.6;
}

.tv-session-status-line {
  gap: 10px;
  flex-wrap: wrap;
}

.tv-session-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 0.85rem;
}

.tv-session-status.waiting {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.5);
}

.tv-session-status.playing {
  color: #22d3ee;
  border-color: rgba(34, 211, 238, 0.5);
}

.tv-session-status.paused {
  color: #fb7185;
  border-color: rgba(251, 113, 133, 0.5);
}

.tv-session-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: var(--tv-text);
}

.tv-session-open {
  text-decoration: none;
  text-align: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: var(--tv-text);
  font-weight: 600;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.tv-session-open:hover {
  background: rgba(56, 189, 248, 0.4);
  border-color: rgba(125, 211, 252, 0.8);
}

.tv-empty-state {
  margin-top: 16px;
  text-align: center;
  color: var(--tv-muted);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}

.tv-empty-state.d-none {
  display: none !important;
}

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

  .tv-home-shell {
    padding: 20px;
  }
}

@media (max-width: 720px) {
  .tv-home-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tv-home-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .tv-code {
    font-size: 2.2rem;
    letter-spacing: 0.2em;
  }
}
