:root {
  --bg-main: #0c131a;
  --bg-card: #15202b;
  --bg-card-hover: #1c2a38;
  --bg-row-alt: #111a24;
  --border-color: #263545;
  --border-subtle: #1e2c3a;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dark: #64748b;
  
  /* Player Accent Colors */
  --p1-color: #38bdf8; /* Blue */
  --p1-bg: rgba(56, 189, 248, 0.1);
  --p2-color: #f43f5e; /* Rose */
  --p2-bg: rgba(244, 63, 94, 0.1);
  --p3-color: #10b981; /* Emerald */
  --p3-bg: rgba(16, 185, 129, 0.1);
  --p4-color: #f59e0b; /* Amber */
  --p4-bg: rgba(245, 158, 11, 0.1);

  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-gold: #fbbf24;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  padding: 16px 12px;
  display: flex;
  justify-content: center;
}

.app-container {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Penalty Section (Ceza Tablosu) */
.penalty-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.penalty-header-bar {
  padding: 12px 18px;
  background: #192736;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.penalty-header-bar h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 6px;
}

.penalty-action-buttons {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-top: auto;
}

.penalty-action-buttons button {
  flex: 1;
}

.btn-add-penalty {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px dashed rgba(239, 68, 68, 0.4);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-add-penalty:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #fff;
  transform: translateY(-1px);
}

.btn-add-siler {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border: 1px dashed rgba(16, 185, 129, 0.4);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-add-siler:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #fff;
  transform: translateY(-1px);
}

/* Penalty / Siler Tags */
.penalty-tag.siler {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.4);
}

.penalty-tag.siler .penalty-delete-btn {
  color: #4ade80;
}

.penalty-sum-badge.siler {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Modal Type Tabs */
.modal-type-tabs {
  display: flex;
  gap: 8px;
  background: #0f1722;
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

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

.type-tab-btn.active.danger {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.type-tab-btn.active.success {
  background: rgba(34, 197, 94, 0.25);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}

.penalty-grid {
  display: grid;
  background: #111a24;
  gap: 1px;
}

.penalty-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.penalty-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.penalty-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.penalty-col {
  background: var(--bg-card);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  transition: background 0.15s ease;
}

.penalty-col:hover {
  background: #182635;
}

.penalty-col-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.penalty-player-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.penalty-sum-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.penalty-sum-badge.zero {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-dark);
  border-color: transparent;
}

.penalty-items-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 40px;
  align-content: flex-start;
  align-items: center;
  justify-content: center;
}

.penalty-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  animation: popIn 0.15s ease-out;
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.penalty-delete-btn {
  background: transparent;
  border: none;
  color: #f87171;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: 0.7;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.penalty-delete-btn:hover {
  opacity: 1;
  transform: scale(1.3);
  color: #fff;
}

.penalty-empty-hint {
  font-size: 0.75rem;
  color: var(--text-dark);
  font-style: italic;
  margin: auto;
}

.btn-add-penalty {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px dashed rgba(239, 68, 68, 0.4);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
  margin-top: auto;
}

.btn-add-penalty:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #fff;
  transform: translateY(-1px);
}

/* Footer Breakdown Rows in Score Table */
.hands-total-row {
  background: #111a24;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 2px solid var(--border-color);
}

.penalty-total-row {
  background: #131d27;
  color: #f87171;
  font-size: 0.85rem;
  font-weight: 700;
}

.penalty-total-row .total-label {
  color: #f87171;
}

.grand-total-row {
  background: #172433;
  border-top: 2px solid #38bdf8;
  font-weight: 800;
}

.grand-total-row .total-label {
  font-size: 0.92rem;
  letter-spacing: 1px;
  color: #38bdf8;
}

.grand-total-val {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 800;
  padding: 12px 8px;
}

/* Mode Selector (Segment Control) */
.mode-selector-wrap {
  display: flex;
  align-items: center;
}

.mode-pill-group {
  display: inline-flex;
  background: #0f1923;
  padding: 4px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  gap: 3px;
}

.mode-pill {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

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

.mode-pill.active {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4);
}

