/* =====================================================================
   KOPF HOCH! – Gestaltung der Spielseite
   Baut auf tyjora.css auf (Tyjora-Farben, Schriften, Buttons – eine
   Kopie von css/style.css der Tyjora-Website).
   Spielerfarben stehen in board.js (COLORS) – hier nur das Drumherum.
   ===================================================================== */

body.rb { display: flex; flex-direction: column; min-height: 100vh; }
.rb-headline { display: flex; align-items: baseline; gap: 16px; min-width: 0; margin-right: auto; margin-left: 12px; }
.rb-game-title { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: .01em; white-space: nowrap; }
.rb-lobby { font-size: 14px; color: var(--gc-navy-muted); white-space: nowrap; }
.rb-lobby strong { letter-spacing: .12em; color: var(--gc-teal); font-size: 16px; }
.rb-conn { background: var(--gc-coral); color: var(--gc-white); text-align: center; font-weight: 700; font-size: 14px; padding: 6px 12px; }

/* ---------- Startbildschirm (ohne Lobby) ---------- */
.rb-home { flex: 1; display: grid; grid-template-columns: minmax(320px, 520px) minmax(0, 1fr); gap: 32px; align-items: center; padding: 32px 40px; max-width: 1400px; margin: 0 auto; width: 100%; }
.rb-home h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 4vw, 48px); line-height: 1.08; margin: 8px 0 12px; }
.rb-home p { margin: 0 0 22px; font-size: 18px; color: var(--gc-navy-soft); }
.rb-home-actions { display: flex; flex-direction: column; gap: 12px; max-width: 380px; }
.rb-home-art svg { width: 100%; height: auto; max-height: 72vh; display: block; }
.rb-home .join-row { margin-top: 4px; }

/* ---------- Spieltisch: links Spieler · Mitte Brett · rechts Regeln/Verlauf ---------- */
.rb-table {
  flex: 1; display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; grid-template-rows: minmax(0, 1fr); gap: 18px;
  padding: 18px 28px; height: calc(100vh - 77px); min-height: 600px;
}
.rb-col { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; padding: 2px; scrollbar-width: thin; }
.rb-card { background: var(--gc-white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 16px 18px; }
.rb-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.rb-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.rb-board-wrap { flex: 1; min-height: 0; position: relative; }
/* Das Brett füllt die freie Fläche und bleibt dabei immer ganz sichtbar */
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; touch-action: manipulation; }

/* ---------- Spielerliste ---------- */
.rb-players { display: flex; flex-direction: column; gap: 6px; }
.rb-player {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 6px; border-radius: var(--radius-md);
  background: var(--gc-bg-light); border-left: 5px solid var(--pc, var(--gc-bg-deep)); min-height: 56px;
  transition: background .2s, box-shadow .2s, transform .2s;
}
.rb-player.is-turn { background: var(--gc-white); box-shadow: 0 0 0 2px var(--pc), var(--shadow-md); transform: translateX(3px); }
.rb-player.is-away { opacity: .6; }
.rb-player .rb-fig { flex: none; }
.rb-player-info { flex: 1; min-width: 0; }
.rb-player-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-player-name small { font-weight: 400; font-size: 12px; color: var(--gc-navy-muted); margin-left: 4px; }
.rb-player-sub { font-size: 12.5px; color: var(--gc-navy-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rb-dots { display: inline-flex; gap: 3px; }
.rb-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--gc-bg-deep); display: block; }
.rb-dots i.on { background: var(--pc); }
.rb-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--gc-bg-deep); color: var(--gc-navy-soft); white-space: nowrap; }
.rb-tag-host { background: var(--gc-yellow); color: var(--gc-navy); }
.rb-tag-turn { background: var(--pc); color: #fff; }
.rb-tag-rank { background: var(--gc-navy); color: var(--gc-white); font-size: 13px; }
.rb-spectators { margin-top: 10px; font-size: 13px; color: var(--gc-navy-muted); }

/* ---------- Farbe & Figur wählen ---------- */
.rb-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-bottom: 14px; }
.rb-swatch {
  aspect-ratio: 1; border-radius: 50%; border: 3px solid var(--gc-white); cursor: pointer; padding: 0;
  background: var(--sw); box-shadow: 0 0 0 2px var(--gc-bg-deep); position: relative; transition: transform .15s;
}
.rb-swatch:hover:not(:disabled) { transform: scale(1.12); }
.rb-swatch.is-mine { box-shadow: 0 0 0 3px var(--gc-navy); transform: scale(1.1); }
.rb-swatch:disabled { cursor: not-allowed; opacity: .28; }
.rb-figures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rb-figure {
  border: 2px solid transparent; background: var(--gc-bg-light); border-radius: var(--radius-md); cursor: pointer;
  padding: 6px 2px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font: 700 11.5px var(--font); color: var(--gc-navy-soft); transition: transform .15s, background .15s;
}
.rb-figure:hover { background: var(--gc-white); transform: translateY(-2px); }
.rb-figure.is-mine { border-color: var(--gc-teal); background: var(--gc-white); box-shadow: var(--shadow-sm); color: var(--gc-navy); }

