/* style.css — gece Rift paleti: koyu mavi zemin, hextech pirinç vurgu,
   mavi/kırmızı yalnızca takım anlamı taşır. Tek tema (koyu), harici font yok. */

:root {
  --bg: #0a1018;
  --surface: #121c28;
  --surface-2: #182534;
  --line: #24344a;
  --text: #e8edf4;
  --muted: #8fa3b8;
  --brass: #c8a15a;
  --brass-dim: #8a6f3e;
  --blue: #3b82d9;
  --red: #d9524a;
  --ok: #4caf7d;
  --display: "Bahnschrift", "Arial Narrow", system-ui, sans-serif;
  --body: system-ui, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* display:flex vb. kurallar UA'nın [hidden] stilini ezmesin */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100dvh;
  padding-bottom: calc(64px + env(safe-area-inset-bottom)); /* tabbar payı */
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* ── Üst bar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.brand span { color: var(--brass); }
.key-btn {
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  min-height: 40px;
}
.key-btn:hover { color: var(--brass); border-color: var(--brass-dim); }

/* ── Ana yerleşim ── */
main { max-width: 720px; margin: 0 auto; padding: 16px; }
.view-hint { color: var(--muted); font-size: 14px; margin-bottom: 14px; }

/* ── Oyuncu kartları (dengeleme) ── */
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
  gap: 10px;
}
.player-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 60px; /* dokunmatik hedef */
  transition: border-color 0.12s, background 0.12s;
}
.player-card .p-name { font-weight: 600; }
.player-card .p-meta {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.player-card.selected {
  background: var(--surface-2);
  border-color: var(--brass);
  box-shadow: inset 3px 0 0 var(--brass);
}
.player-card.selected .p-meta { color: var(--brass); }

/* ── Rol ratingleri şeridi (role_ratings) ── */
.role-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}
.role-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}
.role-cell.zero { opacity: 0.38; }   /* hiç oynanmamış rol: default prior, gerçek veri değil */
.rc-role {
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.rc-score { font-size: 12px; font-weight: 600; }
.rc-matches { font-size: 9px; color: var(--muted); }
.player-card.selected .rc-score { color: var(--brass); }

/* Geniş yerleşim: sıralama tablosundaki açılır satır */
.role-strip.long {
  gap: 6px;
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}
.role-strip.long .role-cell {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 4px;
}
.role-strip.long .rc-role { font-size: 10px; text-transform: uppercase; }
.role-strip.long .rc-score { font-size: 15px; }
.role-strip.long .rc-matches { font-size: 10px; }

/* ── Yapışkan aksiyon barı ── */
.action-bar {
  position: sticky;
  bottom: calc(64px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.pick-counter {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}
.pick-counter span { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 2px; }
.pick-counter.small { font-size: 16px; color: var(--muted); }

.btn-primary {
  background: var(--brass);
  color: #14100a;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.03em;
  border-radius: 10px;
  padding: 12px 24px;
  min-height: 48px;
}
.btn-primary:disabled { background: var(--brass-dim); color: #2c2418; cursor: not-allowed; opacity: 0.6; }
.btn-primary:not(:disabled):hover { filter: brightness(1.08); }

/* ── Öneri kartları ── */
.suggestions { margin-top: 20px; scroll-margin-top: 12px; }
.sug-title {
  font-family: var(--display);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 10px;
}
.sug-title:only-child { display: none; }
.sug-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.sug-card.best { border-color: var(--brass); }
.best-badge {
  position: absolute;
  top: -10px;
  left: 14px;
  background: var(--brass);
  color: #14100a;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 10px;
  border-radius: 6px;
}
.sug-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}
.team { list-style: none; }
.team li {
  padding: 4px 0;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.team.blue li { border-left: 3px solid var(--blue); padding-left: 8px; }
.team.red li { border-left: 3px solid var(--red); padding-left: 8px; }
/* Rol etiketi + oyuncu adı (dengeleme önerileri ve maç kartları) */
.team li .p-who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-tag {
  flex: 0 0 auto;
  min-width: 44px;
  font-family: var(--display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  align-self: center;
}
.sug-mid { text-align: center; }
.quality {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}
.quality-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

/* İmza öğesi: mavi/kırmızıya yatan kazanma terazisi */
.winbar {
  height: 8px;
  margin-top: 14px;
  border-radius: 4px;
  background: var(--red);
  overflow: hidden;
}
.winbar-blue { height: 100%; background: var(--blue); border-right: 2px solid var(--bg); }
.winbar-caption {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* ── Leaderboard ── */
.board { width: 100%; border-collapse: collapse; }
.board th {
  font-family: var(--display);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.board td { padding: 12px 10px; border-bottom: 1px solid var(--line); }
.board .rank { width: 36px; color: var(--muted); font-variant-numeric: tabular-nums; }
.board tbody tr:first-child .rank,
.board tbody tr:first-child td:nth-child(2) { color: var(--brass); font-weight: 700; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.num.strong { font-weight: 600; }
/* Skorun altındaki ikincil satır: W/L çekirdeği + perf çarpanı */
.rating-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  margin-top: 2px;
}
/* Profili açan oyuncu adı (GÖREV 1) */
.name-link {
  padding: 0;
  font-weight: inherit;
  text-align: left;
  border-bottom: 1px dotted var(--line);
  transition: color 0.12s, border-color 0.12s;
}
.name-link:hover { color: var(--brass); border-bottom-color: var(--brass-dim); }

/* ── Oyuncu profili (GÖREV 1) ── */
.back-btn {
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  min-height: 40px;
  margin-bottom: 14px;
}
.back-btn:hover { color: var(--brass); border-color: var(--brass-dim); }

.prof-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-bottom: 14px;
}
.prof-name {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.prof-riot { color: var(--muted); font-size: 14px; }
.prof-score {
  margin-left: auto;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.prof-score span {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-left: 4px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.sc-title {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.sc-main { font-size: 18px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.sc-sub { font-size: 13px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }

.prof-section { margin-top: 18px; }
.ps-title {
  font-family: var(--display);
  font-size: 13px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 8px;
}
.ps-empty { color: var(--muted); font-size: 14px; }

.syn-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--brass-dim);
  border-radius: 10px;
  padding: 12px 14px;
}
.syn-top .syn-name { font-size: 18px; font-weight: 700; color: var(--brass); }
.syn-meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.syn-rest { list-style: none; margin-top: 8px; display: grid; gap: 6px; }
.syn-rest li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
}
.syn-link { padding: 0; text-align: left; font-weight: 600; transition: color 0.12s; }
.syn-link:hover { color: var(--brass); }

/* ── Haftanın enleri (GÖREV 2) ── */
.hl-window {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}
.hl-fb { color: var(--brass-dim); font-size: 13px; }

/* Büyük kartlar: solda etiket/ad/alt bilgi, sağda tek büyük değer. */
.hl-card {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.12s;
}
button.hl-card:hover { border-color: var(--brass-dim); }
.hl-card .hl-label { grid-area: 1 / 1; }
.hl-card .hl-name { grid-area: 2 / 1; }
.hl-card .hl-sub { grid-area: 3 / 1; }
.hl-card .hl-value { grid-area: 1 / 2 / 4 / 3; align-self: center; justify-self: end; }
.hl-label {
  font-family: var(--display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.hl-card .hl-name {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hl-sub { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hl-card .hl-value {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hl-unit {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-left: 4px;
}
/* Haftanın oyuncusu: ekranın tek vurgulu kartı. */
.hl-card.hero { background: var(--surface-2); border-color: var(--brass); }
.hl-card.hero .hl-name { font-size: 28px; color: var(--brass); }
.hl-card.hero .hl-value { font-size: 32px; color: var(--brass); }
/* Yıldız rukisi delta'sının rengi .delta.up/.down'dan gelir (yeşil/kırmızı). */
/* Veri yok işaretçisi ".hl-none"dır; global ".empty" (ortalı boş durum paragrafı)
   bilinçli olarak kullanılmaz — kart yerleşimini bozuyor. */
.hl-card.hl-none .hl-name { color: var(--muted); }

/* Dar ekranda 2 sütun, 560px'ten sonra 5 rolün tamamı tek sıra (auto-fit 4+1
   gibi dengesiz kırılımlar üretiyordu). */
.hl-roles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .hl-roles { grid-template-columns: repeat(5, 1fr); } }
.hl-role {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.12s;
}
button.hl-role:hover { border-color: var(--brass-dim); }
.hl-role.hl-none { opacity: 0.38; }      /* pencerede o rolde kimse oynamamış */
.hl-role .hl-label { font-size: 10px; letter-spacing: 0.1em; }
.hl-role .hl-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hl-role .hl-value {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  color: var(--brass);
  font-variant-numeric: tabular-nums;
}
.hl-role .hl-sub { font-size: 12px; }

/* ── Maç geçmişi ── */
.match-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.match-card.voided { opacity: 0.55; }
.match-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.win-tag {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 6px;
}
.win-tag.blue { background: color-mix(in srgb, var(--blue) 22%, transparent); color: var(--blue); }
.win-tag.red { background: color-mix(in srgb, var(--red) 22%, transparent); color: var(--red); }
.void-badge {
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 6px;
}
.match-teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.match-teams .team li { font-size: 14px; }
.team .delta { font-variant-numeric: tabular-nums; font-size: 13px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--red); }
.delta.none { color: var(--muted); }
.match-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-void, .btn-roles {
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  min-height: 40px;
}
.btn-void:hover { color: var(--red); border-color: var(--red); }
.btn-roles:hover { color: var(--brass); border-color: var(--brass-dim); }

/* ── Rol düzeltme paneli (PUT /matches/{id}/positions) ── */
.role-editor {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.re-list { list-style: none; display: grid; gap: 6px; }
@media (min-width: 560px) { .re-list { grid-template-columns: 1fr 1fr; column-gap: 12px; } }
.re-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-left: 8px;
  font-size: 14px;
}
.re-row .p-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.re-row.blue { border-left: 3px solid var(--blue); }
.re-row.red { border-left: 3px solid var(--red); }
.re-row select {
  flex: 0 0 auto;
  min-height: 40px;
  min-width: 104px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  padding: 4px 8px;
}
.btn-save-roles { margin-top: 12px; font-size: 14px; padding: 10px 20px; min-height: 44px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* ── Manuel giriş ── */
.manual-list { display: flex; flex-direction: column; gap: 8px; }
.manual-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 8px 8px 14px;
}
.manual-row .p-name { font-weight: 600; }
.team-toggle { display: flex; gap: 6px; }
.team-toggle button {
  min-height: 44px;
  min-width: 72px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.team-toggle .tt-blue[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.team-toggle .tt-red[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }

.winner-pick {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.winner-pick legend {
  font-family: var(--display);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 0 6px;
}
.winner-opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  margin-right: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.winner-opt.blue { color: var(--blue); }
.winner-opt.red { color: var(--red); }
.winner-opt input { accent-color: currentColor; width: 18px; height: 18px; }

/* ── Alt sekme çubuğu ── */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}
/* 5 sekme dar telefonda da tek satırda kalmalı: etiketler kısa tutuldu, ölçek
   14px yerine 12px'e indirildi, en dar ekranlarda 11px'e düşer. */
.tab {
  flex: 1;
  min-width: 0;
  min-height: 56px;
  padding: 0 2px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--muted);
  border-top: 2px solid transparent;
}
.tab.active { color: var(--brass); border-top-color: var(--brass); }
@media (max-width: 400px) { .tab { font-size: 11px; letter-spacing: 0.01em; } }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 12, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 30;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--brass-dim);
  border-radius: 14px;
  padding: 24px;
  max-width: 380px;
  width: 100%;
}
.modal h2 { font-family: var(--display); font-size: 18px; text-transform: uppercase; letter-spacing: 0.08em; }
.modal p { color: var(--muted); font-size: 14px; margin: 10px 0 16px; }
.modal code { color: var(--brass); }
.modal input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  padding: 12px;
  margin-bottom: 14px;
}
.modal .btn-primary { width: 100%; }

/* ── Toast ── */
.toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(92vw, 480px);
  background: var(--surface-2);
  border: 1px solid var(--red);
  color: var(--text);
  font-size: 14px;
  padding: 12px 18px;
  border-radius: 10px;
  z-index: 40;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}
.toast.ok { border-color: var(--ok); }
.toast.warn { border-color: var(--brass); }

/* ── Geniş ekran ── */
@media (min-width: 768px) {
  main { padding: 24px; }
  .roster-grid { grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
