/* ==========================================================================
   DART MASTER - Modern Mobile-First Stylesheet (Optimized for Phones)
   ========================================================================== */

:root {
  --bg-primary: #090d16;
  --bg-surface: #111827;
  --bg-card: #1e293b;
  --bg-card-hover: #27354a;
  --border-color: #334155;
  --border-highlight: #475569;

  --color-green: #10b981;
  --color-green-dark: #059669;
  --color-red: #ef4444;
  --color-red-dark: #dc2626;
  --color-gold: #f59e0b;
  --color-blue: #3b82f6;
  --color-cyan: #06b6d4;
  --color-purple: #8b5cf6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Top Header Bar
   ========================================================================== */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  height: 52px;
  flex-shrink: 0;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.logo-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.logo-text {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #10b981 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.game-mode-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-green);
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.9);
  background-color: var(--bg-card-hover);
}

.icon-btn.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--color-green);
  color: var(--color-green);
}

.undo-header-btn {
  background: rgba(245, 158, 11, 0.2) !important;
  border-color: var(--color-gold) !important;
  color: var(--color-gold) !important;
  font-weight: 900 !important;
}

.correct-header-btn {
  background: rgba(6, 182, 212, 0.2) !important;
  border-color: var(--color-cyan) !important;
  color: var(--color-cyan) !important;
}

@media (max-width: 480px) {
  .logo-text {
    display: none;
  }
  .top-header {
    padding: 6px 8px;
  }
  .header-actions {
    gap: 4px;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }
  .game-mode-badge {
    font-size: 0.65rem;
    padding: 2px 5px;
  }
}

@media (max-height: 720px) {
  .top-header {
    height: 44px;
    padding: 4px 8px;
  }
  .scoreboard-container {
    padding: 4px 8px 2px;
  }
  .player-card {
    padding: 4px 6px;
  }
  .player-score-large {
    font-size: 1.55rem;
  }
  .hint-banner {
    min-height: 32px;
    padding: 3px 8px;
  }
  .turn-bar {
    padding: 3px 8px;
  }
  .input-tabs {
    min-height: 32px;
  }
  .input-tab {
    padding: 5px 3px;
    font-size: 0.72rem;
  }
  .bottom-bar {
    padding: 6px 8px;
    padding-bottom: max(6px, env(safe-area-inset-bottom, 8px));
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .top-header {
    height: 38px;
    padding: 2px 8px;
  }
  .scoreboard-container {
    padding: 2px 6px;
  }
  .player-card {
    padding: 2px 6px;
  }
  .player-score-large {
    font-size: 1.3rem;
  }
  .hint-banner {
    min-height: 28px;
    padding: 2px 6px;
  }
  .turn-bar {
    padding: 2px 6px;
  }
  .bottom-bar {
    padding: 4px 8px;
  }
}

/* ==========================================================================
   Main App Container & View Management
   ========================================================================== */
#app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  max-width: 768px;
  margin: 0 auto;
  width: 100%;
  overflow: hidden;
}

.view-section {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  width: 100%;
}

.view-section.active {
  display: flex;
}

#view-game {
  overflow: hidden;
  height: 100%;
  max-height: 100%;
}

#view-setup, #view-history {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Scoreboard & Players Carousel
   ========================================================================== */
.scoreboard-container {
  padding: 8px 10px 4px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.players-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.players-scroll::-webkit-scrollbar {
  display: none;
}

.player-card {
  flex: 1 1 0;
  min-width: 120px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 8px;
  position: relative;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  flex-shrink: 0;
}

.player-card:active {
  transform: scale(0.98);
}

.player-card.active-turn {
  border-color: var(--color-green);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.18) 0%, var(--bg-card) 100%);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
}

/* Dostosowanie kart zależnie od liczby graczy w meczu */
.players-scroll.players-count-1 .player-card,
.players-scroll.players-count-2 .player-card {
  flex: 1 1 0;
  min-width: 135px;
}

.players-scroll.players-count-3 .player-card {
  flex: 1 0 115px;
  min-width: 115px;
}

.players-scroll.players-count-many .player-card {
  flex: 0 0 138px;
  min-width: 138px;
  max-width: 155px;
}

.player-card.eliminated {
  opacity: 0.35;
  filter: grayscale(1);
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 2px;
}

