/* ==========================================================================
   RESET & ZMIENNE (DOMYŚLNY MOTYW CIEMNY)
   ========================================================================== */
:root {
  --bg-color: #0b0f19;
  --bg-gradient: linear-gradient(135deg, #0b0f19 0%, #1e1b4b 100%);
  
  --panel-bg: rgba(30, 41, 59, 0.45);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  
  --color-p1: #06b6d4;      /* Neon Cyan */
  --color-p1-glow: rgba(6, 182, 212, 0.3);
  --color-p2: #d946ef;      /* Neon Purple */
  --color-p2-glow: rgba(217, 70, 239, 0.3);
  
  --color-success: #10b981; /* Emerald Green */
  --color-danger: #ef4444;  /* Crimson Red */
  --color-warning: #f59e0b; /* Amber */
  --color-water: #1e293b;   /* Deep grey-blue */
  --color-water-glow: rgba(59, 130, 246, 0.15);
  
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  
  /* Rozmiar komórki w siatce */
  --cell-size: clamp(24px, 2.3vw, 34px);
  --mini-cell-size: clamp(10px, 1vw, 15px);
}

/* ==========================================================================
   MOTYW JASNY (LIGHT THEME OVERRIDES)
   ========================================================================== */
.omni-qg-shell.light-theme {
  --bg-color: #f1f5f9;
  --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
  
  --panel-bg: rgba(255, 255, 255, 0.65);
  --panel-border: rgba(15, 23, 42, 0.08);
  --panel-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.08);
  
  --text-primary: #0f172a;
  --text-muted: #475569;
  
  --color-water: #cbd5e1;
  --color-water-glow: rgba(59, 130, 246, 0.08);
  
  --color-p1: #0891b2;      
  --color-p2: #c084fc;      
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.omni-qg-shell {
  font-family: var(--font-body);
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  transition: background var(--transition-normal), color var(--transition-normal);
  position: relative;
  overflow-y: visible;
}

.omni-qg-shell--statki:fullscreen {
  width: 100vw;
  min-height: 100vh;
  overflow: auto;
  background: var(--bg-gradient);
}

.omni-qg-shell--statki {
  clear: both;
  float: none;
}

/* ==========================================================================
   STYLE GLOBALNE & UTILS
   ========================================================================== */
#app-container {
  background: #ffffff;
  width: 100%;
  min-height: 720px;
  height: auto;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#app-container:has(#view-game.active) {
  justify-content: flex-start;
}

/* Panel narzędziowy w prawym górnym rogu */
#top-controls {
  position: absolute;
  top: 2px;
  right: 20px;
  display: flex;
  gap: 7px;
  padding-top: 5px;
  z-index: 100;
}

.btn-utility {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 10px;
  height: 40px;
  min-height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  font-family: var(--font-title);
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-utility:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.light-theme .btn-utility {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.light-theme .btn-utility:hover {
  background: rgba(0, 0, 0, 0.08);
}

#btn-theme-toggle,
#btn-fullscreen {
  padding: 8px;
  width: 40px;
  height: 40px;
  min-height: 40px;
  background: #f8fafc;
  border-color: #dbe3ec;
  color: #334155;
}

#btn-theme-toggle:hover,
#btn-fullscreen:hover {
  background: #ffffff;
  color: #1f2937;
}

.light-theme #btn-theme-toggle,
.light-theme #btn-fullscreen {
  background: #f8fafc;
  border-color: #dbe3ec;
  color: #334155;
}

.light-theme #btn-theme-toggle:hover,
.light-theme #btn-fullscreen:hover {
  background: #ffffff;
  color: #1f2937;
}

/* Wyjście z gry */
.btn-quit {
  width: 111px;
  height: 40px;
  min-height: 40px;
  padding-left: 14px;
  padding-right: 14px;
  background: #ffffff;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 5px;
  color: #ef4444;
  align-items: center;
  line-height: 1;
  vertical-align: middle;
}

