/* ── Tabs ───────────────────────────────────────────────────────────────────── */
.gt-tabs {
  display: flex; gap: 4px; margin-bottom: 20px; padding: 4px;
  background: rgba(17,19,24,0.8); border: 1px solid var(--border-light); border-radius: 10px;
}
.gt-tab {
  flex: 1; padding: 9px 10px; border: 0; border-radius: 7px; background: none; cursor: pointer;
  color: var(--muted); font: 600 14px var(--font);
}
.gt-tab.active { background: var(--accent); color: #fff; }

.gt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.gt-head h2 { font-size: 20px; }
.gt-head .btn-sm, .gt-head-actions .btn-sm { margin: 0; width: auto; }
.gt-head-actions { display: flex; gap: 8px; }
.gt-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 24px 0 10px; }
.gt-muted { color: var(--muted); }
.gt-footnote { color: var(--muted); font-size: 12px; margin-top: 10px; }
.gt-notes { white-space: pre-wrap; font-size: 13.5px; color: var(--muted); margin: 0 0 14px; }
.btn-danger-text { color: #fca5a5; }

/* ── Filters / chips ───────────────────────────────────────────────────────── */
.gt-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.gt-filters select { flex: 1 1 160px; width: auto; }
.gt-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.gt-chips:empty { display: none; }
.gt-chip {
  padding: 5px 12px; border-radius: 999px; cursor: pointer; font: 600 12.5px var(--font);
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-light); color: var(--muted);
}
.gt-chip.active { color: var(--text); border-color: rgba(47,91,234,0.5); background: rgba(47,91,234,0.12); }

/* ── Stat tiles ─────────────────────────────────────────────────────────────── */
.gt-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 8px; }
.gt-tile { background: rgba(17,19,24,0.8); border: 1px solid var(--border-light); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.gt-tile-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.gt-tile-value { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.gt-tile-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.gt-table-wrap { overflow-x: auto; border: 1px solid var(--border-light); border-radius: 10px; }
.gt-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.gt-table th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.05em; padding: 9px 12px; background: rgba(255,255,255,0.03); white-space: nowrap;
}
.gt-table td { padding: 9px 12px; border-top: 1px solid var(--border-light); white-space: nowrap; }
.gt-table td:first-child { white-space: normal; min-width: 150px; font-weight: 600; }
.gt-click { cursor: pointer; }
.gt-click:hover td { background: rgba(255,255,255,0.03); }
.gt-good { color: var(--green); font-weight: 700; }
.gt-bad { color: #f87171; font-weight: 700; }

/* ── Tournament cards ───────────────────────────────────────────────────────── */
.gt-card {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; cursor: pointer;
  background: rgba(17,19,24,0.8); border: 1px solid var(--border-light); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px; color: inherit; font: inherit;
}
.gt-card:hover { border-color: rgba(47,91,234,0.4); }
.gt-card-main { flex: 1; min-width: 0; }
.gt-card-title { font-weight: 700; font-size: 15px; }
.gt-card-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.gt-card-deck { font-size: 13px; margin-top: 4px; }
.gt-card-side { text-align: right; flex: none; }
.gt-card-record { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gt-card-place { font-size: 12px; color: var(--muted); }
.gt-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 4px; background: rgba(47,91,234,0.14); color: #7B9BF7;
}

/* ── Pokémon deck icons ────────────────────────────────────────────────────── */
/* Gen 5 sprites are 96px with lots of transparent padding, so they're drawn larger
   than their box and overlap a little — the Pokémon itself ends up ~box-sized. */
.gt-icons { display: inline-flex; align-items: center; flex: none; min-width: 44px; height: 44px; justify-content: center; }
.gt-icons img { width: 52px; height: 52px; margin: -4px -8px; object-fit: contain; }
.gt-icons-sm { min-width: 30px; height: 30px; }
.gt-icons-sm img { width: 36px; height: 36px; margin: -3px -6px; }
.gt-icons-empty::before {
  content: ""; width: 26px; height: 26px; border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.14);
}
.gt-icons-sm.gt-icons-empty::before { width: 18px; height: 18px; }
.gt-deck-cell { display: inline-flex; align-items: center; gap: 8px; }
.gt-tile-deck { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-weight: 700; font-size: 15px; min-width: 0; }
.gt-tile-wide { grid-column: 1 / -1; }
.gt-tile-deck span:last-child { overflow-wrap: break-word; min-width: 0; }
.gt-playing { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--text); }