.player-name-group {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

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

.player-name {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-legs {
  font-size: 0.68rem;
  font-weight: 700;
  color: #34d399;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
}

.player-score-large {
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1.1;
  text-align: center;
  color: var(--text-main);
  margin: 1px 0;
  font-family: var(--font-mono);
}

.player-card.active-turn .player-score-large {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.player-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-dim);
  font-weight: 600;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 2px;
  margin-top: 2px;
  gap: 4px;
}

.player-subinfo {
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.last-round-val {
  color: var(--color-gold) !important;
  font-family: var(--font-mono);
}

.last-bust-val {
  color: var(--color-red) !important;
  font-family: var(--font-mono);
  font-weight: 800;
}

.last-180-val {
  color: #fbbf24 !important;
  font-family: var(--font-mono);
  font-weight: 800;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.last-darts-detail {
  font-size: 0.58rem;
  color: #38bdf8;
  font-weight: 700;
  margin-left: 2px;
  font-family: var(--font-mono);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

/* ==========================================================================
   Cricket Scoreboard Table
   ========================================================================== */
.cricket-table-wrap {
  margin-top: 6px;
  overflow-x: auto;
}

.cricket-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: center;
}

.cricket-table th, .cricket-table td {
  padding: 4px 5px;
  border: 1px solid var(--border-color);
}

.cricket-table th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.7rem;
}

.cricket-target-col {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 800;
  color: var(--color-gold);
  width: 40px;
}

.cricket-mark {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}

.cricket-mark.closed {
  color: var(--color-green);
}

/* ==========================================================================
   Checkout Banner & Dynamic Tips
   ========================================================================== */
.hint-banner {
  background: linear-gradient(90deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  gap: 6px;
  flex-shrink: 0;
}

.hint-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.hint-path {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.checkout-pill {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid var(--color-green);
  font-weight: 800;
  font-size: 0.78rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

.checkout-arrow {
  color: var(--text-dim);
  font-size: 0.65rem;
}

.btn-toggle-outmode {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #34d399;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  margin-left: auto;
}

.btn-toggle-outmode:active {
  transform: scale(0.95);
  background: rgba(16, 185, 129, 0.35);
}

/* Baner tury bota (AI) */
.bot-turn-banner {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.22) 0%, rgba(59, 130, 246, 0.22) 100%);
  border-bottom: 1px solid rgba(139, 92, 246, 0.4);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  flex-shrink: 0;
  animation: botBannerGlow 2s ease-in-out infinite alternate;
}

@keyframes botBannerGlow {
  0% { background-color: rgba(139, 92, 246, 0.12); }
  100% { background-color: rgba(139, 92, 246, 0.28); }
}

.bot-turn-icon {
  font-size: 1.4rem;
  animation: botPulse 1s ease-in-out infinite;
}

@keyframes botPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

.bot-turn-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.bot-turn-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #c4b5fd;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bot-turn-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.bot-segment-hit {
  fill: #f59e0b !important;
  filter: drop-shadow(0 0 14px #f59e0b) brightness(1.7) !important;
  transition: all 0.12s ease-out !important;
}

/* ==========================================================================
   Turn Status & Current Darts Bar (with Direct Undo & Edit)
   ========================================================================== */
.turn-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.turn-darts-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dart-slot {
  width: 38px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1.5px dashed var(--border-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-dim);
  transition: all 0.15s ease;
}

.dart-slot.filled {
  border-style: solid;
  border-color: var(--color-green);
  background: rgba(16, 185, 129, 0.15);
  color: #ffffff;
  animation: slotPop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dart-slot.bust {
  border-color: var(--color-red);
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-red);
}

/* Przyciski podręczne w pasku tury */
.turn-action-pill {
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 800;
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s ease;
}

.btn-turn-undo {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.btn-turn-undo:active {
  transform: scale(0.92);
  background: var(--color-gold);
  color: #000;
}

.btn-turn-correct {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--color-cyan);
  color: var(--color-cyan);
}

.btn-turn-correct:active {
  transform: scale(0.92);
  background: var(--color-cyan);
  color: #000;
}

.turn-sum-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.turn-sum-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

.turn-sum-val {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--color-gold);
  font-family: var(--font-mono);
  line-height: 1;
}

/* ==========================================================================
   Input Controls Tabs (Tarcza, Kalkulator sumy, Segmenty)
   ========================================================================== */
.input-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.input-tab {
  flex: 1;
  padding: 8px 4px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.input-tab.active {
  color: var(--color-green);
  border-bottom-color: var(--color-green);
  background: rgba(16, 185, 129, 0.08);
  font-weight: 800;
}

.tab-content {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  overflow-y: auto;
}

.tab-content.active {
  display: flex;
}

#tab-dartboard {
  overflow: hidden;
  padding: 4px;
  width: 100%;
  height: 100%;
  position: relative;
}

/* ==========================================================================
   Interactive SVG Dartboard (Automatyczne dopasowanie do ekranu bez scrollowania)
   ========================================================================== */
.dartboard-wrap {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: auto;
}

.dartboard-svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.75));
  touch-action: none;
  display: block;
}