.btn-quit .icon {
  display: block;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}

.btn-quit:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
}
.light-theme .btn-quit {
  background: #ffffff;
  border-color: rgba(239, 68, 68, 0.2);
  color: #b91c1c;
}
.light-theme .btn-quit:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--panel-shadow);
  padding: 30px;
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.glass-subpanel {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 20px;
}

.light-theme .glass-subpanel {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Widoki gry */
.view {
  display: none;
  width: 100%;
  height: auto;
  max-width: 1600px;
  max-height: none;
  justify-content: center;
  align-items: flex-start;
}

.view.active {
  display: flex;
}

/* Animacje wejścia */
.animate-fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   PRZYCISKI
   ========================================================================== */
.btn {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  color: #fff;
  outline: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn .icon,
.btn .icon-small {
  display: block;
  flex: 0 0 auto;
}

.btn br,
.btn-utility br {
  display: none;
}

.btn-primary {
  background: #4f883d;
  border-bottom: 3px solid #3d6b2f;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(79, 136, 61, 0.32);
  filter: brightness(1.1);
}

.btn-secondary {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(148, 163, 184, 0.25);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  border-bottom: 3px solid #065f46;
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border-bottom: 3px solid #991b1b;
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3);
}

.btn-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.light-theme .btn-toggle {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
}

.btn-toggle.active {
  background: var(--color-p1);
  color: #fff;
  border-color: var(--color-p1);
  box-shadow: 0 0 10px var(--color-p1-glow);
}

.btn-large {
  font-size: 1.2rem;
  padding: 16px 36px;
}

.btn-small {
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 6px;
}

.btn-full {
  width: 100%;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
  border-bottom-width: 0;
}

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

.icon {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.icon-small {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ==========================================================================
   EKRAN 1: MENU GŁÓWNE
   ========================================================================== */
#view-menu {
  width: 100%;
}

.menu-card {
  width: 100%;
  max-width: 750px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.logo-text {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 4rem;
  letter-spacing: -2px;
  background: linear-gradient(135deg, #06b6d4 0%, #d946ef 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

.logo-text span {
  font-weight: 400;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.15rem;
  margin-top: -10px;
}

.config-section h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.fleet-size-selector {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  width: 100%;
  align-items: stretch;
  justify-content: center;
}

.btn-fleet {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 14px 10px;
  min-width: 0;
  min-height: 86px;
  flex: 1 1 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
  text-align: center;
}

.light-theme .btn-fleet {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.btn-fleet:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.light-theme .btn-fleet:hover {
  background: rgba(0, 0, 0, 0.05);
}

.btn-fleet.active {
  background: rgba(79, 136, 61, 0.15);
  border-color: #4f883d;
  color: #4f883d;
  box-shadow: 0 0 15px rgba(79, 136, 61, 0.22);
}

.light-theme .btn-fleet.active {
  background: rgba(79, 136, 61, 0.1);
  color: #4f883d;
  border-color: #4f883d;
}

.fleet-title {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.fleet-desc {
  font-size: 0.9rem;
  color: #334155;
  opacity: 0.9;
  overflow-wrap: anywhere;
}

.light-theme .fleet-desc {
  color: #334155;
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.instructions {
  text-align: left;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.instructions h4 {
  color: var(--text-primary);
  margin-bottom: 8px;
  font-family: var(--font-title);
}

.instructions ul {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (max-width: 760px) {
  .fleet-size-selector {
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .btn-fleet {
    min-height: 72px;
  }
}

/* ==========================================================================
   EKRAN 2: PANEL NAUCZYCIELA
   ========================================================================== */
.teacher-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 15px;
}

.light-theme .panel-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.panel-header h2 {
  font-family: var(--font-title);
  font-size: 1.8rem;
}

.teacher-content-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 20px;
  flex: 1;
  min-height: 0;
}

.form-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.form-group textarea, 
.form-group input[type="text"] {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 10px;
  font-family: var(--font-body);
  outline: none;
  font-size: 0.95rem;
}

.light-theme .form-group textarea,
.light-theme .form-group input[type="text"] {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #0f172a;
}

.form-group textarea {
  height: 80px;
  resize: none;
}

.form-group textarea:focus, 
.form-group input[type="text"]:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.25);
}

.answer-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.answer-input-row input[type="radio"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--color-success);
}

.answer-input-row input[type="text"] {
  flex: 1;
}

.questions-list-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 0;
}

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

.questions-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 5px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Pasek przewijania */
.questions-list::-webkit-scrollbar,
.questions-list-container::-webkit-scrollbar {
  width: 6px;
}
.questions-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}
.questions-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
.light-theme .questions-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
}
.questions-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.question-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
}

.light-theme .question-item {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.q-details {
  flex: 1;
}

.q-details p {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.q-details ol {
  padding-left: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.q-details ol li.correct {
  color: var(--color-success);
  font-weight: 600;
}

/* ==========================================================================
   EKRAN 3: ROZMIESZCZANIE STATKÓW
   ========================================================================== */
.placement-container {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding-left: 0;
  padding-right: 0;
}

.placement-container h2 {
  font-family: var(--font-title);
  font-size: 2rem;
}

.placement-player-badge {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 600;
  padding: 6px 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  margin-top: -5px;
}

.light-theme .placement-player-badge {
  background: rgba(0, 0, 0, 0.03);
}

.placement-player-badge.p1 {
  background: var(--color-p1-glow);
  color: var(--color-p1);
  border: 1px solid var(--color-p1);
}

.placement-player-badge.p2 {
  background: var(--color-p2-glow);
  color: var(--color-p2);
  border: 1px solid var(--color-p2);
}

.placement-workspace {
  display: flex;
  gap: 30px;
  width: 100%;
  margin-top: 10px;
}

.placement-board-wrapper {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.board-header {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.placement-helper {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 320px;
}

.placement-board-actions {
  width: min(320px, 100%);
  display: flex;
  margin-top: 4px;
}

.placement-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.placement-controls h3 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  padding-bottom: 5px;
}

.placement-controls > p {
  margin: 0;
  padding-bottom: 4px;
}

.ship-dock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 330px;
  overflow-y: visible;
  padding-right: 5px;
}

.ship-dock-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  padding: 7px 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.light-theme .ship-dock-item {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.ship-dock-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.light-theme .ship-dock-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.ship-dock-item.selected {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}
.light-theme .ship-dock-item.selected {
  background: rgba(59, 130, 246, 0.1);
  border-color: #1d4ed8;
}

.ship-dock-item.placed {
  opacity: 0.35;
  cursor: default;
}

.ship-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ship-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.ship-count {
  font-size: 14px;
  color: #1e252f;
}

.ship-visual-blocks {
  display: flex;
  gap: 3px;
}

.ship-visual-block {
  width: 14px;
  height: 14px;
  background: #64748b;
  border-radius: 2px;
}

.ship-dock-item.selected .ship-visual-block {
  background: #3b82f6;
}
.light-theme .ship-dock-item.selected .ship-visual-block {
  background: #1d4ed8;
}

.orientation-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.toggle-buttons {
  display: flex;
  gap: 4px;
}

.placement-actions {
  display: flex;
  flex-direction: column;
  gap: 0;
}

#btn-confirm-placement {
  margin-top: 0;
  padding-top: 12px;
  padding-bottom: 12px;
}

#btn-confirm-placement:not(:disabled) {
  animation: confirm-placement-ready 1.8s ease-in-out infinite;
}

@keyframes confirm-placement-ready {
  0%, 100% {
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.18);
    filter: brightness(1);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12), 0 10px 18px -6px rgba(16, 185, 129, 0.36);
    filter: brightness(1.05);
  }
}

@media (prefers-reduced-motion: reduce) {
  #btn-confirm-placement:not(:disabled) {
    animation: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
  }
}

/* ==========================================================================
   SIATKI DO GRY (11 x 11)
   ========================================================================== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(11, var(--cell-size));
  grid-template-rows: repeat(11, var(--cell-size));
  gap: 2px;
  background: rgba(15, 23, 42, 0.8);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
  width: max-content;
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.light-theme .game-grid {
  background: rgba(241, 245, 249, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

/* Podstawowa komórka */
.cell {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  position: relative;
  transition: all var(--transition-fast);
}

/* Komórka z etykietą A-J / 1-10 */
.cell-label {
  color: var(--text-muted);
  font-family: var(--font-title);
  opacity: 0.8;
  pointer-events: none;
}

/* Pusta komórka w rogu */
.cell-empty {
  pointer-events: none;
}

/* Wodne pole (do gry) */
.cell-water {
  background: var(--color-water);
  cursor: pointer;
}

.cell-water:hover {
  background: rgba(71, 85, 105, 0.8);
  transform: scale(1.05);
  box-shadow: 0 0 8px var(--color-water-glow);
  z-index: 2;
}

.light-theme .cell-water:hover {
  background: #94a3b8;
}

/* Statek w fazie układania / na mini-planszy */
.cell-ship {
  background: #64748b;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.light-theme .cell-ship {
  background: #94a3b8;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.p1-placed-ship {
  background: linear-gradient(135deg, #0e7490 0%, #0891b2 100%) !important;
  border-color: #22d3ee !important;
}

.p2-placed-ship {
  background: linear-gradient(135deg, #a21caf 0%, #c084fc 100%) !important;
  border-color: #f472b6 !important;
}

.mini-grid .cell-ship-sunk {
  background: linear-gradient(135deg, #7f1d1d 0%, #ef4444 100%) !important;
  border-color: #450a0a !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.mini-grid .cell-ship-sunk::after {
  content: "";
  width: 70%;
  height: 70%;
  background: #fef2f2;
  border-radius: 0;
  box-shadow: none;
  clip-path: polygon(15% 0%, 0% 15%, 35% 50%, 0% 85%, 15% 100%, 50% 65%, 85% 100%, 100% 85%, 65% 50%, 100% 15%, 85% 0%, 50% 35%);
}

/* Cień podświetlenia przy przeciąganiu statku */
.cell-hover-valid {
  background: rgba(16, 185, 129, 0.4) !important;
  border: 1px solid var(--color-success);
}

.cell-hover-invalid {
  background: rgba(239, 68, 68, 0.4) !important;
  border: 1px solid var(--color-danger);
}

/* Trafienie */
.cell-hit {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid var(--color-danger);
  cursor: not-allowed;
}

.cell-hit::after {
  content: "";
  width: 45%;
  height: 45%;
  background: var(--color-danger);
  border-radius: 3px;
  box-shadow: 0 0 10px var(--color-danger);
  animation: explode 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Zatopienie */
.cell-sunk {
  background: rgba(153, 27, 27, 0.5);
  border: 1px solid #7f1d1d;
  cursor: not-allowed;
}

.cell-sunk::after {
  content: "";
  width: 50%;
  height: 50%;
  background: #991b1b;
  border-radius: 50%;
  clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%);
  animation: explode 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Pudło */
.cell-miss {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  cursor: not-allowed;
}

.cell-miss::after {
  content: "";
  width: 25%;
  height: 25%;
  background: #3b82f6;
  border-radius: 50%;
  animation: splash 0.3s ease-out forwards;
}

/* Blokowanie strzelania (plansza nieaktywna) */
.disabled-grid {
  pointer-events: none;
  opacity: 0.7;
}

/* Podświetlenie aktywnej planszy, na której można strzelać */
.active-shooting-p1 {
  border-color: var(--color-p1) !important;
  box-shadow: 0 0 20px var(--color-p1-glow) !important;
  animation: pulse-border-p1 1.5s infinite;
}

.active-shooting-p2 {
  border-color: var(--color-p2) !important;
  box-shadow: 0 0 20px var(--color-p2-glow) !important;
  animation: pulse-border-p2 1.5s infinite;
}

@keyframes pulse-border-p1 {
  0% { box-shadow: 0 0 10px rgba(6, 182, 212, 0.2); }
  50% { box-shadow: 0 0 25px rgba(6, 182, 212, 0.5); }
  100% { box-shadow: 0 0 10px rgba(6, 182, 212, 0.2); }
}

@keyframes pulse-border-p2 {
  0% { box-shadow: 0 0 10px rgba(217, 70, 239, 0.2); }
  50% { box-shadow: 0 0 25px rgba(217, 70, 239, 0.5); }
  100% { box-shadow: 0 0 10px rgba(217, 70, 239, 0.2); }
}

/* ==========================================================================
   MINI-PLANSZA (PODGLĄD FLOTY) - 11 x 11
   ========================================================================== */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(11, var(--mini-cell-size));
  grid-template-rows: repeat(11, var(--mini-cell-size));
  gap: 1px;
  background: rgba(15, 23, 42, 0.8);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  width: max-content;
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.light-theme .mini-grid {
  background: rgba(241, 245, 249, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

.mini-grid .cell {
  border-radius: 1px;
}

.mini-grid .cell-label {
  font-size: 0.45rem;
}

.mini-grid .cell-hit::after {
  width: 40%;
  height: 40%;
}

.mini-grid .cell-miss::after {
  width: 25%;
  height: 25%;
}

/* ==========================================================================
   EKRAN 4: ROZGRYWKA (DWIE KOLUMNY 50 / 50)
   ========================================================================== */
#view-game {
  width: 100%;
  max-width: 100%;
  overflow-x: visible;
  justify-content: flex-start;
}

#view-game *,
#view-game *::before,
#view-game *::after {
  box-sizing: border-box;
}

.game-layout {
  --cell-size: clamp(24px, 2.1vw, 32px);
  --mini-cell-size: clamp(7px, 0.6vw, 9px);
  display: flex;
  flex-flow: row nowrap;
  gap: clamp(10px, 1vw, 14px);
  width: min(100%, 930px);
  height: auto;
  max-height: none;
  margin: 0;
  padding-top: 50px;
  align-items: start;
}

@media (max-width: 520px) {
  .game-layout {
    flex-direction: column;
    width: min(100%, 520px);
  }
  .player-panel {
    width: 100%;
    flex-basis: auto;
  }
}

.player-panel {
  min-width: 0;
  width: calc((100% - clamp(10px, 1vw, 14px)) / 2);
  flex: 0 0 calc((100% - clamp(10px, 1vw, 14px)) / 2);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  padding-left: 8px;
  padding-right: 8px;
  padding-top: clamp(10px, 1.2vw, 14px);
  padding-bottom: clamp(10px, 1.2vw, 14px);
  border-radius: 16px;
  border-width: 1px;
  transition: border-color var(--transition-normal);
}

.omni-qg-shell--statki:fullscreen #app-container,
.omni-qg-shell--statki:fullscreen #app-container:has(#view-game.active),
.omni-qg-shell--statki:-webkit-full-screen #app-container,
.omni-qg-shell--statki:-webkit-full-screen #app-container:has(#view-game.active) {
  justify-content: center;
  min-height: 100vh;
  padding: clamp(18px, 3vh, 36px) clamp(28px, 5vw, 80px);
}

.omni-qg-shell--statki:fullscreen #view-game,
.omni-qg-shell--statki:-webkit-full-screen #view-game {
  justify-content: center;
}

.omni-qg-shell--statki:fullscreen #top-controls,
.omni-qg-shell--statki:-webkit-full-screen #top-controls {
  position: fixed;
  top: 8px;
  right: 18px;
  padding-top: 0;
  z-index: 1000;
}

.omni-qg-shell--statki:fullscreen .game-layout,
.omni-qg-shell--statki:-webkit-full-screen .game-layout {
  --cell-size: clamp(27px, 2.1vw, 36px);
  --mini-cell-size: clamp(9px, 0.85vw, 13px);
  gap: clamp(18px, 2vw, 32px);
  margin: 0 auto;
  width: min(100%, 1420px);
}

.omni-qg-shell--statki:fullscreen .player-panel,
.omni-qg-shell--statki:-webkit-full-screen .player-panel {
  width: calc((100% - clamp(18px, 2vw, 32px)) / 2);
  flex-basis: calc((100% - clamp(18px, 2vw, 32px)) / 2);
  gap: 12px;
  padding: clamp(12px, 1.2vw, 18px);
}

.player1-theme {
  border-color: rgba(6, 182, 212, 0.2);
}
.player2-theme {
  border-color: rgba(217, 70, 239, 0.2);
}

/* Reorganizacja Nagłówka - informacje po lewej, podgląd floty po prawej */
.player-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 8px;
  padding-bottom: 8px;
}

.light-theme .player-header-bar {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.player-info-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-name {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: clamp(1.25rem, 1.8vw, 1.6rem);
  line-height: 1.1;
}

.player1-theme .player-name {
  color: var(--color-p1);
  text-shadow: 0 0 10px var(--color-p1-glow);
}

.player2-theme .player-name {
  color: var(--color-p2);
  text-shadow: 0 0 10px var(--color-p2-glow);
}

.player-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.score-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.light-theme .score-badge {
  background: rgba(0, 0, 0, 0.04);
}

/* Licznik Amunicji */
.ammo-badge {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  text-shadow: 0 0 5px rgba(245, 158, 11, 0.3);
}

.light-theme .ammo-badge {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.3);
  color: #b45309;
}

.ammo-label {
  flex: 0 0 auto;
}

.ammo-dots {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 72px;
  min-height: 8px;
}

.ammo-dot {
  background: #111827;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
  height: 8px;
  width: 8px;
}

/* Podgląd floty umieszczony na górze */
.mini-board-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  background: transparent;
  padding: 0;
  flex: 0 0 auto;
}