/* ---------- Regeln einstellen ---------- */
.rb-seg { display: flex; flex-wrap: wrap; background: var(--gc-bg-light); border-radius: var(--radius-md); padding: 4px; gap: 2px; }
.rb-seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 8px 4px; font: 700 13px var(--font); color: var(--gc-navy-muted); cursor: pointer; white-space: nowrap; }
.rb-seg button.on { background: var(--gc-white); color: var(--gc-navy); box-shadow: var(--shadow-sm); }
.rb-seg button:disabled { opacity: .4; cursor: not-allowed; }
.rb-opt-label { font-size: 13px; font-weight: 700; margin: 14px 0 6px; }
.rb-opt { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--gc-bg-light); margin: 0; cursor: pointer; font-weight: 400; }
.rb-opt:first-of-type { border-top: 0; }
.rb-opt b { display: block; font-size: 14.5px; }
.rb-opt span span { display: block; font-size: 12.5px; color: var(--gc-navy-muted); line-height: 1.35; }
.rb-opt input { position: absolute; opacity: 0; pointer-events: none; }
.rb-switch { flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--gc-bg-deep); position: relative; transition: background .2s; margin-top: 2px; }
.rb-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--gc-white); box-shadow: var(--shadow-sm); transition: transform .2s; }
.rb-opt input:checked + .rb-switch { background: var(--gc-teal); }
.rb-opt input:checked + .rb-switch::after { transform: translateX(18px); }
.rb-opt input:focus-visible + .rb-switch { outline: 2px solid var(--gc-navy); outline-offset: 2px; }
.rb-opt.is-locked { cursor: default; }
.rb-opt.is-locked .rb-switch { opacity: .55; }

/* ---------- Leiste unter dem Brett ---------- */
.rb-bar {
  flex: none; display: flex; align-items: center; gap: 18px; background: var(--gc-white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 12px 20px; margin: 4px auto 0; width: min(100%, 640px); min-height: 92px;
  border-bottom: 5px solid var(--pc, var(--gc-bg-deep)); transition: border-color .3s;
}
.rb-bar-text { flex: 1; min-width: 0; }
.rb-bar-title { font-weight: 700; font-size: 18px; line-height: 1.25; }
.rb-bar-sub { font-size: 14px; color: var(--gc-navy-muted); min-height: 20px; }
.rb-bar .btn { flex: none; }

/* ---------- Würfel (echter 3D-Würfel aus sechs Flächen) ---------- */
.rb-die-scene { flex: none; width: 60px; height: 60px; perspective: 900px; margin: 4px 12px 4px 8px; cursor: default; border: 0; background: none; padding: 0; }
.rb-die-scene.ready { cursor: pointer; animation: rbDieReady 1.1s ease-in-out infinite; }
.rb-die-scene.rolling { animation: rbDieHop .9s ease-out; }
.rb-die-tilt { width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateX(-22deg) rotateY(-26deg); }
.rb-die { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.17, .8, .3, 1); }
.rb-die-face {
  position: absolute; inset: 0; border-radius: 11px; padding: 8px;
  background: linear-gradient(145deg, #FFFFFF, #EFE6D6); border: 2px solid #D8CCB4;
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); place-items: center;
}
.rb-die-face i { width: 10px; height: 10px; border-radius: 50%; background: var(--gc-navy); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); }
.rb-die-face.f1 i { background: var(--gc-coral); width: 14px; height: 14px; }
.rb-die-face.f1 { transform: translateZ(30px); }
.rb-die-face.f6 { transform: rotateY(180deg) translateZ(30px); }
.rb-die-face.f3 { transform: rotateY(90deg) translateZ(30px); }
.rb-die-face.f4 { transform: rotateY(-90deg) translateZ(30px); }
.rb-die-face.f5 { transform: rotateX(90deg) translateZ(30px); }
.rb-die-face.f2 { transform: rotateX(-90deg) translateZ(30px); }
@keyframes rbDieHop { 0% { transform: translateY(0); } 30% { transform: translateY(-26px); } 60% { transform: translateY(0); } 78% { transform: translateY(-8px); } 100% { transform: translateY(0); } }
@keyframes rbDieReady { 50% { transform: translateY(-5px) scale(1.05); } }