.dartboard-svg path {
  cursor: pointer;
  transition: opacity 0.1s ease, filter 0.1s ease;
}

.dartboard-svg path:active, .dartboard-svg circle:active {
  filter: brightness(1.7) drop-shadow(0 0 8px #ffffff);
}

/* ==========================================================================
   Calculator Numpad Tab (0-9 with Backspace & Clear)
   ========================================================================== */
.calc-container {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: auto;
}

.calc-display-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.calc-label-hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
}

.calc-display-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.calc-display-val {
  font-size: 2rem;
  font-weight: 900;
  color: var(--color-gold);
  font-family: var(--font-mono);
  letter-spacing: -1px;
}

.calc-btn-backspace {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--color-red);
  color: var(--color-red);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.12s ease;
}

.calc-btn-backspace:active {
  background: var(--color-red);
  color: #fff;
  transform: scale(0.92);
}

.calc-btn-clear {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.calc-key {
  height: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
}

.calc-key:active {
  transform: scale(0.92);
  background-color: var(--bg-card-hover);
}

.calc-key-zero {
  grid-column: span 1;
}

.calc-key-submit {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--color-green) 0%, var(--color-green-dark) 100%);
  color: #ffffff;
  border: none;
  font-size: 0.95rem;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.calc-key-submit:active {
  transform: scale(0.95);
  filter: brightness(0.9);
}

/* ==========================================================================
   Segments Keypad Tab (1-20, Bull, D/T)
   ========================================================================== */
.keypad-container {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: auto;
}

.modifier-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
}

.mod-btn {
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 800;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: center;
}

.mod-btn:active {
  transform: scale(0.95);
}

.mod-btn.active {
  background: var(--color-green);
  color: #000000;
  border-color: var(--color-green);
}

.mod-btn.double-mod.active {
  background: var(--color-blue);
  color: #ffffff;
  border-color: var(--color-blue);
}

.mod-btn.triple-mod.active {
  background: var(--color-red);
  color: #ffffff;
  border-color: var(--color-red);
}

.numbers-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.num-btn {
  height: 42px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 800;
  font-family: var(--font-mono);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
}

.num-btn:active {
  transform: scale(0.92);
  background-color: var(--bg-card-hover);
}

.num-btn.bull-btn {
  grid-column: span 2;
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.num-btn.miss-btn {
  grid-column: span 3;
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--color-red);
  color: var(--color-red);
}

/* Szybkie punkty dla X01 (26, 41, 45, 60, 81, 100, 140, 180) */
.quick-scores-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 4px 0 2px 0;
  width: 100%;
}

.quick-chip {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 800;
  font-family: var(--font-mono);
  cursor: pointer;
  text-align: center;
  transition: all 0.12s ease;
  user-select: none;
}

.quick-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-color-light);
}

.quick-chip:active {
  background: var(--bg-card-hover);
  color: #ffffff;
  transform: scale(0.96);
}

.quick-chip.chip-180 {
  border-color: var(--color-gold);
  color: var(--color-gold);
  background: rgba(245, 158, 11, 0.15);
  font-weight: 900;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.quick-chip.chip-180:active {
  background: var(--color-gold);
  color: #000;
}

/* ==========================================================================
   Bottom Action Bar (Undo, Correct, Submit)
   ========================================================================== */
.bottom-bar {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1.3fr;
  gap: 8px;
  padding: 8px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 12px));
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  position: sticky;
  bottom: 0;
  z-index: 40;
  flex-shrink: 0;
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 8px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.btn-secondary:active {
  transform: scale(0.96);
  background-color: var(--bg-card-hover);
}

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

.btn-undo-bottom {
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--color-gold);
  color: var(--color-gold);
}

.btn-correct-bottom {
  background: rgba(6, 182, 212, 0.12);
  border-color: var(--color-cyan);
  color: var(--color-cyan);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-green) 0%, var(--color-green-dark) 100%);
  border: none;
  color: #ffffff;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.3);
  transition: all 0.12s ease;
  white-space: nowrap;
}

.btn-primary:active {
  transform: scale(0.96);
  filter: brightness(0.9);
}

/* ==========================================================================
   New Game Setup View
   ========================================================================== */
