/* === Jindrovi kostky — paleta převzata z cavotrip.cz === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface2:    #1f2937;
  --border:      #30363d;
  --text:        #e6edf3;
  --muted:       #8b949e;
  --blue:        #4d85c3;
  --blue-light:  #79aad8;
  --red:         #c8102e;
  --red-light:   #e04060;
  --green:       #3a9e6e;
  --green-light: #5cba8a;
  --gold:        #d9a441;
  --white:       #f0f6fc;
  --radius:      12px;
  --transition:  0.15s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--blue-light); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* === HLAVIČKA === */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(13,17,23,0.94);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-dice { font-size: 28px; line-height: 1; }
.brand-title { font-size: 19px; font-weight: 800; letter-spacing: .2px; }
.brand-sub { font-size: 12px; color: var(--muted); font-weight: 600; }
.brand-logos { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-logo-img { height: 38px; width: 38px; border-radius: 50%; object-fit: cover; }

/* === LAYOUT === */
.app {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.screen { display: none; flex-direction: column; gap: 14px; flex: 1; }
.screen.is-active { display: flex; }
.screen-title { font-size: 22px; font-weight: 800; text-align: center; }

/* === FORMULÁŘ NASTAVENÍ === */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field-label { font-size: 14px; font-weight: 700; color: var(--muted); }
.field-label { margin-top: 4px; }
.field input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 17px;
  color: var(--text);
}
.field input:focus { outline: none; border-color: var(--blue); }

.tier-choices { display: flex; flex-direction: column; gap: 10px; }
.tier {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  color: var(--text);
  text-align: left;
  transition: border-color var(--transition), background var(--transition);
}
.tier:hover { border-color: var(--blue); }
.tier.is-selected { border-color: var(--gold); background: #20242c; }
.tier-name { font-size: 17px; font-weight: 800; }
.tier-meta { font-size: 13px; color: var(--muted); }
.tier-goal { font-size: 20px; font-weight: 900; color: var(--gold); }

/* === TLAČÍTKA === */
.btn {
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  color: var(--white);
  transition: transform var(--transition), background var(--transition), opacity var(--transition);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--green); }
.btn-primary:hover:not(:disabled) { background: var(--green-light); }
.btn-secondary { background: var(--blue); }
.btn-secondary:hover { background: var(--blue-light); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); font-weight: 700; }
.btn-ghost:hover { background: var(--surface2); }

.setup-foot { text-align: center; margin-top: 8px; }
.link-logs { font-size: 15px; font-weight: 700; }

/* === HRACÍ TABULKA === */
.board { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.board-head { display: grid; grid-template-columns: 1fr auto 1fr; }
.board-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px; }
.board-p1 { border-right: 1px solid var(--border); }
.board-p2 { border-left: 1px solid var(--border); }
.board-name { font-size: 14px; font-weight: 800; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-score { font-size: 38px; font-weight: 900; line-height: 1; }
.board-left { font-size: 12px; color: var(--gold); font-weight: 700; }
.board-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 12px; background: #0f141b; }
.board-target-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.board-target { font-size: 22px; font-weight: 900; color: var(--gold); }
.board-tier { font-size: 11px; color: var(--muted); }

/* Aktivní hráč zvýrazněn */
.board-cell.is-turn { background: #182030; }
.board-cell.is-turn .board-score { color: var(--blue-light); }

/* Sloupce inkrementů */
.incs { display: grid; grid-template-columns: 1fr 1px 1fr; max-height: 180px; }
.inc-col {
  list-style: none;
  padding: 8px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.inc-divider { background: var(--border); }
.inc-col li {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  background: #0f141b;
  border-radius: 6px;
  padding: 4px 8px;
}
.inc-col li .inc-val { font-weight: 800; }
.inc-col li .inc-run { color: var(--muted); font-size: 12px; }
.inc-col li.is-bust .inc-val { color: var(--red-light); }

/* === KALKULAČKA === */
.pad { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.turn {
  text-align: center;
  font-size: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.turn strong { color: var(--blue-light); font-size: 18px; }
/* mřížka shodná s klávesnicí: displej nad klávesy 1+2, Potvrdit nad 3 */
.calc-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.calc-display {
  grid-column: span 2;
  min-width: 0;
  background: #0f141b;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 40px;
  font-weight: 900;
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.btn-confirm {
  grid-column: span 1;
  font-size: 17px;
  padding: 10px;
  line-height: 1.15;
}
.calc-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 26px;
  font-weight: 800;
  padding: 16px 0;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.key:hover { background: var(--surface2); }
.key:active { transform: scale(0.96); }
.key-fn { color: var(--gold); font-size: 22px; }
.btn-undo { font-size: 14px; padding: 10px; }

/* Kdo začíná */
.starter-choices { display: flex; flex-direction: column; gap: 10px; }
.starter-choices .btn { font-size: 18px; padding: 18px; }
.starter-note { text-align: center; font-size: 13px; color: var(--muted); margin-top: 4px; }

/* === KONEC HRY === */
.winner-box { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.winner-emoji { font-size: 48px; }
.winner-name { font-size: 26px; font-weight: 900; color: var(--gold); margin-top: 6px; }
.winner-detail { font-size: 14px; color: var(--muted); margin-top: 4px; }
.series { text-align: center; }
.series-title { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.series-score { font-size: 30px; font-weight: 900; }
.gameover-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

/* === SHRNUTÍ / DETAIL === */
.summary-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; font-size: 14px; }
.summary-box h3 { font-size: 16px; margin-bottom: 8px; }
.summary-box table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.summary-box th, .summary-box td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.summary-box th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.summary-box .sum-game { margin-top: 14px; }
.summary-box .sum-win { color: var(--gold); font-weight: 800; }

/* === LOGY === */
.logs-source { font-size: 13px; color: var(--muted); text-align: center; }
.log-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.log-list li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.log-list li a:hover { border-color: var(--blue); text-decoration: none; }
.log-list .log-empty { color: var(--muted); text-align: center; padding: 20px; }
.log-name { font-size: 15px; }
.log-arrow { color: var(--muted); }

/* === PATIČKA === */
.app-footer { text-align: center; padding: 16px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }

@media (min-width: 480px) {
  .brand-title { font-size: 22px; }
}