/* ---------- Figuren auf dem Brett ---------- */
.rb-pawn { pointer-events: none; }
.rb-pawn .rb-ring { opacity: 0; stroke: var(--gc-yellow); stroke-width: .09px; }
.rb-pawn.movable { pointer-events: auto; cursor: pointer; }
.rb-pawn.movable .rb-ring { opacity: 1; animation: rbRing 1s ease-in-out infinite; }
.rb-pawn.movable .rb-bob { animation: rbBob .9s ease-in-out infinite; }
.rb-pawn.movable:hover .rb-bob { animation: none; transform: translateY(-.16px); }
.rb-pawn.movable:hover .rb-ring { stroke: var(--gc-coral); }
@keyframes rbBob { 50% { transform: translateY(-.1px); } }
@keyframes rbRing { 0%, 100% { stroke-width: .08px; stroke-opacity: 1; } 50% { stroke-width: .15px; stroke-opacity: .55; } }
.rb-target { opacity: .7; transition: opacity .15s; pointer-events: none; }
.rb-targets.has-hot .rb-target { opacity: .15; }
.rb-targets.has-hot .rb-target.is-hot { opacity: 1; }
.rb-glow-ring { animation: rbGlow 1.6s ease-in-out infinite; }
@keyframes rbGlow { 50% { fill-opacity: .06; stroke-opacity: .35; } }

/* ---------- Verlauf & Chat ---------- */
.rb-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; max-height: 190px; overflow-y: auto; }
.rb-log li { padding-left: 14px; position: relative; line-height: 1.35; color: var(--gc-navy-soft); }
.rb-log li::before { content: ""; position: absolute; left: 0; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--pc, var(--gc-bg-deep)); }
.rb-log li:first-child { color: var(--gc-navy); font-weight: 700; }
.rb-chat { display: flex; flex-direction: column; flex: 1; min-height: 220px; padding: 0; overflow: hidden; }
.rb-chat .rb-card-head { padding: 14px 18px 0; margin: 0 0 8px; }
.rb-chat .chat-messages { flex: 1; height: auto; min-height: 120px; }
.rb-link { border: 0; background: none; padding: 0; font: 700 13px var(--font); color: var(--gc-navy-muted); cursor: pointer; text-decoration: underline; }
.rb-link.confirm { color: var(--gc-coral-dark); }

/* ---------- Ergebnis ---------- */
.rb-ranks { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.rb-ranks li { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; border-radius: var(--radius-md); background: var(--gc-bg-light); border-left: 5px solid var(--pc); font-weight: 700; }
.rb-ranks li:first-child { background: rgba(233, 196, 106, .3); font-size: 19px; }
.rb-ranks .rb-place { margin-left: auto; font-family: var(--font-display); font-size: 14px; }
.rb-rules h4 { font-family: var(--font-display); font-size: 13px; margin: 18px 0 6px; }
.rb-rules ul { margin: 0; padding-left: 20px; }
.rb-rules li { margin-bottom: 5px; font-size: 15.5px; }

.rb-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.rb-confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: rbFall linear forwards; }
@keyframes rbFall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- Schmalere Bildschirme ---------- */
@media (max-width: 1180px) {
  .rb-table { grid-template-columns: 260px minmax(0, 1fr); grid-template-rows: auto; height: auto; }
  .rb-center { grid-column: 2; grid-row: 1 / span 2; height: calc(100vh - 113px); min-height: 520px; position: sticky; top: 95px; }
  .rb-col { overflow: visible; }
  .rb-right { grid-column: 1; }
}
@media (max-width: 820px) {
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .rb-headline { order: 3; width: 100%; margin: 0; }
  .rb-table { display: flex; flex-direction: column; padding: 12px; height: auto; min-height: 0; }
  .rb-center { order: -1; height: auto; min-height: 0; position: static; }
  #board { position: static; height: auto; }
  .topbar-actions { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .topbar-actions .btn-sm { padding: 8px 11px; font-size: 13px; }
  .brand-logo { height: 38px; }
  body.rb .toasts { top: 132px; width: calc(100% - 24px); }
  .rb-card { padding: 14px; }
  .rb-bar { position: sticky; bottom: 8px; z-index: 20; padding: 10px 14px; gap: 10px; min-height: 76px; }
  .rb-bar-title { font-size: 16px; }
  .rb-home { grid-template-columns: 1fr; padding: 20px 16px; }
  .rb-home-art { order: -1; }
}
@media (prefers-reduced-motion: reduce) {
  .rb-pawn.movable .rb-bob, .rb-die-scene.ready, .rb-glow-ring { animation: none; }
}

/* Hinweise oben einblenden, damit sie die Würfel-Leiste nicht verdecken */
body.rb .toasts { bottom: auto; top: 92px; }
