:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-border: rgba(255, 255, 255, 0.08);

  --p1-color: #3b82f6;
  --p1-glow: rgba(59, 130, 246, 0.35);
  --p1-bg: rgba(59, 130, 246, 0.15);

  --p2-color: #ef4444;
  --p2-glow: rgba(239, 68, 68, 0.35);
  --p2-bg: rgba(239, 68, 68, 0.15);

  --star-gold: #f59e0b;
  --star-glow: rgba(245, 158, 11, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;

  --cell-size: 54px;
  --grid-gap: 6px;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(239, 68, 68, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.lobby-card, .waiting-card {
  max-width: 480px;
  margin: 0 auto;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: 16px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

/* Views */
.view-section {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

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

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

/* ---------------- LOBBY VIEW ---------------- */
.lobby-card {
  width: 100%;
  padding: 24px;
}

.lobby-header {
  text-align: center;
  margin-bottom: 24px;
}

.logo-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  background: rgba(139, 92, 246, 0.15);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.lobby-title {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lobby-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.mode-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

.mode-card.selected {
  background: rgba(139, 92, 246, 0.12);
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.25);
}

.mode-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.mode-card-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.mode-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
}

.mode-badge.highlight {
  background: var(--accent);
  color: #fff;
}

.mode-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Mod 1 Alt Ayarı (Geri Alınabilirlik) */
.mode-sub-setting {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.mode-card.selected .mode-sub-setting {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.35);
}

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

.sub-setting-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sub-setting-title::before {
  content: '⚙️';
  font-size: 0.8rem;
}

.mode-sub-setting .toggle-control {
  padding-top: 0;
  cursor: pointer;
}

.sub-setting-desc {
  font-size: 0.73rem !important;
  color: var(--text-muted) !important;
  margin: 0 !important;
  line-height: 1.35;
}

.mode-card.selected .sub-setting-desc {
  color: #cbd5e1 !important;
}

.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.flex-1 { flex: 1; }

.pill-group {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid var(--bg-card-border);
}

.pill-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

/* Switch Toggle */
.toggle-control {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding-top: 6px;
}

.toggle-control input {
  display: none;
}

.toggle-slider {
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  position: relative;
  transition: background 0.3s ease;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.3s ease;
}

.toggle-control input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-control input:checked + .toggle-slider::after {
  transform: translateX(20px);
}

.toggle-text {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Play Type Tabs */
.play-type-section {
  border-top: 1px solid var(--bg-card-border);
  padding-top: 16px;
}

.play-type-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--bg-card-border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.tab-content {
  display: none;
}

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

.tab-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-align: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-accent {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--bg-card-border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.btn-ghost-sm {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--bg-card-border);
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--bg-card-border);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Online Split */
.online-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.online-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  margin: 4px 0;
}

.online-divider::before, .online-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--bg-card-border);
}

.online-divider span {
  padding: 0 10px;
}

.join-input-wrap {
  display: flex;
  gap: 8px;
}

.join-input-wrap input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--bg-card-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.join-input-wrap input:focus {
  outline: none;
  border-color: var(--accent);
}

.error-msg {
  color: #ef4444;
  font-size: 0.8rem;
  margin-top: 6px;
  text-align: center;
  min-height: 16px;
}

/* ---------------- WAITING VIEW ---------------- */
.waiting-card {
  padding: 36px 24px;
  width: 100%;
}

.spinner-pulse {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 auto 20px;
  animation: pulseScale 1.5s infinite ease-in-out;
}

@keyframes pulseScale {
  0% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 25px var(--accent); }
  100% { transform: scale(0.85); opacity: 0.5; }
}

.room-code-display {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px dashed var(--accent);
  border-radius: 12px;
  padding: 10px 20px;
  margin: 18px 0 8px;
}

.code-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: #fff;
}

.copy-status-text {
  font-size: 0.8rem;
  color: #10b981;
  min-height: 18px;
  margin-bottom: 20px;
}

.waiting-player-status {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 12px;
}

.player-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.green { background: #10b981; }
.dot.pulse { background: #eab308; animation: pulseScale 1s infinite; }

/* ---------------- GAME VIEW ---------------- */
#game-view {
  width: 100%;
  gap: 14px;
}

.game-main-content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 24px;
  width: 100%;
}

.board-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  max-width: 400px;
  min-width: 290px;
}

.game-info-hint {
  padding: 12px 16px;
  border-radius: 14px;
}

.hint-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  margin-bottom: 4px;
}

#game-hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.game-header {
  width: 100%;
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
  margin-right: 4px;
}

.match-timer-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid var(--bg-card-border);
}

