:root {
  --red: #e6453c;
  --yellow: #f4c721;
  --green: #3fae4a;
  --blue: #2e6ee6;
  --bg: #0f1720;
  --panel: #182530;
  --text: #eef3f7;
  --muted: #8fa3b0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: radial-gradient(circle at top, #1b2b3a, var(--bg));
  color: var(--text);
  min-height: 100vh;
}

#app { max-width: 1000px; margin: 0 auto; padding: 20px; }

.hidden { display: none !important; }

.logo { text-align: center; font-size: 2.4rem; letter-spacing: 2px; margin: 10px 0 24px; }
.logo.small { font-size: 1.6rem; margin-bottom: 12px; }
.logo span { color: var(--yellow); }

.panel {
  background: var(--panel);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.panel h2 { margin-top: 0; }
.panel h3 { margin-bottom: 8px; color: var(--muted); font-size: 0.95rem; text-transform: uppercase; letter-spacing: 1px; }

label { display: block; font-size: 0.85rem; color: var(--muted); margin: 10px 0 4px; }
input[type=text], input[type=number] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2c3e4c;
  background: #0f1a22;
  color: var(--text);
  font-size: 1rem;
}
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; margin: 12px 0; }
.checkbox input { width: auto; }

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  margin-top: 12px;
  margin-right: 8px;
  transition: transform 0.08s ease;
}
button:active { transform: scale(0.97); }
.btn-primary { background: var(--green); color: white; }
.btn-secondary { background: var(--blue); color: white; }
.btn-warn { background: var(--yellow); color: #2b2200; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid #2c3e4c; }

.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .lobby-grid { grid-template-columns: 1fr; } }

.room-list { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow-y: auto; }
.room-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: #0f1a22; border-radius: 8px; margin-bottom: 8px;
}
.room-list button { margin: 0; padding: 6px 12px; font-size: 0.85rem; }
.muted { color: var(--muted); }

.player-list { list-style: none; padding: 0; }
.player-list li { padding: 8px 0; border-bottom: 1px solid #223140; display: flex; justify-content: space-between; }
.player-list li .tag { font-size: 0.75rem; color: var(--muted); }

.opponents { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 10px; }
.opponent-chip {
  background: var(--panel); border-radius: 10px; padding: 8px 14px; font-size: 0.85rem;
  border: 2px solid transparent;
}
.opponent-chip.active { border-color: var(--yellow); }
.opponent-chip.disconnected { opacity: 0.5; }

.table { display: flex; justify-content: center; align-items: center; gap: 40px; margin: 20px 0; }
.pile { position: relative; width: 90px; height: 130px; }
.pile-count {
  position: absolute; bottom: -22px; left: 0; right: 0; text-align: center;
  font-size: 0.8rem; color: var(--muted);
}

.card {
  width: 90px; height: 130px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.4rem;
  color: white;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  user-select: none;
  border: 3px solid rgba(255,255,255,0.15);
}
.card.back {
  background: repeating-linear-gradient(45deg, #1b2b3a, #1b2b3a 6px, #24384a 6px, #24384a 12px);
  border-color: #33465a;
}
.card.red { background: var(--red); }
.card.yellow { background: var(--yellow); color: #2b2200; }
.card.green { background: var(--green); }
.card.blue { background: var(--blue); }
.card.wildcard { background: linear-gradient(135deg, var(--red), var(--yellow), var(--green), var(--blue)); }

.turn-banner { text-align: center; font-size: 1.05rem; margin: 6px 0 12px; min-height: 1.4em; }
.turn-banner.mine { color: var(--yellow); font-weight: 700; }

.game-log {
  max-height: 90px; overflow-y: auto; font-size: 0.8rem; color: var(--muted);
  background: #0f1a22; border-radius: 10px; padding: 8px 12px; margin-bottom: 14px;
}

.hand-area { text-align: center; }
.hand {
  display: flex; justify-content: center; flex-wrap: wrap; gap: -20px;
  min-height: 150px; align-items: flex-end;
}
.hand .card { margin: 0 -14px; transition: transform 0.15s ease; cursor: pointer; }
.hand .card:hover { transform: translateY(-14px); z-index: 2; }
.hand .card.disabled { filter: grayscale(0.6) brightness(0.7); cursor: not-allowed; }
.hand .card.disabled:hover { transform: none; }

.hand-actions { margin-top: 14px; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.modal-box { background: var(--panel); padding: 24px; border-radius: 14px; text-align: center; min-width: 260px; }
.color-choices { display: flex; gap: 12px; justify-content: center; margin-top: 14px; }
.swatch { width: 56px; height: 56px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.3); margin: 0; }
.swatch.red { background: var(--red); } .swatch.yellow { background: var(--yellow); }
.swatch.green { background: var(--green); } .swatch.blue { background: var(--blue); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #33202099; border: 1px solid var(--red); color: white;
  padding: 10px 18px; border-radius: 10px; font-size: 0.9rem; z-index: 20;
}