.mini-board-container span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  font-weight: 600;
  text-transform: uppercase;
}

.board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.game-layout .game-grid,
.game-layout .mini-grid {
  max-width: 100%;
}

.game-layout .game-grid .cell {
  border-radius: 5px;
  font-size: 0.86rem;
}

.game-layout .game-grid .cell-label {
  font-size: 0.86rem;
  font-weight: 700;
  opacity: 0.92;
}

.board-title {
  font-size: 0.86rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Panel Quizowy */
.quiz-panel {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.light-theme .quiz-panel {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
}

/* Pastelowe tla kart pytan dla motywu ciemnego (polprzezroczyste neony) */
.player1-theme .quiz-question-card {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: 8px;
  padding: 10px 15px;
  text-align: center;
}
.player2-theme .quiz-question-card {
  background: rgba(217, 70, 239, 0.12);
  border: 1px solid rgba(217, 70, 239, 0.25);
  border-radius: 8px;
  padding: 10px 15px;
  text-align: center;
}

/* Pastelowe tla kart pytan dla motywu jasnego (delikatne solidne pastele) */
.light-theme .player1-theme .quiz-question-card {
  background: #e0f2fe; /* pastelowy blekit */
  border: 1px solid #bae6fd;
}
.light-theme .player2-theme .quiz-question-card {
  background: #fae8ff; /* pastelowy fiolet/roz */
  border: 1px solid #f5d0fe;
}

.question-text-small {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: min(1.15rem, 2.3vh);
  line-height: 1.4;
  color: var(--text-primary);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-quiz {
  padding: 8px 10px;
  font-size: 0.85rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  justify-content: flex-start;
  text-align: left;
  gap: 8px;
  height: 40px;
  overflow: hidden;
  box-shadow: none;
  font-family: var(--font-body);
  color: var(--text-primary);
}

.light-theme .btn-quiz {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #0f172a;
}

.btn-quiz span {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-title);
  flex-shrink: 0;
}

.light-theme .btn-quiz span {
  background: rgba(0, 0, 0, 0.06);
  color: #0f172a;
}

.btn-quiz .text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-quiz:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.light-theme .btn-quiz:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.2);
}

