:root {
  --bg: #0f1410;
  --surface: #1a221b;
  --border: #2d3b2f;
  --text: #e8efe9;
  --muted: #8a9a8c;
  --accent: #4ade80;
  --accent-dim: #22c55e;
  --radius: 12px;
  --font: "Outfit", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app {
  max-width: 100%;
  margin: 0 auto;
  padding: 1rem 0.75rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (min-width: 900px) {
  .app {
    padding: 1.25rem 1rem;
  }
}

.header {
  text-align: center;
  margin-bottom: 1rem;
}

.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.15rem;
}

.header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.lang-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: center;
}

.lang-btn {
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.lang-btn:hover {
  border-color: var(--accent);
  background: rgba(74, 222, 128, 0.1);
}

.lang-btn.active {
  border-color: var(--accent);
  background: rgba(74, 222, 128, 0.15);
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

@media (min-width: 768px) {
  .main {
    grid-template-columns: minmax(240px, 300px) 1fr;
    gap: 1.25rem;
  }
}

.main-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.splits-wrapper {
  min-width: 0;
  position: sticky;
  top: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.splits-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
}

.splits-hint {
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0 0 0.5rem 0;
}

.splits-scroll {
  max-height: 75vh;
  overflow-y: auto;
  overflow-x: auto;
}

/* Sticky: wiersz z tempem + nawigacją oraz wiersz z nagłówkami kolumn zostają na górze przy przewijaniu */
.splits-thead-sticky th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}

/* Drugi wiersz: cień w kolorze tła zasłania 1px szczelinę przy przewijaniu */
.splits-thead-sticky tr:nth-child(2) th {
  top: 2.25rem;
  box-shadow: 0 1px 0 var(--border), 0 2px 0 var(--surface);
}

.splits-head-pace-row th {
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0.4rem;
  font-weight: 400;
  font-size: 0.8rem;
  text-align: left;
  vertical-align: middle;
  box-shadow: 0 1px 0 var(--border), 0 2px 0 var(--surface);
}

.splits-head-pace-cell {
  display: table-cell;
}

.splits-pace-display {
  font-weight: 600;
  color: var(--accent);
  margin-right: 1rem;
}

.splits-pace-shift-inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.splits-pace-shift-inline[aria-hidden="true"] {
  display: none;
}

.splits-neg-split-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.75rem;
}

.splits-neg-split-inline input[type="number"] {
  width: 2.5rem;
  font-size: 0.8rem;
  padding: 0.3rem 0.4rem;
  text-align: right;
}

.splits-neg-split-inline input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.splits-neg-split-inline label[for="negative-split-enable"] {
  cursor: pointer;
  margin-bottom: 0;
}

.splits-table thead tr:nth-child(2) th.splits-th-neg {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.7rem;
}

.splits-table td.splits-col-neg {
  color: var(--muted);
  font-size: 0.75rem;
}

.splits-pace-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-right: 0.25rem;
}

.btn-shift {
  font-family: var(--font);
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.btn-shift:hover {
  border-color: var(--accent);
  background: rgba(74, 222, 128, 0.1);
}

.splits-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.875rem;
}

/* 11 kolumn: km + 5 par (tempo, neg) */
.splits-table th:nth-child(1),
.splits-table td:nth-child(1) { width: 15%; }
.splits-table th:nth-child(2), .splits-table td:nth-child(2) { width: 10%; }
.splits-table th:nth-child(3), .splits-table td:nth-child(3) { width: 7%; }
.splits-table th:nth-child(4), .splits-table td:nth-child(4) { width: 10%; }
.splits-table th:nth-child(5), .splits-table td:nth-child(5) { width: 7%; }
.splits-table th:nth-child(6), .splits-table td:nth-child(6) { width: 10%; }
.splits-table th:nth-child(7), .splits-table td:nth-child(7) { width: 7%; }
.splits-table th:nth-child(8), .splits-table td:nth-child(8) { width: 10%; }
.splits-table th:nth-child(9), .splits-table td:nth-child(9) { width: 7%; }
.splits-table th:nth-child(10), .splits-table td:nth-child(10) { width: 10%; }
.splits-table th:nth-child(11), .splits-table td:nth-child(11) { width: 7%; }

/* Gdy checkbox Neg. split wyłączony – ukryj kolumny neg */
.splits-table.neg-cols-hidden .splits-col-neg {
  display: none;
}

.splits-table th,
.splits-table td {
  padding: 0.3rem 0.4rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.splits-table td:nth-child(1) {
  font-size: 0.75rem;
  word-break: break-word;
  overflow-wrap: break-word;
}

.splits-table th:nth-child(n+2),
.splits-table td:nth-child(n+2) {
  text-align: right;
}

.splits-table .splits-t-base {
  font-weight: 600;
  color: var(--accent);
}

.splits-table thead tr:nth-child(2) th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
}

.splits-table thead tr:nth-child(2) th.splits-th-pace {
  color: var(--text);
  font-weight: 600;
}

.splits-table thead tr:nth-child(2) th.splits-th-base {
  color: var(--accent);
}

.splits-table tbody tr {
  cursor: pointer;
}

.splits-table tbody tr:hover {
  background: rgba(74, 222, 128, 0.08);
}

.splits-table tbody tr.selected {
  background: rgba(74, 222, 128, 0.15);
  color: var(--accent);
  font-weight: 600;
}

.splits-table tbody tr.selected:hover {
  background: rgba(74, 222, 128, 0.22);
}

.splits-table tbody tr.selected td {
  border-bottom-color: var(--accent);
}

select {
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s;
}

select:focus {
  outline: none;
  border-color: var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}

.card h2 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
}

.hint {
  margin: 0 0 0.6rem 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.row label {
  min-width: 0;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

label span {
  font-size: 0.75rem;
  color: var(--muted);
}

input {
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}

input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

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

.btn {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:hover {
  background: var(--accent-dim);
}

.btn:active {
  transform: scale(0.98);
}

.result {
  margin-top: 0.5rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg);
  border-radius: 6px;
  font-size: 0.85rem;
  min-height: 2rem;
}

.result.empty {
  color: var(--muted);
}

.result strong {
  color: var(--accent);
}

.footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer p {
  margin: 0;
}
