/* ═══════════════════════════════════════════════
   ui.css — Player panels, action bar, top bar,
            menu & lobby screens
   Settlers of Catan — Browser Edition
═══════════════════════════════════════════════ */

/* ══════════════════════════
   GAME SCREEN LAYOUT
══════════════════════════ */

#game-screen {
  display: grid;
  grid-template:
    "top   top"   auto
    "board panel" 1fr
    / 1fr var(--panel-width);
  height: 100vh;
}

/* ── Top bar ── */
#top-bar {
  grid-area: top;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

#phase-label {
  flex-grow: 1;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.5px;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

#turn-indicator {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Dice ── */
#dice-container {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.die {
  width: 40px;
  height: 40px;
  background: linear-gradient(150deg, #fef6dc 0%, #ead898 60%, #c9ae68 100%);
  border: 2px solid #8a6a28;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #2d1800;
  box-shadow:
    0 3px 8px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.7),
    inset 0 -2px 0 rgba(0,0,0,0.2);
  user-select: none;
  line-height: 1;
  font-family: serif;
}

@keyframes diceRoll {
  0%   { transform: rotate(0deg)   scale(1);    }
  20%  { transform: rotate(-20deg) scale(1.15); }
  45%  { transform: rotate(15deg)  scale(1.1);  }
  65%  { transform: rotate(-10deg) scale(1.05); }
  85%  { transform: rotate(6deg)   scale(1.02); }
  100% { transform: rotate(0deg)   scale(1);    }
}

.die.dice-rolling {
  animation: diceRoll 0.6s ease;
}

/* ── Board area ── */
#board-container {
  grid-area: board;
}

/* ── Right panel ── */
#right-panel {
  grid-area: panel;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* ══════════════════════════
   PLAYER CARDS
══════════════════════════ */

.player-card {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
  border-left: 4px solid transparent;
}

.player-card.active {
  background: rgba(233, 196, 106, 0.07);
  border-left-color: var(--accent);
}

/* ── Header row: color dot + name + VP ── */
.pc-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}

.pc-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,0.15);
}

.pc-name {
  font-weight: 700;
  font-size: 13px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-vp {
  font-size: 18px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  white-space: nowrap;
}

.pc-vp-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ── Resource row ── */
.pc-res-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-bottom: 7px;
}

.pc-res {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 2px 3px;
  transition: background 0.15s, border-color 0.15s;
}

.pc-res.has-res {
  background: var(--panel-light);
  border-color: var(--text-muted);
}

.pc-res-icon {
  font-size: 20px;
  line-height: 1;
}

.pc-res-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
}

.pc-res.has-res .pc-res-count {
  color: var(--text);
}

/* ── Piece counts ── */
.pc-pieces {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ══════════════════════════
   SPECIAL CARDS BAR
══════════════════════════ */

#special-cards {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.special-card {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
  text-align: center;
}

.special-card .sc-emoji {
  font-size: 18px;
  line-height: 1;
}

.special-card .sc-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.special-card .holder-name {
  color: var(--accent);
  font-weight: 700;
  font-size: 11px;
}

/* ══════════════════════════
   ACTION BAR
══════════════════════════ */

#action-bar {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

/* ══════════════════════════
   BUTTONS
══════════════════════════ */

.btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
  font-family: inherit;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #1a0a00;
}

.btn-primary:hover:not(:disabled) {
  background: #f5d47a;
}

.btn-secondary {
  background: var(--panel-light);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: #2e4060;
  border-color: var(--text-muted);
}

.btn-danger {
  background: #e63946;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #f0505e;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ══════════════════════════
   MENU SCREEN
══════════════════════════ */

#menu-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.menu-content {
  width: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 40px;
}

.game-title {
  font-size: 48px;
  font-weight: 700;
  text-align: center;
  color: var(--accent);
  letter-spacing: 10px;
  line-height: 1;
  font-family: 'Cinzel', serif;
}

.game-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-top: -16px;
  font-size: 12px;
  letter-spacing: 5px;
  text-transform: uppercase;
  font-family: 'Cinzel', serif;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.menu-section label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 8px;
}

.map-options,
.player-count-options {
  display: flex;
  gap: 8px;
}

.map-btn,
.count-btn {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
}

.map-btn:hover,
.count-btn:hover {
  border-color: var(--text-muted);
  background: var(--panel-light);
}

.map-btn.active,
.count-btn.active {
  background: var(--accent);
  color: #1a0a00;
  border-color: var(--accent);
}

/* ── Player setup rows ── */
#player-setup-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-setup-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.player-color-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.player-setup-row input[type="text"] {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  min-width: 0;
}

.player-setup-row input[type="text"]::placeholder {
  color: var(--text-muted);
}

.ai-toggle {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.ai-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Menu buttons ── */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ══════════════════════════
   LOBBY SCREEN
══════════════════════════ */

#lobby-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.lobby-content {
  width: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 40px;
}

.lobby-content h2 {
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
}

#lobby-create,
#lobby-join {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#room-code-input {
  font-size: 24px;
  text-align: center;
  letter-spacing: 4px;
  border: 2px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 12px;
  font-family: inherit;
  font-weight: bold;
  width: 100%;
  outline: none;
  text-transform: uppercase;
  transition: border-color 0.15s;
}

#room-code-input:focus {
  border-color: var(--accent);
}

#room-code-input::placeholder {
  color: var(--text-muted);
  letter-spacing: 2px;
  font-size: 14px;
  font-weight: 400;
}

#lobby-waiting {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

#room-code-display {
  font-size: 32px;
  font-weight: bold;
  color: var(--accent);
  letter-spacing: 6px;
}

#lobby-players-list {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

#lobby-players-list .lobby-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

#lobby-players-list .lobby-player:last-child {
  border-bottom: none;
}

#lobby-players-list .lobby-player .player-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

#lobby-players-list .lobby-player .lobby-player-name {
  flex: 1;
}

#lobby-players-list .lobby-player .lobby-player-status,
#lobby-players-list .lobby-player .lobby-player-slot {
  font-size: 11px;
  color: var(--text-muted);
}