/* Scoreboard */
.scoreboard-bar {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Player Identity Badges & Meta */
.player-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-identity-pill {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.player-identity-pill.pill-me {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.player-identity-pill.pill-opponent {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
}

.player-identity-pill.pill-neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.identity-header-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Card Styling: Tamed Glows & Clear Hierarchy */
.player-card {
  width: 100%;
  background: var(--bg-card);
  border: 2px solid var(--bg-card-border);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Local player card indicator */
.player-card.is-me {
  border-left: 5px solid #10b981 !important;
}

.player-card.is-opponent {
  border-left: 2px solid var(--bg-card-border);
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Active Player Card */
.player-card.active-turn {
  opacity: 1 !important;
  filter: none !important;
  transform: translateY(-2px);
}

.p1-card.active-turn {
  border-color: var(--p1-color);
  box-shadow: 0 0 18px var(--p1-glow);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), var(--bg-card));
}

.p2-card.active-turn {
  border-color: var(--p2-color);
  box-shadow: 0 0 18px var(--p2-glow);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), var(--bg-card));
}

/* Inactive player card is noticeably dimmed to avoid "both players glowing" */
.player-card:not(.active-turn) {
  opacity: 0.42;
  filter: saturate(0.65);
  box-shadow: none !important;
}

.player-card:not(.active-turn) .player-turn-area {
  opacity: 0.25;
  filter: grayscale(0.85);
}

/* Per-Player Turn Area (Dice + 10s Timer inside Card) */
.player-turn-area {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 8px 12px;
  transition: all 0.3s ease;
}

.player-dice-slot {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  flex-shrink: 0;
}

.player-card.active-turn .player-dice-slot {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
}

.player-timer-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}

.turn-status-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.p1-card.active-turn .turn-status-label {
  color: #93c5fd;
}

.p2-card.active-turn .turn-status-label {
  color: #fca5a5;
}

.timer-sec {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.player-card.active-turn .timer-sec {
  color: #fff;
}

.player-timer-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.player-timer-fill {
  height: 100%;
  width: 100%;
  border-radius: 4px;
  transition: width 1s linear, background-color 0.3s ease;
}

.p1-timer-fill {
  background: linear-gradient(90deg, #10b981, #3b82f6);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.p2-timer-fill {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.player-timer-fill.warning {
  background: #ef4444 !important;
  animation: timerPulse 0.5s infinite alternate;
}

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

.player-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
}

.p1-avatar { background: var(--p1-color); }
.p2-avatar { background: var(--p2-color); }

.player-meta {
  display: flex;
  flex-direction: column;
}

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

.player-role-badge {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.conquest-stat {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 800;
}

.p1-card .stat-value { color: var(--p1-color); }
.p2-card .stat-value { color: var(--p2-color); }
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.turn-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #10b981, #3b82f6);
  border-radius: 4px;
  transition: width 1s linear, background-color 0.3s ease;
}

.turn-progress-fill.warning {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  animation: timerPulse 0.5s infinite alternate;
}

@keyframes timerPulse {
  from { opacity: 0.7; }
  to { opacity: 1; box-shadow: 0 0 10px #ef4444; }
}

.turn-timer-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 32px;
  text-align: right;
}

/* ---------------- BOARD GRID ---------------- */
.board-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 8px 0;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(4, var(--cell-size));
  grid-template-rows: repeat(8, var(--cell-size));
  gap: var(--grid-gap);
  background: rgba(10, 14, 23, 0.9);
  padding: 12px;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6), 0 10px 25px rgba(0, 0, 0, 0.5);
}

.board-cell {
  width: var(--cell-size);
  height: var(--cell-size);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.board-cell:hover:not(.occupied):not(.locked):not(.conquered-solid) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.02);
}

.board-cell.occupied,
.board-cell.conquered-solid {
  cursor: default;
}

/* Conquered Cells */
.board-cell.conquered-p1 {
  background: var(--p1-bg);
  border-color: var(--p1-color);
  box-shadow: inset 0 0 12px var(--p1-glow);
}

.board-cell.conquered-p2 {
  background: var(--p2-bg);
  border-color: var(--p2-color);
  box-shadow: inset 0 0 12px var(--p2-glow);
}

/* Zarsız Boyanmış Fetih Hücreleri (Geri Alınamaz Mod) */
.board-cell.conquered-p1.conquered-solid,
.board-cell.conquered-p1:not(.occupied) {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.65), rgba(29, 78, 216, 0.85));
  border: 2px solid #60a5fa;
  box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.25), 0 0 12px var(--p1-glow);
}

.board-cell.conquered-p2.conquered-solid,
.board-cell.conquered-p2:not(.occupied) {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.65), rgba(185, 28, 28, 0.85));
  border: 2px solid #f87171;
  box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.25), 0 0 12px var(--p2-glow);
}

.board-cell.locked:not(.conquered-solid) {
  border-color: var(--star-gold);
  box-shadow: 0 0 15px var(--star-glow), inset 0 0 15px rgba(245, 158, 11, 0.2);
}

