/* ==========================================================================
   Komponenten — Knöpfe, Plaketten, Paneele, Dialoge
   ========================================================================== */

/* ---- Rivets (Zier-Nieten aus Messing) ---------------------------------- */
.rivet {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--brass-300), var(--brass-600) 55%, var(--brass-900) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.3) inset,
    0 1px 2px rgba(0, 0, 0, 0.6);
}

/* ---- Buttons: fühlbare, gedrückte Knöpfe -------------------------------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  padding: 0.85em 1.6em;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--parchment-100);
  background: linear-gradient(180deg, var(--brass-600), var(--brass-800) 70%, var(--brass-900));
  box-shadow: var(--shadow-raised);
  transform: translateY(0);
  transition: transform 0.12s var(--ease-settle), box-shadow 0.12s var(--ease-settle);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 2px 2px auto 2px;
  height: 40%;
  border-radius: var(--radius-md) var(--radius-md) 60% 60% / var(--radius-md) var(--radius-md) 100% 100%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-raised-hover);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: var(--shadow-pressed);
  transition: transform 0.05s, box-shadow 0.05s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-pressed);
}

.btn-wine {
  background: linear-gradient(180deg, var(--wine-600), var(--wine-800) 70%, var(--wine-900));
  color: var(--parchment-100);
}

.btn-felt {
  background: linear-gradient(180deg, var(--felt-500), var(--felt-700) 70%, var(--felt-900));
}

.btn-ghost {
  background: linear-gradient(180deg, var(--wood-600), var(--wood-800) 70%, var(--wood-900));
}

.btn-small {
  padding: 0.5em 1em;
  font-size: 0.85rem;
}

/* ---- Eingabefelder: geprägtes Messing-Feld ----------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  font-family: var(--font-body);
}

.field label {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brass-500);
}

.field input {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  padding: 0.7em 0.9em;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--parchment-200);
  color: var(--ink-800);
  box-shadow: var(--shadow-inset-deep);
  outline: none;
}

.field input:focus {
  box-shadow: var(--shadow-inset-deep), 0 0 0 2px var(--brass-500);
}

.field input.code-input {
  text-transform: uppercase;
  text-align: center;
  font-size: 1.6rem;
}

/* ---- Plakette / Nameplate ----------------------------------------------- */
.nameplate {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.5em 1em;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 600;
  background: linear-gradient(180deg, var(--brass-500), var(--brass-700));
  color: var(--ink-900);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 2px 4px rgba(0, 0, 0, 0.4);
}

/* ---- Paneel: Holzbrett mit Messingrahmen -------------------------------- */
.panel {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 2em;
  box-shadow: var(--shadow-card);
  border: 3px solid var(--brass-700);
}

/* ---- Modal-Overlay (Nickname-Dialog) ------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 3, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: overlay-in 0.25s var(--ease-settle);
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-plate {
  position: relative;
  width: min(420px, 90vw);
  padding: 2.4em 2.2em;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card-lift);
  border: 3px solid var(--brass-700);
  transform: scale(0.9) translateY(10px);
  animation: plate-in 0.4s var(--ease-spring) forwards;
}

@keyframes plate-in {
  to {
    transform: scale(1) translateY(0);
  }
}

.modal-plate .rivet {
  position: absolute;
}
.modal-plate .rivet:nth-of-type(1) { top: 14px; left: 14px; }
.modal-plate .rivet:nth-of-type(2) { top: 14px; right: 14px; }
.modal-plate .rivet:nth-of-type(3) { bottom: 14px; left: 14px; }
.modal-plate .rivet:nth-of-type(4) { bottom: 14px; right: 14px; }

/* ---- Status / Verbindungs-Lämpchen -------------------------------------- */
.status-lamp {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: #7a2b2b;
  box-shadow: 0 0 4px 1px rgba(122, 43, 43, 0.7), 0 1px 1px rgba(0,0,0,0.5) inset;
  transition: background 0.3s, box-shadow 0.3s;
}