.mode-pill[data-mode="team"].active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.mode-pill[data-mode="3p"].active {
  background: linear-gradient(135deg, #059669, #10b981);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
}

/* 3-Player Table & Podium */
.podium-section.mode-3p {
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.player-3p-col {
  width: calc((100% - 90px) / 3);
}

/* Header */
.header {
  background: linear-gradient(135deg, #132230, #182836);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.logo-area h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-green);
  text-transform: uppercase;
  margin-top: 2px;
}

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

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.last-sync {
  color: var(--text-dark);
  font-weight: normal;
  margin-left: 6px;
  font-size: 0.7rem;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-secondary {
  background: #223244;
  color: #e2e8f0;
  border-color: #33475b;
}

.btn-secondary:hover {
  background: #2c4056;
}

.btn-mode-toggle {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-mode-toggle.individual {
  background: #223244;
  color: #94a3b8;
  border-color: #33475b;
  box-shadow: none;
}

.btn-mode-toggle:hover {
  filter: brightness(1.15);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-primary {
  background: #2563eb;
  color: #fff;
}
.btn-primary:hover {
  background: #1d4ed8;
}

.btn-outline-danger {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}
.btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 12px 18px;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
}

/* Confirm Modal Specifics */
.confirm-card {
  max-width: 420px;
}

.confirm-message {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

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

/* Team Column Header Specifics (2 Columns Mode) */
.team-table-col {
  width: calc((100% - 90px) / 2);
  padding: 10px 8px;
}

.team-1-col {
  background: rgba(56, 189, 248, 0.08);
  border-bottom: 2px solid #38bdf8 !important;
}

.team-2-col {
  background: rgba(244, 63, 94, 0.08);
  border-bottom: 2px solid #f43f5e !important;
}

.team-name-input {
  background: transparent;
  border: 1px solid transparent;
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  text-align: center;
  width: 100%;
  max-width: 200px;
  padding: 5px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.2s ease;
}

.team-name-input:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #33475b;
}

.team-name-input:focus {
  background: #0f172a;
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35);
}

.team-name-input.text-left {
  text-align: left;
}

/* Team Mode Styles */
.podium-section.team-mode {
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.team-card {
  background: linear-gradient(145deg, #162434, #1b2d40);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.team-card.team-1 {
  border-top: 4px solid #38bdf8;
}

.team-card.team-2 {
  border-top: 4px solid #f43f5e;
}

.team-card.winner {
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.25);
  border-color: rgba(251, 191, 36, 0.5);
}

.team-badge-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.team-1 .team-badge-pill {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.team-2 .team-badge-pill {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.team-members {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-members-detail {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.team-score {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
}

.team-1 .team-score { color: #38bdf8; }
.team-2 .team-score { color: #f43f5e; }

.team-tag {
  display: block;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-top: 2px;
  border-radius: 3px;
  padding: 1px 4px;
}

.team-tag-1 {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}

.team-tag-2 {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.12);
}

.team-total-row {
  background: #0f1c29;
  border-top: 2px dashed #33475b;
  font-weight: 800;
}

.team-total-label {
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  color: #94a3b8;
}

.team-total-val-1 {
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
}

.team-total-val-2 {
  color: #f43f5e;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
}

.podium-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.podium-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.podium-card.p-0::before { background: var(--p1-color); }
.podium-card.p-1::before { background: var(--p2-color); }
.podium-card.p-2::before { background: var(--p3-color); }
.podium-card.p-3::before { background: var(--p4-color); }

.podium-rank {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.podium-rank.first {
  color: var(--accent-gold);
}

.podium-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.podium-score {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
}

/* Table Card */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.table-header-bar {
  padding: 14px 18px;
  background: #182533;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.table-header-bar h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #e2e8f0;
}

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

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
}

.score-table th, 
.score-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
}

.score-table th:last-child,
.score-table td:last-child {
  border-right: none;
}

/* Round / Hand Column */
.round-col {
  width: 90px;
  background: #111b24;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

tbody tr:nth-child(even) td.round-col {
  background: #0e171f;
}

tbody tr:nth-child(even) {
  background: var(--bg-row-alt);
}

tbody tr:hover {
  background: var(--bg-card-hover);
}

/* Player Column Headers */
.player-col {
  width: calc((100% - 90px) / 4);
  background: #162432;
  padding: 8px 6px;
}

.player-header-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.player-name-input {
  background: transparent;
  border: 1px solid transparent;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  width: 100%;
  max-width: 110px;
  padding: 4px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.2s ease;
}

.player-name-input.text-left {
  text-align: left;
}

/* Horizontal Table Specifics */
.horizontal-table th, 
.horizontal-table td {
  padding: 10px 8px;
  white-space: nowrap;
}

.player-col-fixed {
  width: 140px;
  text-align: left;
  background: #14202c;
  padding-left: 12px !important;
}

.player-header-h {
  text-align: left;
  background: #121d28;
  padding-left: 10px !important;
}

.round-col-h {
  background: #162432;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 45px;
}

.total-col-h {
  background: #192736;
  color: #f1f5f9;
  font-weight: 800;
  min-width: 75px;
}

.rank-col-h {
  background: #14202c;
  color: var(--text-muted);
  font-size: 0.8rem;
  min-width: 65px;
}

.player-name-input:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #33475b;
}

.player-name-input:focus {
  background: #0f172a;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

.player-badge {
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: 4px;
  padding: 2px 5px;
  line-height: 1;
}

.player-1 .player-badge { background: var(--p1-color); color: #000; }
.player-2 .player-badge { background: var(--p2-color); color: #fff; }
.player-3 .player-badge { background: var(--p3-color); color: #000; }
.player-4 .player-badge { background: var(--p4-color); color: #000; }

/* Interactive Score Cells */
.score-cell {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  transition: background-color 0.15s ease, transform 0.1s ease;
  user-select: none;
}

.score-cell:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.score-cell:active {
  transform: scale(0.96);
}

.score-cell.empty {
  color: var(--text-dark);
  font-size: 0.85rem;
  font-style: italic;
}

.score-cell.won-hand {
  color: #4ade80;
  font-weight: 700;
  background: rgba(34, 197, 94, 0.08);
}

.score-cell.penalty {
  color: #f87171;
}

/* Footer Totals */
tfoot .total-row {
  background: #111e2b;
  border-top: 2px solid var(--border-color);
  font-weight: 800;
}

.total-label {
  font-size: 0.9rem;
  letter-spacing: 1px;
  color: #cbd5e1;
}

.total-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  padding: 12px 8px;
}

.total-val.player-1 { color: var(--p1-color); }
.total-val.player-2 { color: var(--p2-color); }
.total-val.player-3 { color: var(--p3-color); }
.total-val.player-4 { color: var(--p4-color); }

.rank-row {
  background: #0c151e;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.rank-label {
  color: var(--text-dark);
}

.rank-val.winner {
  color: var(--accent-gold);
  font-weight: 800;
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.15s ease-out;
}

.modal-overlay.hidden {
  display: none;
}

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

.modal-card {
  background: var(--bg-card);
  border: 1px solid #33475b;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  background: #192634;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quick-preset-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-btn {
  padding: 10px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn.success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.3);
}

.preset-btn.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.preset-btn.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.preset-btn.zero {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #334155;
  grid-column: span 2;
}

.preset-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.2);
}

.custom-input-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-with-actions {
  display: flex;
  gap: 8px;
}

.input-with-actions input {
  flex: 1;
  background: #0c141d;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  outline: none;
}

.input-with-actions input:focus {
  border-color: #38bdf8;
}

/* Footer */
.footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dark);
  padding: 10px 0;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  body {
    padding: 10px 6px;
  }
  
  .header {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
  }

  .logo-area {
    justify-content: space-between;
  }

  .mode-selector-wrap {
    width: 100%;
    justify-content: center;
  }

  .mode-pill-group {
    width: 100%;
    display: flex;
  }

  .mode-pill {
    flex: 1;
    text-align: center;
    padding: 6px 6px;
    font-size: 0.74rem;
  }

  .header-actions {
    justify-content: center;
  }
  
  .logo-area h1 {
    font-size: 1.15rem;
  }
  
  .podium-section {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .round-col {
    width: 65px;
    font-size: 0.75rem;
    padding: 8px 4px;
  }
  
  .player-col {
    width: calc((100% - 65px) / 4);
    padding: 6px 3px;
  }

  .player-name-input {
    font-size: 0.82rem;
    padding: 2px;
  }

  .player-badge {
    display: none; /* Hide badge on tiny screens to preserve space */
  }

  .score-cell {
    font-size: 0.95rem;
    padding: 8px 3px;
  }

  .total-val {
    font-size: 1.05rem;
    padding: 10px 4px;
  }
}