/* ---------------- DICE STYLING ---------------- */
.dice {
  width: calc(var(--cell-size) - 10px);
  height: calc(var(--cell-size) - 10px);
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  animation: diceDrop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes diceDrop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.dice.owner-p1 {
  border-color: var(--p1-color);
}

.dice.owner-p2 {
  border-color: var(--p2-color);
}

.dice-pips {
  width: 75%;
  height: 75%;
  position: relative;
}

.pip {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #f8fafc;
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* Owner pip accents */
.owner-p1 .pip { background: #93c5fd; box-shadow: 0 0 6px var(--p1-glow); }
.owner-p2 .pip { background: #fca5a5; box-shadow: 0 0 6px var(--p2-glow); }

/* Pip Positions */
.pip-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.pip-top-left { top: 0; left: 0; }
.pip-top-right { top: 0; right: 0; }
.pip-mid-left { top: 50%; left: 0; transform: translateY(-50%); }
.pip-mid-right { top: 50%; right: 0; transform: translateY(-50%); }
.pip-bottom-left { bottom: 0; left: 0; }
.pip-bottom-right { bottom: 0; right: 0; }

/* Golden Star Dice */
.dice-star {
  background: linear-gradient(145deg, #78350f, #451a03);
  border: 2px solid var(--star-gold);
  color: var(--star-gold);
}

.star-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: starPulse 2s infinite ease-in-out;
}

@keyframes starPulse {
  0% { transform: scale(0.92); filter: drop-shadow(0 0 4px var(--star-gold)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 12px var(--star-gold)); }
  100% { transform: scale(0.92); filter: drop-shadow(0 0 4px var(--star-gold)); }
}

/* Merge Burst Animation */
.merge-burst {
  animation: mergeAnimation 0.5s ease-out forwards;
}

@keyframes mergeAnimation {
  0% { transform: scale(1); filter: brightness(1.8); }
  50% { transform: scale(1.3); box-shadow: 0 0 25px #fff; }
  100% { transform: scale(1); filter: brightness(1); }
}

.merge-fade {
  animation: fadeOutCell 0.35s ease forwards;
}

@keyframes fadeOutCell {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.2); opacity: 0; }
}

/* ---------------- MODALS ---------------- */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  padding: 28px;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Initiative Modal */
.initiative-rolls {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-bottom: 20px;
}

.init-roll-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.init-roll-box h4 {
  font-size: 0.9rem;
}

.p1-box h4 { color: var(--p1-color); }
.p2-box h4 { color: var(--p2-color); }

.init-dice-slot {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.init-vs {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.init-msg {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  min-height: 24px;
}

/* Game Over Modal */
.trophy-icon {
  font-size: 3rem;
  margin-bottom: 8px;
  animation: bounceTrophy 1.5s infinite ease-in-out;
}

@keyframes bounceTrophy {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.final-score-cards {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.final-score-box {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.final-score-box strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.2rem;
  margin: 4px 0;
}

.final-score-box.p1-box { border: 1px solid var(--p1-color); color: var(--p1-color); }
.final-score-box.p2-box { border: 1px solid var(--p2-color); color: var(--p2-color); }

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn {
  flex: 1;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================
   GERÇEK ZAMANLI (REAL-TIME / BLITZ) STİLLERİ
   ========================================== */
.badge-accent {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.realtime-mode .player-card {
  opacity: 1 !important;
  filter: none !important;
  transform: none !important;
  border-color: rgba(255, 255, 255, 0.12);
}

.realtime-mode .p1-card {
  border-color: rgba(59, 130, 246, 0.4);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), var(--bg-card));
}

.realtime-mode .p2-card {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), var(--bg-card));
}

.realtime-mode .player-turn-area {
  opacity: 1 !important;
  filter: none !important;
}

/* Zar Cooldown Göstergesi */
.player-dice-slot.cooling {
  position: relative;
  opacity: 0.65;
  filter: grayscale(0.5);
}

.player-dice-slot.cooling::after {
  content: "⏳";
  position: absolute;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 8px;
  animation: pulseCooldown 0.7s infinite alternate ease-in-out;
}

@keyframes pulseCooldown {
  0% { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.1); opacity: 1; }
}

/* Reddedilen / Başkası Tarafından Kapılan Hücre Titremesi */
@keyframes shakeCellRejected {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.board-cell.cell-rejected {
  animation: shakeCellRejected 0.35s ease-in-out !important;
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.3) !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.8) !important;
  z-index: 5;
}

/* 3-2-1 Geri Sayım Modalı */
.countdown-card {
  max-width: 360px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.25);
}

.blitz-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-weight: 800;
  font-size: 0.78rem;
  padding: 4px 14px;
  border-radius: 9999px;
  letter-spacing: 1px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.4);
}

.countdown-display {
  font-size: 5rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 900;
  color: #fbbf24;
  text-shadow: 0 0 35px rgba(251, 191, 36, 0.8);
  margin: 10px 0;
  line-height: 1;
}

.countdown-display.go {
  color: #10b981;
  text-shadow: 0 0 40px rgba(16, 185, 129, 0.85);
  font-size: 4rem;
}

/* Responsive adjustments */
@media (max-width: 680px) {
  .game-main-content {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .game-sidebar {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 400px) {
  :root {
    --cell-size: 48px;
    --grid-gap: 5px;
  }
  .lobby-card {
    padding: 18px;
  }
}