.setup-container {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.section-title {
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.modes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 520px) {
  .modes-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.mode-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.mode-card:active {
  transform: scale(0.97);
}

.mode-card.selected {
  border-color: var(--color-green);
  background: rgba(16, 185, 129, 0.12);
  box-shadow: var(--shadow-glow);
}

.mode-icon {
  font-size: 1.6rem;
}

.mode-name {
  font-size: 0.9rem;
  font-weight: 800;
}

.mode-desc {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.2;
}

.settings-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.setting-custom-row {
  background: rgba(16, 185, 129, 0.05);
  border: 1px dashed rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.custom-score-input {
  width: 90px;
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.05rem;
  text-align: center;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  color: var(--color-green);
}

.custom-score-input:focus {
  border-color: var(--color-green);
  outline: none;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.custom-score-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  align-items: center;
}

.score-chip-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
}

.score-chip-btn:hover {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: var(--color-green);
}

.score-chip-btn.active {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border-color: var(--color-green);
  font-weight: 800;
}

.setting-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.setting-divider {
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.setup-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 4px;
}

.setup-main-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.setting-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.segmented-control {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.segment-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.segment-btn.active {
  background: var(--color-green);
  color: #000000;
  font-weight: 800;
}

.player-select-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.player-select-item.selected {
  border-color: var(--color-green);
  background: rgba(16, 185, 129, 0.08);
}

.player-info-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-dot-large {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.player-name-title {
  font-size: 0.9rem;
  font-weight: 700;
}

.player-reorder-btns {
  display: flex;
  gap: 4px;
}

.small-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
}

.add-player-box {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.text-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  outline: none;
}

.text-input:focus {
  border-color: var(--color-green);
}

.color-picker-input {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
}

/* Przycisk i panel wyboru bota AI */
.btn-bot-toggle {
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(139, 92, 246, 0.55);
  color: #c4b5fd;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-bot-toggle:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: #a78bfa;
}

.btn-bot-toggle:active {
  transform: scale(0.97);
}

.bot-panel-card {
  background: linear-gradient(145deg, #182030, #131b2c);
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  animation: fadeInDown 0.2s ease-out;
}

.bot-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bot-panel-title {
  font-weight: 800;
  font-size: 0.92rem;
  color: #c4b5fd;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bot-panel-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bot-levels-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (max-width: 480px) {
  .bot-levels-grid {
    grid-template-columns: 1fr;
  }
}

.bot-level-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bot-level-card:hover {
  border-color: rgba(139, 92, 246, 0.6);
  background: rgba(139, 92, 246, 0.08);
}

.bot-level-card.selected {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.18);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.35);
}

.bot-level-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bot-level-tag {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.tag-easy {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.tag-medium {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.tag-hard {
  background: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.45);
}

.tag-pro {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.bot-level-avg {
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.bot-level-info {
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.25;
}

.bot-form-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}

/* Plakietki bota na liście graczy i tablicy wyników */
.bot-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

.bot-badge-easy {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.bot-badge-medium {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.bot-badge-hard {
  background: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.45);
}

.bot-badge-pro {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   Modals (Victory, Stats, QR Code, Score Correction)
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #ffffff;
  border-radius: var(--radius-lg);
  margin: 8px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.qr-code-img,
.qr-code-svg {
  width: 210px;
  height: 210px;
  max-width: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

.qr-url-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  word-break: break-all;
  text-align: center;
}

.victory-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.trophy-icon {
  font-size: 3.5rem;
  animation: bounce 1s infinite alternate;
}

.victory-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--color-gold);
}

.victory-winner-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.btn-danger-outline {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #f87171;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ffffff;
}

.btn-danger-outline:active {
  transform: scale(0.97);
}

.btn-card-delete {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  opacity: 0.65;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-card-delete:hover {
  opacity: 1;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.18);
  transform: scale(1.1);
}

.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.history-card:hover {
  border-color: var(--color-green);
  background: rgba(16, 185, 129, 0.05);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.history-card:active {
  transform: translateY(0);
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
}

.history-mode-pill {
  font-weight: 700;
  color: var(--color-green);
  background: rgba(16, 185, 129, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.history-matchup {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-player-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
}

.history-player-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.history-player-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.history-player-score {
  font-family: var(--font-mono);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-winner-tag {
  background: rgba(245, 158, 11, 0.2);
  color: var(--color-gold);
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 800;
}

.history-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  padding-top: 6px;
  margin-top: 2px;
}

.history-inspect-btn {
  color: var(--color-cyan);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-card:hover .history-inspect-btn {
  color: #38bdf8;
  text-decoration: underline;
}

/* ==========================================================================
   Match Details Modal Styles
   ========================================================================== */
.match-details-modal-content {
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  gap: 12px;
}

.md-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.md-matchup-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.md-player-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}

.md-player-card.winner {
  border-color: var(--color-green);
  background: rgba(16, 185, 129, 0.08);
}

.md-player-name {
  font-size: 0.88rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.md-stat-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.md-stat-line b {
  color: var(--text-main);
  font-family: var(--font-mono);
}

.md-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.md-filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.md-filter-tabs {
  flex-wrap: wrap;
}

.md-rounds-container {
  overflow-y: auto;
  max-height: 48vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.md-rounds-container::-webkit-scrollbar {
  width: 6px;
}

.md-rounds-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.md-round-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: border-color 0.15s ease;
}

.md-round-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.md-round-card.bust {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.04);
}

.md-round-card.win {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.08);
}

.md-round-card.is-180 {
  border-color: rgba(245, 158, 11, 0.6);
  background: rgba(245, 158, 11, 0.08);
}

.md-round-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.md-round-num {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--text-dim);
  min-width: 30px;
  flex-shrink: 0;
}

.md-round-player {
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 70px;
  max-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.md-darts-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.dart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.dart-badge-single {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
}

.dart-badge-double {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.dart-badge-triple {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.dart-badge-bull {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.dart-badge-miss {
  background: rgba(100, 116, 139, 0.18);
  color: #94a3b8;
  border: 1px dashed #475569;
}

.md-round-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 75px;
  flex-shrink: 0;
}

.md-round-score {
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--color-green);
}

.md-round-score.bust {
  color: #ef4444;
  font-size: 0.75rem;
}

.md-round-rem {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

@keyframes slotPop {
  0% { transform: scale(0.7); }
  100% { transform: scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

/* ==========================================================================
   PWA Installation Banner & Guide
   ========================================================================== */
.pwa-install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(90deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 2px solid var(--color-green);
  padding: 8px 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  z-index: 45;
  animation: fadeIn 0.3s ease;
}

.pwa-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwa-banner-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.pwa-banner-texts {
  display: flex;
  flex-direction: column;
}

.pwa-banner-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #ffffff;
}

.pwa-banner-sub {
  font-size: 0.7rem;
  color: var(--color-green);
  font-weight: 600;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-btn-install {
  padding: 6px 12px !important;
  font-size: 0.8rem !important;
  border-radius: var(--radius-full) !important;
}

.pwa-btn-dismiss {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.install-header-btn {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: var(--color-green) !important;
  color: var(--color-green) !important;
}

.fullscreen-header-btn {
  color: var(--text-main) !important;
}

.android-steps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0;
}

.android-step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-card);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.step-num {
  width: 26px;
  height: 26px;
  background: var(--color-green);
  color: #000000;
  border-radius: 50%;
  font-weight: 900;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-desc {
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--text-main);
}

/* ==========================================================================
   Gra Online / Pokoje Wieloosobowe (Multiplayer Rooms)
   ========================================================================== */
.room-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--color-green);
  color: var(--color-green);
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s ease;
}

.room-pill-btn:active {
  transform: scale(0.95);
  background: var(--color-green);
  color: #000;
}

.online-live-dot {
  width: 8px;
  height: 8px;
  background: var(--color-green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--color-green);
  animation: pulse-dot 1.8s infinite;
}

.online-pulse-dot {
  width: 10px;
  height: 10px;
  background: var(--color-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-green);
  display: inline-block;
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.online-room-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.online-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.online-active-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
}

.online-active-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.online-code-pill {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--color-green);
  background: var(--bg-surface);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.online-player-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.online-player-select:focus {
  border-color: var(--color-green);
}

.room-code-input {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 4px;
  text-align: center;
  text-transform: uppercase;
  color: var(--color-gold);
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  width: 200px;
  outline: none;
  transition: border-color 0.15s ease;
}

.room-code-input:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.room-code-big {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: var(--color-gold);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 16px;
  display: inline-block;
  margin-top: 4px;
}

/* Baner tury w grze online */
.online-turn-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.online-turn-banner.my-turn {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--color-green);
}

.online-turn-banner.opponent-turn {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.online-turn-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.online-turn-content {
  flex: 1;
}

.online-turn-title {
  font-size: 0.88rem;
  font-weight: 800;
}

.online-turn-banner.my-turn .online-turn-title {
  color: var(--color-green);
}

.online-turn-banner.opponent-turn .online-turn-title {
  color: #60a5fa;
}

.online-turn-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-unlock-online {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 5px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.btn-unlock-online:hover {
  color: var(--text-main);
}