.status-lamp.online {
  background: #4caf6b;
  box-shadow: 0 0 6px 2px rgba(76, 175, 107, 0.8), 0 1px 1px rgba(0,0,0,0.5) inset;
}

/* ---- Toast / Meldezettel ------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  padding: 0.8em 1.4em;
  border-radius: var(--radius-sm);
  font-weight: 700;
  box-shadow: var(--shadow-card);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s var(--ease-settle), transform 0.25s var(--ease-settle);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Lobby-Bausteine, gemeinsam für alle Spiele ------------------------- */
.lobby-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.lobby-card {
  width: min(480px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 1.4em;
}

.lobby-tabs {
  display: flex;
  gap: 0.5em;
  margin-bottom: 0.4em;
}

.lobby-tab {
  flex: 1;
  text-align: center;
  padding: 0.6em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: var(--shadow-pressed);
  color: var(--parchment-300);
}

.lobby-tab.active {
  background: linear-gradient(180deg, var(--brass-600), var(--brass-800));
  color: var(--ink-900);
  box-shadow: var(--shadow-raised);
}

.player-row {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.6em 0.9em;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  box-shadow: var(--shadow-inset-deep);
}

.player-row .token-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-weight: 800;
  color: var(--brass-500);
  font-size: 0.9rem;
}
.back-link:hover {
  color: var(--brass-300);
}

/* ---- Gemeinsame Spiel-Shell: Body, Scoreboard, Ergebnis-Overlay --------- */
.game-body {
  min-height: 100vh;
  position: relative;
  padding: 1.2em 1.4em 3em;
}

.game-body > .back-link {
  position: relative;
  z-index: 2;
}

.game-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6em;
  margin-top: 1em;
}

.scoreboard {
  display: flex;
  align-items: center;
  gap: 1.6em;
  padding: 0.7em 1.4em;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.28);
  box-shadow: var(--shadow-inset-deep);
}

.player-badge {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.4em 0.9em;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--parchment-200);
  transition: box-shadow 0.2s, background 0.2s;
}

.player-badge.active-turn {
  background: linear-gradient(180deg, var(--brass-600), var(--brass-800));
  color: var(--ink-900);
  box-shadow: var(--shadow-raised);
}

@media (max-width: 420px) {
  .scoreboard {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5em 0.8em;
    padding: 0.6em 0.9em;
  }
  .player-badge:first-child { order: 1; }
  .player-badge:last-child { order: 2; }
  .player-badge {
    max-width: 42vw;
  }
  .player-badge span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .turn-indicator {
    order: 3;
    flex-basis: 100%;
    min-width: 0 !important;
    font-size: 0.85rem;
  }
}

.turn-indicator {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--brass-500);
  font-size: 0.95rem;
  min-width: 8em;
  text-align: center;
}

.token-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) inset, 0 1px 0 rgba(255, 255, 255, 0.2);
}

.token-marble { background: radial-gradient(circle at 35% 30%, var(--marble-100), var(--marble-500) 75%); }
.token-wood-piece { background: radial-gradient(circle at 35% 30%, var(--wood-500), var(--wood-900) 75%); }
.token-bordeaux { background: radial-gradient(circle at 35% 30%, var(--wine-500), var(--wine-800) 75%); }
.token-brass-chip { background: radial-gradient(circle at 35% 30%, var(--brass-500), var(--brass-800) 75%); }

.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 3, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  animation: overlay-in 0.3s var(--ease-settle);
}

.result-plate {
  width: min(380px, 90vw);
  padding: 2.2em;
  border-radius: var(--radius-lg);
  border: 3px solid var(--brass-700);
  box-shadow: var(--shadow-card-lift);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1em;
  transform: scale(0.9);
  animation: plate-in 0.4s var(--ease-spring) forwards;
}

.result-plate h2 {
  color: var(--parchment-100);
  font-size: 1.8rem;
}

.board-frame {
  padding: 1.2em;
  border-radius: var(--radius-lg);
  border: 4px solid var(--brass-700);
  box-shadow: var(--shadow-card-lift);
  display: inline-block;
}
