:root {
  color-scheme: light dark;
  --bg: #0f5132;
  --card-bg: #ffffff;
  --card-fg: #111111;
  --text: #f5f5f5;
  --accent: #38d9a9;
  --accent-fg: #06382d;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem;
}

.card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 68px;
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--card-fg);
  font-weight: 700;
  margin: 4px;
}

.card--back {
  background: repeating-linear-gradient(45deg, #274c77, #274c77 6px, #1b3a5c 6px, #1b3a5c 12px);
  color: transparent;
}

.card--ad {
  background: #fff;
}

.card-ad-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card--ad-text {
  background: #1b3a5c;
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.1;
  padding: 2px;
  word-break: break-word;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1rem;
  min-height: 2.75rem;
  margin: 4px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
  transition: transform 100ms ease-out, opacity 100ms ease-out;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn--secondary {
  background: #4a4a4a;
  color: #f5f5f5;
}

.btn--outline-danger {
  background: none;
  border: 1px solid rgba(255, 107, 107, 0.5);
  color: var(--danger);
}

.icon-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  font-size: 1.1rem;
}

.error { color: #ffb4b4; }

.share-link-fallback {
  font-size: 0.85rem;
  word-break: break-all;
  opacity: 0.85;
}

.version-footer {
  font-size: 0.7rem;
  opacity: 0.6;
  text-align: center;
  margin-top: 1rem;
}

.timer {
  font-weight: 700;
}

.timer--warn {
  color: #ffd166;
}

.timer--urgent {
  color: #ff6b6b;
}

.player-box {
  outline: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 8px;
}

.player--loser {
  outline: 3px solid #ff6b6b;
}

.player--round-winner {
  outline: 3px solid #ffd166;
}

.player--tied {
  outline: 3px dashed #a78bfa;
}

.player--neutral {
  outline: 3px solid #ced4da;
}

.card--tiebreak-winner {
  outline: 3px solid #ffd166;
  outline-offset: 1px;
}

.card--tiebreak-loser {
  outline: 3px solid #ff6b6b;
  outline-offset: 1px;
}

.tiebreak-note {
  font-size: 0.85rem;
  opacity: 0.9;
  margin: 4px 0;
}

.my-hand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.reveal-ready {
  display: inline-flex;
  flex-direction: column;
  gap: 0.3rem;
}

.reveal-ready-progress {
  position: relative;
  width: 100%;
  height: 18px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  overflow: hidden;
}

.reveal-ready-progress-fill {
  height: 100%;
  background: #38d9a9;
  transition: width 300ms ease-out;
}

.reveal-ready-progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.turn-progress {
  position: relative;
  width: 100%;
  height: 18px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  overflow: hidden;
  margin-top: 6px;
}

.turn-progress-fill {
  height: 100%;
  transition: width 1s linear, background-color 300ms ease-out;
}

.turn-progress-fill--ok { background: #38d9a9; }
.turn-progress-fill--warn { background: #ffd166; }
.turn-progress-fill--urgent { background: #ff6b6b; }

.turn-progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.score-label {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 2px;
}

.round-rank {
  font-size: 1.4rem;
  font-weight: 800;
}

.score-label--reveal {
  font-size: 1.4rem;
  font-weight: 800;
  opacity: 1;
  margin-top: 4px;
}

.score-label--round-winner {
  color: #ffd166;
}

.score-label--loser {
  color: #ff6b6b;
}

.score-label--tied {
  color: #a78bfa;
}

.score-label--neutral {
  color: #ced4da;
}

.knack-badge {
  font-weight: bold;
  font-size: 1.05rem;
  margin: 4px 0;
}

.away-badge {
  font-style: italic;
  opacity: 0.7;
  font-size: 0.85rem;
  margin-left: 0.3rem;
}

.kick-pending-badge {
  font-style: italic;
  color: #ff6b6b;
  font-size: 0.85rem;
  margin-left: 0.3rem;
}

.turn-badge {
  color: #4dabf7;
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: 0.3rem;
}

.closed-badge {
  color: #ffd166;
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: 0.3rem;
}

.knock-badge {
  color: #38d9a9;
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: 0.3rem;
}

.dealer-badge {
  color: #ced4da;
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: 0.3rem;
}

.player--turn {
  outline: 2px solid #4dabf7;
  border-radius: 8px;
  padding: 4px;
}

.standings-list {
  list-style: none;
  margin: 1rem 0;
  padding: 0;
  text-align: left;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.standings-list li {
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.standings-list__me {
  background: rgba(255, 209, 102, 0.18);
  border-radius: 4px;
  font-weight: 700;
}

.gameover-winner {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffd166;
}

.card svg {
  display: block;
  width: 100%;
  height: 100%;
}

.card--selected {
  outline: 3px solid #4dabf7;
}

.card--clickable {
  cursor: pointer;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal {
  background: #fff;
  color: #111;
  padding: 1rem;
  border-radius: 8px;
  max-width: 320px;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.skip-confirm-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  margin: 0.5rem 0;
}


.voice-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.voice-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.voice-participants {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.voice-participant {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.voice-participant-name {
  min-width: 5rem;
}

.voice-hostmute {
  font-size: 0.85rem;
  padding: 2px 6px;
}

@keyframes card-reveal-in {
  from { transform: scale(0.85); opacity: 0.3; }
  to { transform: scale(1); opacity: 1; }
}

.card--reveal-anim {
  animation: card-reveal-in 280ms ease-out;
}

@keyframes highlight-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.player--loser,
.player--round-winner,
.player--tied,
.player--neutral {
  animation: highlight-pulse 500ms ease-out;
}

@keyframes table-cards-pulse {
  0% { opacity: 0.3; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

.table-cards {
  display: inline-flex;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  padding: 2px;
  margin: 0 0 8px;
}

.table-cards--dealt .card {
  animation: table-cards-pulse 350ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .card--reveal-anim,
  .player--loser,
  .player--round-winner,
  .player--tied,
  .player--neutral,
  .table-cards--dealt .card {
    animation: none;
  }

  .btn {
    transition: none;
  }
}

.remove-bot-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  margin-left: 0.4rem;
  padding: 4px 6px;
  font-size: 0.85rem;
}

.confirm-active-btn {
  display: inline-block;
  background: var(--accent);
  border: none;
  color: var(--accent-fg);
  cursor: pointer;
  margin-left: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.leave-room-btn {
  margin-top: 1rem;
}
