:root {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #111114;
  --surface-2: #18181c;
  --surface-3: #1f1f24;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #ededef;
  --muted: #a0a0aa;
  --faint: #6e6e78;
  --accent: #f1c27b;
  --ban: #ff6a5c;
  --ban-soft: rgba(255, 106, 92, 0.12);
  --warn: #f4b740;
  --warn-soft: rgba(244, 183, 64, 0.1);
  --good: #61d69c;
  --info: #8ab4ff;

  --iron: #8c8580; --bronze: #b77b5c; --silver: #a9b4c2; --gold: #e2b64f;
  --platinum: #4fc1b2; --emerald: #39c47f; --diamond: #7b9bff; --master: #c17be6;
  --grandmaster: #f0605b; --challenger: #f6d27a; --unranked: #6e6e78;

  --radius: 14px;
  --radius-sm: 10px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------------ top bar */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 16px;
}
.brand-mark { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }

select {
  appearance: none;
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a0a0aa' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 28px 0 11px;
  height: 36px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}
.region select { font-weight: 500; font-family: var(--mono); font-size: 13px; }

/* ------------------------------------------------------------------- layout */
.layout {
  flex: 1;
  display: grid;
  gap: 16px;
  align-items: start;
}
@media (min-width: 980px) {
  .layout { grid-template-columns: 380px minmax(0, 1fr); gap: 24px; }
  .form-panel { position: sticky; top: 16px; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: none;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn:disabled:active { transform: none; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary { background: var(--text); color: var(--bg); font-weight: 600; flex: 1; }
.btn-quiet { background: var(--surface-2); border-color: var(--line); color: var(--muted); }
.btn-shot {
  flex: 1;
  background: var(--surface-2);
  border: 1px dashed var(--line-2);
  color: var(--text);
}
.btn-shot .kbd { margin-left: 2px; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: #fff; }
  .btn-quiet:hover { border-color: var(--line-2); color: var(--text); }
  .btn-shot:hover { border-color: rgba(241, 194, 123, 0.5); background: var(--surface-3); }
  select:hover { border-color: var(--line-2); }
}
@media (pointer: coarse) { .kbd { display: none; } }

.kbd {
  font: 500 11px/1 var(--mono);
  color: var(--faint);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 3px 5px;
}

/* -------------------------------------------------------------- screenshot */
.shot { display: grid; gap: 8px; margin-bottom: 14px; }
.shot-actions { display: flex; gap: 8px; }
.shot-hint { margin: 0; color: var(--faint); font-size: 13px; }

.ocr {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.ocr-thumb {
  width: 76px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--surface-3);
  cursor: zoom-in;
}
.ocr-body { flex: 1; min-width: 0; }
.ocr-msg { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.ocr-msg b { color: var(--text); font-weight: 500; }
.ocr-bar { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.ocr-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 150ms linear;
}
.ocr[data-state="done"] .ocr-bar, .ocr[data-state="error"] .ocr-bar { display: none; }
.ocr[data-state="done"] .ocr-msg, .ocr[data-state="error"] .ocr-msg { margin: 0; }

/* --------------------------------------------------------------- name rows */
.rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; min-width: 0; }
.row-idx {
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  color: var(--faint);
  font: 500 12px var(--mono);
}
.row input {
  flex: 1;
  width: 0; /* let flex size it, not the input's built-in width */
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  font-size: 16px; /* 16px keeps iOS from zooming in on focus */
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 150ms ease, background-color 150ms ease;
}
.row input::placeholder { color: var(--faint); }
.row input:focus { border-color: rgba(241, 194, 123, 0.55); background: var(--surface-3); }
.row select { height: 44px; width: 124px; flex-shrink: 0; font-size: 14px; }
.row select.unset { color: var(--faint); }
.row.filled input, .row.filled select { border-color: rgba(241, 194, 123, 0.4); }

.form-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ---------------------------------------------------------------- results */
.results { min-width: 0; display: grid; gap: 16px; scroll-margin-top: 12px; }

.empty { padding: 8px 4px; }
.empty-title {
  margin: 0 0 14px;
  font-size: clamp(24px, 5vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-weight: 600;
  max-width: 20ch;
  text-wrap: balance;
}
.empty-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; max-width: 60ch; color: var(--muted); }
.empty-list li { padding-left: 18px; position: relative; }
.empty-list li::before { content: ""; position: absolute; left: 2px; top: 0.65em; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); opacity: 0.7; }
.empty-list b { color: var(--text); font-weight: 500; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
}
.section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-note { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* bans */
.bans { border-color: rgba(255, 106, 92, 0.22); background: linear-gradient(180deg, rgba(255, 106, 92, 0.06), rgba(255, 106, 92, 0) 120px), var(--surface); }
.bans .section-title { color: var(--ban); }
.ban-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ban {
  display: grid;
  grid-template-columns: 18px 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 7px 4px;
  border-radius: var(--radius-sm);
}
.ban + .ban { border-top: 1px solid var(--line); border-radius: 0; }
.ban-n { font: 600 13px var(--mono); color: var(--faint); text-align: center; }
.ban:first-child .ban-n { color: var(--ban); }
.ban-champ { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ban-name { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.ban:first-child .ban-name { font-size: 18px; }
.ban-why { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ban-why b { color: var(--text); font-weight: 500; }
.ban-why .sep { color: var(--faint); margin: 0 5px; }
.tag-otp {
  font: 600 10px/1 var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ban);
  background: var(--ban-soft);
  padding: 4px 6px;
  border-radius: 5px;
}

/* champion icons */
.icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  flex-shrink: 0;
  background: var(--surface-3);
  object-fit: cover;
  box-shadow: inset 0 0 0 1px var(--line);
}
.icon-sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-fallback {
  display: grid;
  place-items: center;
  font: 600 12px var(--font);
  color: var(--faint);
}

/* links bar */
.linkbar { display: flex; gap: 8px; flex-wrap: wrap; }
.linkbar .btn { height: 40px; font-size: 14px; }
.linkbar .btn-multi {
  flex: 1;
  height: 48px;
  font-size: 15px;
  font-weight: 600;
  min-width: 0;
  justify-content: space-between;
  text-decoration: none;
  background: var(--accent);
  color: #1a1408;
}
.linkbar .btn-quiet { height: 48px; }
.btn-multi span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) {
  .btn-multi:hover { background: #f6d29a; }
}
.meta-line { font-size: 12px; color: var(--faint); margin: -6px 2px 0; font-variant-numeric: tabular-nums; }

/* player cards */
.players { display: grid; gap: 12px; }
@media (min-width: 720px) { .players { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}
.card.unsure { border-color: rgba(244, 183, 64, 0.35); }
.card.missing { border-style: dashed; }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.who { min-width: 0; }
.who-name {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  max-width: 100%;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.who-name .tagline { color: var(--faint); font-weight: 500; }
@media (hover: hover) and (pointer: fine) {
  a.who-name:hover { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
}
.who-sub { font-size: 12px; color: var(--faint); margin-top: 2px; font-variant-numeric: tabular-nums; }

.rank {
  --tier: var(--unranked);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 9px 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tier) 14%, transparent);
  color: color-mix(in srgb, var(--tier) 70%, white);
  white-space: nowrap;
}
.rank::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--tier); transform: rotate(45deg); }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font: 600 11px/1 var(--font);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--muted);
}
.badge.otp { background: var(--ban-soft); color: var(--ban); }
.badge.two { background: rgba(244, 183, 64, 0.12); color: var(--warn); }
.badge.three { background: rgba(244, 183, 64, 0.08); color: #e7c88a; }
.badge.flex { color: var(--info); background: rgba(138, 180, 255, 0.1); }

.note {
  font-size: 13px;
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  background: var(--surface-2);
  color: var(--muted);
  display: grid;
  gap: 8px;
}
.note.warn { background: var(--warn-soft); color: #f3d79a; }
.note b { font-weight: 600; color: inherit; }
.note.warn b { color: var(--warn); }
.swap { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: transform 160ms var(--ease-out), border-color 150ms ease;
}
.chip:active { transform: scale(0.97); }
.chip span { color: var(--faint); margin-left: 4px; }
@media (hover: hover) and (pointer: fine) { .chip:hover { border-color: rgba(255, 255, 255, 0.28); } }

.champs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.champ {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}
.champ-main { min-width: 0; display: grid; gap: 4px; }
.champ-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.share i { display: block; height: 100%; background: var(--faint); transform-origin: left; }
.champ-main-pick .share i { background: var(--accent); }
.champ-games { font-size: 13px; color: var(--muted); text-align: right; min-width: 3.5ch; }
.champ-wr { font: 500 13px var(--mono); text-align: right; min-width: 4.5ch; color: var(--text); }
.champ-wr.hot { color: var(--ban); }
.champ-wr.cold { color: var(--faint); }
.champs-head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  gap: 10px;
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.champs-head span:nth-child(3) { min-width: 3.5ch; text-align: right; }
.champs-head span:nth-child(4) { min-width: 4.5ch; text-align: right; }

.mastery { display: flex; flex-wrap: wrap; gap: 8px; }
.mastery-item { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.mastery-item b { color: var(--text); font-weight: 500; }
.empty-champs { font-size: 13px; color: var(--faint); margin: 0; }

.error { border-color: rgba(255, 106, 92, 0.3); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.error p { margin: 0; color: var(--muted); font-size: 14px; }
.error b { color: var(--text); }

/* -------------------------------------------------------------- skeleton */
.sk {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 6px;
}
.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.045), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.1s linear infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 12px; }
.sk-icon { width: 40px; height: 40px; border-radius: 9px; }
.sk-row { display: grid; grid-template-columns: 18px 40px 1fr; gap: 10px; align-items: center; padding: 7px 4px; }
.sk-name { font-weight: 600; font-size: 16px; color: var(--muted); }

/* --------------------------------------------------------------- entrance */
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
@keyframes fade { from { opacity: 0; } }
.enter { animation: enter 240ms var(--ease-out) both; animation-delay: var(--d, 0ms); }

@media (prefers-reduced-motion: reduce) {
  .enter { animation-name: fade; }
  .sk::after { animation: none; }
  .btn:active, .chip:active { transform: none; }
}

/* ------------------------------------------------------------------ misc */
.foot { padding: 28px 0 8px; font-size: 12px; color: var(--faint); text-align: center; }

.dropzone {
  position: fixed;
  inset: 10px;
  z-index: 10;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(241, 194, 123, 0.6);
  border-radius: 18px;
  background: rgba(9, 9, 11, 0.82);
  font-weight: 600;
  font-size: 18px;
  pointer-events: none;
}
.dropzone[hidden] { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.85);
  cursor: zoom-out;
  animation: fade 180ms var(--ease-out);
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

/* ------------------------------------------------------- about + FAQ */
.brand-lol { color: var(--accent); }

.about {
  max-width: 760px;
  margin: 56px auto 0;
  padding: 0 2px;
  color: var(--muted);
}
.about h2 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 20px;
  letter-spacing: -0.02em;
  font-weight: 600;
}
.about h2 + .faq { margin-top: 4px; }
.about-lead { margin: 0 0 18px; max-width: 65ch; }
.steps { margin: 0 0 40px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 12px 14px 12px 46px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 12px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font: 600 12px var(--mono);
  color: var(--accent);
  background: rgba(241, 194, 123, 0.1);
}
.steps b, .faq b { color: var(--text); font-weight: 500; }

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 28px 14px 2px;
  position: relative;
  color: var(--text);
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 1.5px solid var(--faint);
  border-bottom: 1.5px solid var(--faint);
  transform: rotate(45deg);
  transition: transform 200ms var(--ease-out);
}
.faq details[open] summary::after { transform: translateY(3px) rotate(225deg); }
.faq p { margin: 0 0 16px; padding: 0 2px; max-width: 65ch; }
@media (hover: hover) and (pointer: fine) {
  .faq summary:hover::after { border-color: var(--muted); }
}
@media (prefers-reduced-motion: reduce) { .faq summary::after { transition: none; } }
