/* Login */
.screen-login {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: var(--space-lg);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 100%;
  max-width: 320px;
}

.login-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 280px;
}

.match-logo {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.match-logo::before {
  content: "";
  display: block;
  width: 48px;
  height: 4px;
  margin: 0 auto var(--space-md);
  background: var(--srf-red);
  border-radius: 2px;
}

.match-logo span {
  display: block;
  font-size: 0.875rem;
  color: var(--srf-red);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 6px;
}

.match-teams {
  font-size: 1.75rem;
  font-weight: 700;
}

.match-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.match-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--srf-red);
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Onboarding */
.screen-onboarding {
  gap: var(--space-md);
}

.onboarding-section-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}

.team-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--space-sm);
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.team-card:hover,
.team-card.selected {
  border-color: var(--srf-red);
  background: var(--bg-elevated);
}

.team-card.selected .team-card-name {
  color: var(--srf-red);
}

.team-card-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.team-card-name {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

/* Home */
.screen-home,
.screen-live {
  gap: var(--space-md);
  min-height: 0;
  overflow-y: auto;
}

.screen-home .screen-header--compact,
.screen-home .home-banner,
.screen-home .home-tabs {
  flex-shrink: 0;
}

.home-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
}

.home-tab {
  flex: 1;
  padding: 10px 12px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.home-tab.active {
  color: var(--srf-red);
  border-bottom-color: var(--srf-red);
}

.home-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  flex: 0 0 auto;
}

.home-panel[hidden] {
  display: none !important;
}

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

.standings-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.standings-table th,
.standings-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.standings-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.standings-table td:last-child,
.standings-table th:last-child {
  text-align: right;
}

.standings-row--mine {
  background: var(--srf-red-soft);
}

.standings-row--mine td {
  color: var(--text);
  font-weight: 600;
}

.standings-team {
  display: flex;
  align-items: center;
  gap: 8px;
}

.standings-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.live-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.live-card {
  text-align: center;
}

.live-card--pulse {
  border-color: var(--srf-red);
}

.live-card-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.live-card-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 var(--space-xs);
}

.live-card-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0 0 var(--space-md);
}

.live-card-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 var(--space-md);
  line-height: 1.4;
}

.live-card--empty p {
  margin: 0 0 var(--space-sm);
  color: var(--text-muted);
}

.screen-header--compact h1 {
  font-size: 1.25rem;
}

.home-banner {
  flex-shrink: 0;
}

.schedule-hero {
  padding: var(--space-lg);
  border-left: 4px solid var(--team-accent, var(--srf-red));
  background: var(--bg-card);
}

.schedule-hero-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 var(--space-sm);
}

.schedule-hero-teams {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 var(--space-xs);
}

.schedule-hero-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0 0 var(--space-md);
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.schedule-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: default;
  color: inherit;
  font: inherit;
  box-shadow: var(--shadow-sm);
}

.schedule-row:disabled {
  opacity: 0.85;
}

.schedule-row--mine:not(:disabled) {
  border-color: var(--srf-red);
}

.schedule-row--live:not(:disabled) {
  cursor: pointer;
  border-color: var(--srf-red);
}

.schedule-row--live:not(:disabled):hover {
  background: var(--bg-elevated);
}

.schedule-row-teams {
  font-weight: 600;
  font-size: 0.9rem;
}

.schedule-row-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.schedule-row--live .schedule-row-meta {
  color: var(--srf-red);
  font-weight: 600;
}

.schedule-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: auto;
}

.screen-header {
  margin-bottom: var(--space-sm);
}

.screen-header p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* Match code */
.screen-match-code {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: var(--space-lg);
}

.screen-match-code .screen-header {
  text-align: center;
  width: 100%;
  max-width: 320px;
}

.screen-match-code .code-match-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  width: 100%;
  max-width: 320px;
}

.screen-match-code .login-form,
.screen-match-code .login-hint,
.screen-match-code #btn-code-back {
  width: 100%;
  max-width: 320px;
}

.screen-match-code .code-error {
  text-align: center;
}