.player1-theme .btn-quiz:hover:not(:disabled) {
  border-color: var(--color-p1);
}
.player2-theme .btn-quiz:hover:not(:disabled) {
  border-color: var(--color-p2);
}

/* Kolory odpowiedzi */
.btn-quiz.correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: var(--color-success) !important;
  color: #a7f3d0 !important;
}
.light-theme .btn-quiz.correct {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #065f46 !important;
}
.btn-quiz.correct span {
  background: var(--color-success) !important;
  color: #fff !important;
}

.btn-quiz.incorrect {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: var(--color-danger) !important;
  color: #fecdd3 !important;
}
.light-theme .btn-quiz.incorrect {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #991b1b !important;
}
.btn-quiz.incorrect span {
  background: var(--color-danger) !important;
  color: #fff !important;
}

.player-turn-status {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 5px;
  border-radius: 6px;
  background: rgba(0,0,0,0.15);
  margin-top: 2px;
}

.light-theme .player-turn-status {
  background: rgba(0, 0, 0, 0.04);
}

.player-turn-status.status-ready {
  color: var(--color-success);
  background: rgba(16, 185, 129, 0.1);
}

.player-turn-status.status-error {
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.1);
}

.player-turn-status.status-waiting-shot {
  animation: text-pulse 1s infinite alternate;
  color: #f59e0b;
}

