/* ========================= */
/*        GLOBAL STYLES      */
/* ========================= */

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #f9fafb;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("../assets/img/bg-stars-landscape.png") center/cover no-repeat;
  filter: brightness(0.9);
}

.app-root.hidden {
  display: none;
}

/* ========================= */
/*        SPLASH SCREEN      */
/* ========================= */

.splash-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 1000;
}

.splash-inner {
  position: relative;
  text-align: center;
  padding: 2rem 3rem;
  border-radius: 1rem;
  backdrop-filter: blur(6px);
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  animation: splash-in 0.6s ease-out forwards;
}

.splash-logo {
  max-width: 260px;
  width: 70vw;
  height: auto;
  margin-bottom: 1rem;
  animation: logo-pulse 2.4s ease-in-out infinite;
}

.splash-tagline {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #facc6b;
}

.splash-version {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: #ccc;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.splash-screen.fade-out {
  animation: splash-out 0.4s ease-out forwards;
}

@keyframes splash-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes splash-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes logo-pulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0px rgba(255, 200, 100, 0.25));
  }
  50% {
    transform: scale(1.03);
    filter: drop-shadow(0 0 12px rgba(255, 200, 100, 0.45));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0px rgba(255, 200, 100, 0.25));
  }
}

/* ========================= */
/*         SCREENS BASE      */
/* ========================= */

.screen {
  min-height: 100vh;
  width: 100%;
  padding: 1.5rem;
  position: relative;
  box-sizing: border-box;

  display: none;
  align-items: center;
  justify-content: center;
}

.screen.screen-active {
  display: flex;
}

/* ========================= */
/*         HOME SCREEN       */
/* ========================= */

.screen-home {
  overflow: hidden;
}

.home-inner {
  position: relative;
  z-index: 1;
  max-width: 480px;
  width: 100%;
  padding: 2rem 2.5rem;
  border-radius: 1.5rem;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 24px 60px rgba(0, 0, 0, 0.8);
}

.home-header {
  text-align: center;
  margin-bottom: 2rem;
}

.home-logo-small {
  max-width: 180px;
  width: 60vw;
  height: auto;
  margin-bottom: 0.5rem;
}

.home-tagline {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #facc6b;
}

.home-menu {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.home-btn {
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.4);
  transition:
    transform 0.12s ease-out,
    box-shadow 0.12s ease-out,
    background 0.12s ease-out,
    color 0.12s ease-out;
}