/* ── Match rows ─────────────────────────────────────────────────────────────── */
.gt-date-head { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 16px 0 6px; }
.gt-date-head:first-child { margin-top: 0; }
.gt-match {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: rgba(17,19,24,0.8); border: 1px solid var(--border-light);
  border-radius: 14px; padding: 10px 14px; margin-bottom: 8px; color: inherit; font: inherit;
  transition: filter 0.15s;
}
.gt-match:hover { filter: brightness(1.15); }
.gt-match-W { background: rgba(34,197,94,0.10); border-color: rgba(34,197,94,0.22); }
.gt-match-L { background: rgba(239,68,68,0.10); border-color: rgba(239,68,68,0.22); }
.gt-match-T { background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.22); }
.gt-match-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gt-match-title { font-weight: 700; font-size: 15px; }
.gt-match-sub { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gt-match-games { display: inline-flex; gap: 4px; }

.gt-pill {
  display: inline-flex; align-items: baseline; gap: 2px; padding: 1px 6px; border-radius: 6px;
  font-size: 11.5px; font-weight: 700; line-height: 1.4;
}
.gt-pill sub { font-size: 9px; font-weight: 600; opacity: 0.75; vertical-align: baseline; }
.gt-pill-W { background: rgba(34,197,94,0.18); color: #4ade80; }
.gt-pill-L { background: rgba(239,68,68,0.18); color: #f87171; }
.gt-pill-T { background: rgba(245,158,11,0.18); color: #fbbf24; }

/* ── Deck picker ────────────────────────────────────────────────────────────── */
.gt-deck { display: flex; flex-direction: column; gap: 6px; }
.gt-deck { scroll-margin-top: 12px; }
.gt-deck-head { display: flex; align-items: center; gap: 8px; }
.gt-deck-icons { display: flex; gap: 4px; flex: none; }
.gt-deck-icon {
  position: relative; width: 44px; height: 44px; border-radius: 10px; cursor: pointer; padding: 0;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-light); color: var(--muted);
  display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 20px;
}
.gt-deck-icon img { width: 52px; height: 52px; object-fit: contain; }
.gt-deck-slot { border-style: dashed; }
.gt-deck-x {
  position: absolute; top: 1px; right: 3px; font-size: 13px; line-height: 1; color: var(--text);
  opacity: 0.6; text-shadow: 0 1px 2px #000;
}
.gt-deck-icon:hover .gt-deck-x { opacity: 1; }
.gt-deck-name { flex: 1; min-width: 0; }
.gt-deck-results:empty { display: none; }
.gt-deck-results {
  display: flex; flex-direction: column; max-height: 260px; overflow-y: auto;
  border: 1px solid var(--border-light); border-radius: 8px; background: #0d0f14;
}
.gt-deck-opt {
  display: flex; align-items: center; gap: 10px; padding: 4px 10px; text-align: left; cursor: pointer;
  background: none; border: 0; border-top: 1px solid var(--border-light); color: inherit; font: inherit; font-size: 14px;
}
.gt-deck-opt:first-child, .gt-deck-hint + .gt-deck-opt { border-top: 0; }
.gt-deck-opt:hover, .gt-deck-opt:focus { background: rgba(255,255,255,0.05); }
.gt-deck-opt > span:not(.gt-icons) { flex: 1; min-width: 0; }
.gt-deck-opt em { font-style: normal; font-size: 11px; color: var(--muted); }
.gt-deck-hint { font-size: 11px; color: var(--muted); padding: 8px 10px 4px; text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Modal form ─────────────────────────────────────────────────────────────── */
.lk-scroll h2 { font-size: 20px; margin-bottom: 4px; }
.gt-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gt-row > div { min-width: 0; }

.gt-specials { display: flex; gap: 6px; margin-bottom: 10px; }
.gt-toggle {
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font: 600 12.5px var(--font);
  background: rgba(255,255,255,0.04); border: 1px solid var(--border-light); color: var(--muted);
}
.gt-toggle.on { color: #fbbf24; border-color: rgba(245,158,11,0.5); background: rgba(245,158,11,0.12); }

.gt-games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.gt-games:empty { display: none; }
.gt-game {
  display: flex; flex-direction: column; gap: 6px; align-items: stretch;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border-light); border-radius: 10px; padding: 10px;
}
.gt-game-label { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.gt-seg { display: flex; border: 1px solid var(--border-light); border-radius: 8px; overflow: hidden; }
.gt-seg-btn {
  flex: 1; padding: 9px 0; border: 0; background: none; cursor: pointer; color: var(--muted);
  font: 700 14px var(--font);
}
.gt-seg-btn + .gt-seg-btn { border-left: 1px solid var(--border-light); }
.gt-seg-sm .gt-seg-btn { padding: 6px 0; font-size: 12px; font-weight: 600; }
.gt-seg-btn.on { background: rgba(255,255,255,0.12); color: var(--text); }
.gt-seg-W.on { background: rgba(34,197,94,0.25); color: #4ade80; }
.gt-seg-L.on { background: rgba(239,68,68,0.25); color: #f87171; }
.gt-seg-T.on { background: rgba(245,158,11,0.25); color: #fbbf24; }
.gt-outcome { margin-top: 10px; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.gt-seg-stage { max-width: 260px; }
.gt-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.gt-tags .gt-toggle.on { color: #f87171; border-color: rgba(239,68,68,0.5); background: rgba(239,68,68,0.12); }
.gt-tag-mini {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: rgba(239,68,68,0.1); color: #fca5a5; border: 1px solid rgba(239,68,68,0.25);
}
.gt-check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; cursor: pointer; }
.gt-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.gt-dropped { color: #fbbf24; }
.gt-small { font-size: 12.5px; }

/* Stats: loss-tag bars */
.gt-bars { display: flex; flex-direction: column; gap: 8px; }
.gt-bar-row { display: grid; grid-template-columns: minmax(110px, 160px) 1fr 28px; align-items: center; gap: 10px; font-size: 13.5px; }
.gt-bar-track { height: 10px; border-radius: 999px; background: rgba(255,255,255,0.05); overflow: hidden; }
.gt-bar { display: block; height: 100%; border-radius: 999px; background: #f87171; }
.gt-bar-n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Tournament decklist */
.gt-decklist { margin: 0 0 14px; border: 1px solid var(--border-light); border-radius: 10px; padding: 10px 14px; }
.gt-decklist summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.gt-decklist pre { white-space: pre-wrap; font: 13px/1.5 var(--font); margin: 10px 0; color: var(--text); }
.gt-decklist .gt-head-actions { flex-wrap: wrap; }
.gt-decklist a.btn-sm { text-decoration: none; }
.gt-diff { margin-top: 10px; font-size: 13.5px; display: flex; flex-direction: column; gap: 2px; }

@media (max-width: 520px) {
  .gt-games { gap: 6px; }
  .gt-game { padding: 8px 6px; }
  .gt-match { gap: 8px; padding: 8px 10px; }
  .gt-match .gt-icons { min-width: 36px; }
  .gt-match .gt-icons img { width: 44px; height: 44px; margin: -4px -9px; }
  .gt-tile-value { font-size: 19px; }
  .gt-col-last { display: none; }
  .gt-table th, .gt-table td { padding: 8px 7px; }
  .gt-table th:first-child, .gt-table td:first-child { padding-left: 10px; }
  .gt-table td:first-child { min-width: 130px; }
}

/* iOS Safari gives date inputs an intrinsic min-width and taller box, so they overflow
   their grid column and sit lower than neighbouring fields. Drop the native styling. */
.gt-row input[type="date"], #mDate, #tDate {
  -webkit-appearance: none; appearance: none;
  min-width: 0; max-width: 100%; display: block;
  min-height: 41px; line-height: 1.3;
}
input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