/* ==========================================================================
   EKRAN 5: KONIEC GRY (GAMEOVER VIEW)
   ========================================================================== */
.gameover-card {
  width: 100%;
  max-width: 800px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.winner-banner {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 2.5rem;
  padding: 15px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 2px solid var(--color-success);
  color: #34d399;
  text-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
  animation: pulse-green 2s infinite;
}

.light-theme .winner-banner {
  color: #047857;
  background: rgba(16, 185, 129, 0.08);
}

@keyframes pulse-green {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.stats-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.player-stat-card {
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.light-theme .player-stat-card {
  border-color: rgba(0, 0, 0, 0.08);
}

.player-stat-card h3 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.p1-stat {
  background: rgba(6, 182, 212, 0.05);
  border-color: rgba(6, 182, 212, 0.15);
}
.p1-stat h3 { color: var(--color-p1); }

.p2-stat {
  background: rgba(217, 70, 239, 0.05);
  border-color: rgba(217, 70, 239, 0.15);
}
.p2-stat h3 { color: var(--color-p2); }

.player-stat-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.player-stat-card strong {
  color: var(--text-primary);
  float: right;
}

/* ==========================================================================
   RESPONSYWNOŚĆ DLA RÓŻNYCH EKRANÓW (WHITEBOARD FOCUS)
   ========================================================================== */
@media (max-height: 750px) {
  :root {
    --cell-size: 26px;
    --mini-cell-size: 12px;
  }
  .game-layout {
    --cell-size: clamp(17px, 1.55vw, 24px);
    --mini-cell-size: clamp(8px, 0.7vw, 11px);
  }
  .ship-dock {
    max-height: 260px;
    overflow-y: auto;
  }
  .game-layout {
    gap: 10px;
  }
  .player-panel {
    padding: 12px 10px;
    gap: 8px;
  }
  .quiz-panel {
    padding: 8px;
    gap: 5px;
  }
  .btn-quiz {
    height: 38px;
    padding: 6px 10px;
    font-size: 0.75rem;
  }
  .btn-quiz span {
    width: 20px;
    height: 20px;
    font-size: 0.8rem;
  }
}