.home-btn.primary {
  background: radial-gradient(circle at top left, #f97316, #ea580c);
  color: #111827;
  box-shadow:
    0 0 18px rgba(249, 115, 22, 0.65),
    0 0 0 1px rgba(248, 250, 252, 0.5);
}

.home-btn:hover,
.home-btn:active {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(248, 250, 252, 0.6),
    0 16px 32px rgba(15, 23, 42, 0.9);
}

.home-btn.primary:hover,
.home-btn.primary:active {
  background: radial-gradient(circle at top left, #fb923c, #f97316);
}

.home-btn.small {
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
}

/* ========================= */
/*        PANEL GENERIC      */
/* ========================= */

.panel {
  position: relative;
  z-index: 1;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 2.2rem;
  border-radius: 1.5rem;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 24px 60px rgba(0, 0, 0, 0.8);
}

/* ========================= */
/*        PANEL HEADER       */
/* ========================= */

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.panel-header-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.ghost-btn {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: transparent;
  color: #e5e7eb;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.ghost-btn.small {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
}

/* ========================= */
/*        PLAYERS SCREEN     */
/* ========================= */

.player-form {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.input {
  flex: 1 1 160px;
  min-width: 0;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  background: rgba(15, 23, 42, 0.85);
  color: #e5e7eb;
}

.input::placeholder {
  color: #6b7280;
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.player-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.player-name {
  font-weight: 500;
}

.player-stats {
  font-size: 0.75rem;
  color: #9ca3af;
}

.player-actions {
  display: flex;
  gap: 0.35rem;
}

.player-actions button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.player-actions button.delete {
  border-color: rgba(248, 113, 113, 0.9);
  color: #fecaca;
}

/* ========================= */
/*      GAME SETUP SCREEN    */
/* ========================= */

.panel-subtitle {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #9ca3af;
}

.player-select-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.player-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(31, 41, 55, 0.9);
}

.player-select-main {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.player-select-name {
  font-weight: 500;
}

.player-select-stats {
  font-size: 0.75rem;
  color: #9ca3af;
}

.player-select-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: #e5e7eb;
}

.player-select-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.game-setup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.selection-info {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* ========================= */
/*         GAME SCREEN       */
/* ========================= */

.screen-game {
  padding: 0;             /* volle Fläche */
  overflow: hidden;       /* kein Scroll */
}

.game-panel {
  max-width: none;
  width: 100%;
  height: 100vh;          /* 100% Höhe */
  border-radius: 0;
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
}

/* Header im Game minimal halten */

.game-header {
  margin-bottom: 0.5rem;
}

.back-compact {
  padding: 0.25rem 0.7rem;
}

.game-title {
  font-size: 1rem;
  opacity: 0.85;
}

/* FAB "Wurf erfassen" */

.fab-wurf {
  border-radius: 999px;
  border: none;
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: radial-gradient(circle at top left, #f97316, #ea580c);
  color: #111827;
  box-shadow:
    0 0 0 1px rgba(248, 250, 252, 0.5),
    0 8px 22px rgba(15, 23, 42, 0.9);
}

/* Scoreboard nimmt den Rest des Screens ein */

.game-scoreboard-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.scoreboard {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
}

.scoreboard-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.95rem;
  min-width: 700px;
}

.scoreboard-table th,
.scoreboard-table td {
  border: 1px solid rgba(55, 65, 81, 0.9);
  padding: 0;
  text-align: center;
}

.scoreboard-table thead th {
  background: linear-gradient(to bottom, #111827, #020617);
  font-weight: 500;
  padding: 0.4rem 0.35rem;
}

.scoreboard-table th.player-col,
.scoreboard-table td.player-col {
  text-align: left;
  padding-left: 0.6rem;
  min-width: 140px;
  background: linear-gradient(to right, #7c2d12, #b91c1c);
  color: #f9fafb;
}

.scoreboard-row:nth-child(odd) td:not(.player-col) {
  background: rgba(15, 23, 42, 0.9);
}
.scoreboard-row:nth-child(even) td:not(.player-col) {
  background: rgba(17, 24, 39, 0.9);
}

.frame-cell {
  display: grid;
  grid-template-rows: 1.5rem 1.8rem;
  align-items: stretch;
}

.frame-rolls {
  font-size: 0.9rem;
  opacity: 0.9;
  border-bottom: 1px solid rgba(55, 65, 81, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.frame-total {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scoreboard-row.current-player .player-col {
  background: linear-gradient(to right, #f97316, #ea580c);
  color: #111827;
}

.game-status {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  color: #e5e7eb;
  opacity: 0.95;
}

/* ========================= */
/*        PIN OFF-CANVAS     */
/* ========================= */

.pin-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(360px, 80vw);
  background: rgba(15, 23, 42, 0.98);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.95);
  z-index: 900;
  transform: translateX(100%);
  transition: transform 0.2s ease-out;
  display: flex;
  flex-direction: column;
}

.pin-panel.open {
  transform: translateX(0);
}

.pin-panel-inner {
  padding: 0.9rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
}

.pin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.pin-panel-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

/* PIN EINGABE */

.pin-input {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Pyramide */

.pin-grid {
  display: inline-flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
}

.pin-row {
  display: inline-flex;
  flex-direction: row;
  justify-content: center;
  gap: 0.7rem;
}

.pin-row.row-3 {
  gap: 0.7rem;
}
.pin-row.row-2 {
  gap: 0.75rem;
}
.pin-row.row-1 {
  gap: 0.8rem;
}

.pin-button {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 48px;
  height: 48px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.8);
  transition:
    transform 0.08s ease-out,
    box-shadow 0.08s ease-out,
    background 0.08s ease-out,
    border-color 0.08s ease-out;
}

.pin-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.9);
}

.pin-button.selected {
  background: radial-gradient(circle at top, #ef4444, #b91c1c);
  border-color: rgba(254, 202, 202, 0.9);
  color: #fef2f2;
  box-shadow:
    0 0 0 1px rgba(254, 242, 242, 0.8),
    0 0 16px rgba(239, 68, 68, 0.7);
}

.pin-button.fallen {
  background: rgba(31, 41, 55, 0.8);
  border-color: rgba(55, 65, 81, 0.9);
  color: #4b5563;
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

.pin-button.fallen:hover {
  transform: none;
  box-shadow: none;
}

.pin-controls {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pin-control-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ========================= */
/*   MOBILE LANDSCAPE TWEAK  */
/* ========================= */

@media (max-width: 900px) and (orientation: landscape) {
  .scoreboard-table {
    font-size: 1.05rem;
  }
  .frame-rolls {
    font-size: 0.95rem;
  }
  .frame-total {
    font-size: 1.25rem;
  }

  .game-title {
    font-size: 0.85rem;
    opacity: 0.7;
  }
}
