/* =========================================
   BASE
========================================= */

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;

  background:
    linear-gradient(rgba(255,255,255,0.1), rgba(255,255,255,0.1)),
    url('../bg-golf.webp');

  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* jednotné chování buttonů */
button {
  touch-action: manipulation;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease;
}

button:active {
  transform: scale(0.95);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* fix pro sticky */
.table-wrapper,
.max-w-md {
  overflow: visible;
}

/* =========================================
   SCORECARD – TABLE
========================================= */

.scorecard {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 8px;
}

.scorecard th,
.scorecard td {
  text-align: center;
  padding: 10px 6px;
  height: 62px;
  min-width: 50px;
  border-bottom: 1px solid #ccc;
  font-size: 22px;
  font-weight: 700;
}

/* oddělení sloupců */
.scorecard td:not(:first-child) {
  border-left: 1px solid #ddd;
}

/* první sloupec */
.scorecard td:first-child,
.scorecard th:first-child {
  width: 80px;
  min-width: 70px;
  padding: 6px 4px;
  background: #edf8f1;
  color: #14532d;
  font-weight: 700;
  border-right: 1px solid #777;
  border-bottom: 1px solid #777;
}

/* =========================================
   STATISTIKY
========================================= */

.sum-row.stat {
  background: #f6faf7; 
}

.sum-row.stat td {
  padding: 4px 6px;
  font-size: 12px;
  height: auto;
  color: #6b7280;
  border: 1px solid #eee;
}

.sum-row.stat td:first-child {
  font-size: 10px;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

.sum-row.stat td:not(:first-child) {
  color: #6b7280;
}

.sum-row.total {
  border-bottom: 2px solid #d1d5db;
}

/* =========================================
   HEADER (sticky)
========================================= */

.scorecard thead th {
  position: sticky;
  top: 0;
  z-index: 100;
  font-size: 20px;
  font-weight: 700;
  background: #edf8f1;
  color: #14532d;
  border-bottom: 1px solid #777;
}

/* =========================================
   PLAYERS / CONTROLS
========================================= */

.player-name {
  cursor: pointer;
}

.player-name.active-player {
  background: #fde68a;
}

.controls {
  justify-content: center;
}

.controls button {
  padding: 14px 18px;
  background: #e5e7eb;
  font-size: 20px;
  font-weight: 600;
}

.controls #btnAddPlayer {
  background: #dcfce7;
}

.controls #btnRemovePlayer {
  background: rgba(251, 146, 60, 0.18);
}