.code-inputs {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

.code-char-input {
  width: 3.25rem;
  height: 3.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.code-char-input:focus {
  outline: none;
  border-color: var(--srf-red);
  box-shadow: 0 0 0 2px var(--srf-red-soft);
}

.code-inputs.input-error .code-char-input {
  border-color: var(--srf-red);
}

.code-error {
  color: var(--srf-red);
  font-size: 0.875rem;
  margin: 0;
}

/* Match lobby */
.screen-match-lobby {
  padding-top: 0;
  gap: 0;
  overflow: hidden;
}

.lobby-header {
  padding: var(--space-md) 0 var(--space-sm);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.lobby-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
}

.lobby-live {
  font-size: 0.75rem;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
}

.lobby-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
}

.lobby-score {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.lobby-fans {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: var(--space-sm) 0 0;
}

.btn-compact {
  width: auto;
  padding: 10px 14px;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.btn-lobby-quiz {
  align-self: center;
  white-space: nowrap;
}

.btn-lobby-quiz:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lobby-poll {
  margin: var(--space-sm) 0;
  flex-shrink: 0;
}

.poll-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.poll-question {
  font-weight: 600;
  margin: 0 0 var(--space-sm);
  font-size: 0.9rem;
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.poll-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.poll-option:disabled {
  cursor: default;
  opacity: 0.9;
}

.poll-option--voted {
  border-color: var(--srf-red);
}

.poll-option-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--srf-red-soft);
  z-index: 0;
  transition: width 0.3s ease;
}

.poll-option-label,
.poll-option-pct {
  position: relative;
  z-index: 1;
}

.poll-voted-hint {
  font-size: 0.75rem;
  color: var(--success);
  margin: var(--space-sm) 0 0;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-top: var(--space-sm);
}

.chat-channel-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}

.chat-channel-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.chat-channel-btn.active {
  background: var(--bg-card);
  border-color: var(--srf-red);
  color: var(--srf-red);
  box-shadow: inset 0 0 0 1px var(--srf-red);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  line-height: 1.45;
  min-height: 120px;
}

.chat-line {
  padding: 2px 0;
  word-break: break-word;
}

.chat-line--system {
  opacity: 0.85;
}

.chat-system {
  color: var(--text-muted);
  font-style: italic;
}

.chat-team-badge {
  display: inline-block;
  min-width: 1.75rem;
  padding: 1px 5px;
  margin-right: 4px;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  vertical-align: baseline;
}

.chat-nick {
  font-weight: 700;
  margin-right: 6px;
}

.chat-text {
  color: var(--text);
}

.chat-user-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-xs) 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chat-preview-name {
  font-weight: 600;
  color: var(--text);
}

.chat-form {
  display: flex;
  gap: var(--space-sm);
  padding-top: var(--space-sm);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 10px 12px;
}

.btn-chat-send {
  width: auto;
  padding: 10px 16px;
  flex-shrink: 0;
}

/* Quiz */
.screen-quiz-lobby,
.screen-quiz,
.screen-quiz-interstitial,
.screen-quiz-result {
  justify-content: center;
  text-align: center;
}

.lobby-countdown {
  font-size: 4rem;
  font-weight: 800;
  color: var(--srf-red);
  margin: var(--space-lg) 0;
}

.lobby-rules {
  text-align: left;
  color: var(--text-muted);
  font-size: 0.875rem;
  list-style: none;
}

.lobby-rules li {
  padding: 4px 0;
}

.lobby-rules li::before {
  content: "• ";
  color: var(--srf-red);
}

.quiz-progress {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-sm);
}

.quiz-question {
  font-size: 1.125rem;
  font-weight: 600;
  text-align: left;
  margin-bottom: var(--space-md);
}

.quiz-score-live {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.interstitial-rank {
  font-size: 2rem;
  font-weight: 800;
  color: var(--srf-red);
  margin: var(--space-md) 0;
}

.leaderboard {
  text-align: left;
  width: 100%;
  margin: var(--space-md) 0;
}

.leaderboard-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.leaderboard-row.you {
  color: var(--srf-red);
  font-weight: 600;
}

.result-points {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--srf-red);
}

.result-meta {
  color: var(--text-muted);
  margin: var(--space-sm) 0 var(--space-lg);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
}

/* Profile */
.screen-profile {
  gap: var(--space-md);
}

.profile-header {
  text-align: center;
  padding: var(--space-lg) 0;
}

.profile-level {
  display: inline-block;
  padding: 6px 16px;
  background: var(--srf-red);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.profile-nickname {
  font-size: 1.5rem;
  font-weight: 700;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.stat-box {
  text-align: center;
  padding: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.stat-box .value {
  font-size: 1.25rem;
  font-weight: 700;
}

.stat-box .label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}

.badge-item {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  text-align: center;
  transition: opacity 0.2s;
  box-shadow: var(--shadow-sm);
}

.badge-item.locked {
  opacity: 0.35;
  filter: grayscale(1);
}

.badge-item .badge-name {
  font-size: 0.5rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.2;
}

.profile-last-quiz {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.profile-last-quiz strong {
  color: var(--text);
}