.controls .btnShare {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.controls .btn-danger {
  background: #fee2e2;
}

.controls .countHoles {
  background: #e0f2fe;
  color: #075985;
  width: 60px;
}

.controls .countHoles.active {
  background: #60a5fa;
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px #60a5fa;
}

/* =========================================
   HOLE COLUMN
========================================= */

.hole {
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.15s ease;
}

.hole:active,
.hole.active {
  background: #fef3c7;
}

.hole-num {
  font-size: 21px;
}
 
.hole-par {
  font-size: 16px;
  font-weight: 700;
}

.hole-par.par-3 { color: #15803d; }
.hole-par.par-4 { color: #ca8a04; }
.hole-par.par-5 { color: #b91c1c; }

/* =========================================
   ROW / CELL STATES
========================================= */

.scorecard tr.active-row {
  background: #fff7ed;
}

.cell {
  cursor: pointer;
  user-select: none;
}

.cell.active {
  background: #fef3c7 !important;
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
  color: #000 !important;
}
.cell.active .value {
  color: #000 !important;
  background: transparent !important; /* 👈 KLÍČOVÉ */
}

.cell .empty {
  opacity: 0.35;
}

/* =========================================
   VALUE (score + putts + X)
========================================= */

.value {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
}

.value-x {
  color: #b91c1c;
  font-weight: 600;
}

.putts {
  font-size: 14px;
  transform: translateY(-5px) translateX(2px); 
  font-weight: 500;
  color: #555 !important;
}

.mark-x {
  font-size: 12px;
  transform: translateY(5px);
  text-transform: uppercase;
  font-weight: 700;
  padding:0px 2px !important;
  margin-left: -10px;
  color: #ff0000;
}

/* =========================================
   SCORE COLORS – jemnější varianta (inline)
========================================= */

/* =========================================
   SCORE COLORS – balanced (kompromis)
========================================= */

/* =========================================
   SCORE COLORS – skutečný kompromis
========================================= */

.scorecard .score-hio, .share-table .score-hio, .legend-item.score-hio { background:#e6fbef; color:#000; }
.scorecard .score-eagle, .share-table .score-eagle, .legend-item.score-eagle { background:#fde8e8; color:#000; }
.scorecard .score-birdie, .share-table .score-birdie, .legend-item.score-birdie { background:#fef5f5; color:#000; }
.scorecard .score-par, .share-table .score-par, .legend-item.score-par { background:#fef7d6; color:#000; }
.scorecard .score-bogey, .share-table .score-bogey, .legend-item.score-bogey { background:#e7f0ff; color:#000; }
.scorecard .score-double, .share-table .score-double, .legend-item.score-double { background:#f1ecff; color:#000; }
.scorecard .score-other, .share-table .score-other, .legend-item.score-other { background:#e9e3ff; color:#000; }

.scorecard td:not(:first-child), .scorecard th:not(:first-child) { border-right: 1px solid #777;}

/* =========================================
   SUM ROWS
========================================= */

.sum-row {
  font-weight: 600;
  background: #f3f4f6;
}
.sum-row TD {
  border-top: 1px solid #777;
  border-bottom: 1px solid #777;  
}
.sum-row.total {
  background: #d1e7dd !important;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.5px;
}

.sum-row.total TD {
  border-bottom: 1px solid #777;
}
.sum-label {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.sum-range {
  font-size: 12px;
  font-weight: 500;
  color: #555;
  letter-spacinG:1px;
}

/* =========================================
   PAR PICKER
========================================= */

#par-picker {
  position: absolute;
  z-index: 10;
  display: flex;
  gap: 6px;
  background: #fff;
  padding: 5px;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.par-btn {
  padding: 14px 20px;
  font-size: 22px;
  font-weight: 700;
  outline: 1px solid #ddd;
}

.par-btn.par-3 { background: #dcfce7; color: #166534; }
.par-btn.par-4 { background: #fef9c3; color: #a16207; }
.par-btn.par-5 { background: #fee2e2; color: #991b1b; }

.par-btn.active {
  outline: 1px solid #777;
}

/* =========================================
   KEYPAD
========================================= */

#keypad {
  position: absolute;
  z-index: 10;
  background: #fff;
  padding: 6px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  min-width: 220px;
  max-width: calc(100vw - 20px);
}

.keypad-title {
  font-size: 12px;
  text-align: center;
  margin-bottom: 6px;
  color: #6b7280;
  text-transform: uppercase;
}

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

#keypad button {
  padding: 18px 38px;
  font-size: 24px;
  font-weight: 700;
}

/* spodní řada */
.keypad-bottom {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  justify-content: space-between;
}

.keypad-bottom button {
  width: 68px;
  height: 62px;
  font-size: 18px !important;
  padding: 0 !important;
  text-align:center !important;
}

/* barvy tlačítek */
.keypad-grid button {
  background: #edf7f1;
  color: #14532d;
}

#keypad button.par {
  background: #16a34a;
  color: #fff;
  font-weight: 700;
}

/* akce */
[data-action] {
  background: #e0f2fe;
  color: #075985;
}

[data-action="clear"] {
  background: #e5e7eb;
  color: #374151;
}

[data-val="X"] {
  background: #fee2e2;
  color: #991b1b;
}

/* putty keypad */
.keypad-putts .keypad-grid button {
  background: #e0f2fe;
  color: #075985;
}

.keypad-putts .keypad-bottom {
  margin-top: 6px;
}

.keypad-putts .keypad-bottom button {
  width: 100%;
  height: 60px;
  background: #e5e7eb;
  color: #374151;
}

/* active feedback */
.keypad-putts .keypad-bottom button:active {
  transform: scale(0.97);
}

/* =========================================
   LEGEND
========================================= */

.score-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 10px 0;
  font-size: 10px;
  justify-content: center;
}

.legend-item {
  padding: 3px 6px;
  border-radius: 6px;
  font-weight: 600;
}

/* =========================================
   GAME META
========================================= */

.game-meta {
  background: #edf8f1;
  border-radius: 12px 12px 0 0;
  padding: 14px 12px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: center;
}

.game-name {
  position: relative;
  text-align: center;

  font-weight: 700;
  font-size: 18px;
  margin-bottom: 8px;
}

.settings-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);

  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

/* container */
.game-sub {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* inputy – čistý, nenápadný styl */
.meta-input {
  border: none;
  background: transparent;
  text-align: center;
  font-size: 18px;
  color: #333;
  padding: 2px 4px;

  min-width: 30px;
  width: fit-content;
  max-width: 140px;

  border-bottom: 1px dotted #777;
}

/* placeholder */
.meta-input::placeholder {
  color: #777;
}

/* focus – jen lehké zvýraznění, žádný box */
.meta-input:focus {
  outline: none;
  border-bottom: 1px solid #2563eb;
}

/* =========================================
   RESULT MODAL
========================================= */


.results-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.results-box {
  background: #fff;
  border-radius: 16px;
  width: 92%;
  max-width: 420px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* HEADER */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  font-weight: 600;
  border-bottom: 1px solid #e5e7eb;
}

.results-header .close {
  cursor: pointer;
  font-size: 18px;
  opacity: 0.6;
}

.results-header .close:hover {
  opacity: 1;
}

/* CONTENT */
.results-content {
  padding: 12px;
  overflow-y: auto;
}

.results-content pre {
  background: #f3f4f6;
  padding: 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
}

/* FOOTER */
.results-actions {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid #e5e7eb;
}

.results-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;
  font-weight: 500;
  cursor: pointer;
}

/* tlačítka */
.results-actions .btn-copy {
  background: #fef3c7;
}

.results-actions .btn-copy:hover {
  background: #fde68a;
}

.results-actions .btn-share {
  background: #e0f2fe; /* světle modrá */
  color: #075985;
}

.results-actions .btn-share:hover {
  background: #bae6fd;
}



.results-actions .btn-close {
  background: #e5e7eb;
}

.results-actions .btn-close:hover {
  background: #d1d5db;
}

/* =========================================
   SHARE CARD
========================================= */

.share-card {
  width: 900px;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  font-family: system-ui, sans-serif;
}

.share-card .sum-label {
  line-height: 1.3;
  font-size: 10px;
  color: #333;
}

.share-card .sum-range {
  font-size: 8px;
  font-weight: 400;
  color: #777;
  letter-spacing: 0.5px;
}

/* HEADER */

.share-header {
  text-align: center;
  font-weight: 700;
  font-size: 26px;
}

.share-sub {
  text-align: center;
  font-size: 15px;
  color: #666;
  margin-bottom: 20px;
}

/* PLAYER */

.share-player {
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.share-player-name {
  font-weight: 700;
  font-size: 18px;
  margin-left: 6px;
  margin-bottom: 10px;
}

/* =========================================
   TABLE
========================================= */

.share-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
  margin-bottom: 8px;
}

.share-table th,
.share-table td {
  border: 1px solid #eee;
  padding: 0;
  height: 30px;
}

/* 🔥 JEDINÝ správný způsob centrování */

.cell-inner {
  display: flex;
  align-items: center !important;      /* vertikální */
  vertical-align: middle !important;      /* vertikální */
  justify-content: center !important;  /* horizontální */
  height: 100%;
  width: 100%;
  transform: translateY(-7px); /* optický fix fontu */
}

/* HEADER */

.share-table th {
  background: #f9fafb;
  font-weight: 600;
}

/* první sloupec (labely) */

.share-table th:first-child,
.share-table td:first-child {
  width: 70px;
}

.share-table td:first-child .cell-inner,
.share-table th:first-child .cell-inner {
  justify-content: flex-start;
  padding-left: 8px;
}

/* PAR row */

.row-par {
  background: #f3f4f6;
  font-weight: 600;
}

/* =========================================
   OUT / IN / SUM
========================================= */

.sum-cell {
  font-size: 14px;
  color: #6b7280;
  background: #f9fafb;
}

/* zvýraznění hodnot OUT/IN */

.share-table td.sum-cell .cell-inner {
  font-weight: 700;
  color: #374151;
}

/* oddělení OUT / IN */

.share-table th.sum-cell,
.share-table td.sum-cell {
  border-left: 2px solid #d1d5db;
}

/* TOTAL sloupec */

.share-table td:last-child,
.share-table th:last-child {
  font-weight: 700;
  background: #f3f4f6;
}

/* =========================================
   STATS
========================================= */

.share-substats {
  font-size: 10px;
  color: #6b7280;
  margin-top: 0;
  margin-left: 8px;
}

/* =========================================
   FOOTER
========================================= */

.share-footer {
  text-align: center;
  font-size: 11px;
  color: #999;
  margin-top: 14px;
}

/* =========================================
   SCORE HIGHLIGHT (reuse existing logic)
========================================= */

.share-table td.score-eagle,
.share-table td.score-birdie {
  font-weight: 700;
}

.share-table td.score-par {
  font-weight: 500;
}

.cell.flash-delete {
  outline: 2px solid #dc2626;
  outline-offset: -2px;
  animation: flashDelete 0.3s ease;
}

@keyframes flashDelete {
  0% {
    background: #fee2e2;
  }
  100% {
    background: transparent;
  }
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  opacity: 0.9;
}


/* =========================================
   GAME TOPBAR – clean / soft UI
========================================= */

.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;

  background: #f6f9f7; /* jemná zelenošedá */
  padding: 5px 12px;
  margin: 0 0 10px 0;
  border-radius: 10px;

  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ===== LEFT ===== */

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.game-mode {
  font-weight: 600;
  font-size: 16px;
  color: #1f2937;
}

.game-id {
  font-size: 12px;
  color: #6b7280;
}

/* ===== RIGHT (ACTIONS) ===== */

.topbar-actions {
  display: flex;
  gap: 4px;
}

/* ===== BUTTONS – jemná žlutá ===== */

.btn-topbar {
  display: flex;
  align-items: center;
  gap: 4px;

  background: #fef9e7;
  border: 1px solid #f3e8c7;
  color: #6b4f1d;

  border-radius: 8px;
  padding: 8px 12px;

  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-topbar:hover {
  background: #fef3c7;
}

/* ===== PRIMARY (Sdílet) – lehce výraznější ===== */

.btn-topbar.primary {
  background: #fde68a;
  border: 1px solid #fcd34d;
  color: #78350f;
}

.btn-topbar.primary:hover {
  background: #fcd34d;
}

/* ===== OPTIONAL: editor vs viewer ===== */

.game-topbar.editor {
  background: #ecfdf5;
}

.game-topbar.viewer {
  background: #f6f9f7;
}

.update-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);

  background: #1f2937;
  color: white;
  padding: 12px 14px;
  border-radius: 8px;

  font-size: 12px;
  z-index: 1000;
}
 
.update-banner button {
  margin-left: 10px;
  background: #ffffff;
  color: #111827;
  border: none;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.connection-status {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  z-index: 9999;
}

.connection-status.offline {
  background: rgba(245, 158, 11, 0.9);
  color: black;
}

.connection-status.hidden {
  display: none;
}

/* =========================================
   HOME UI
========================================= */


/* jemné karty */
.card-soft {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(6px);
}

/* větší primary button */
.btn-primary {
  background: #16a34a;
  color: #fff;
  font-weight: 600;
}

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

/* sekundární */
.btn-secondary {
  background: #dcfce7;
  color: #166534;
}

/* lepší shadow pro card */
.shadow-xl {
  box-shadow: 0 20px 40px rgba(0,0,0,0.12);
}