/* PROPS 3+ Stats — premium look aligned with kupon-app */
:root {
  --bg: #F2F3F5;
  --card: #FFFFFF;
  --text: #121317;
  --muted: #6B7080;
  --muted-2: #9CA3AF;
  --line: #E4E6EB;
  --line-2: #EEF0F3;
  --accent: #0A84FF;
  --accent-press: #0B4FD6;
  --miss: #E10019;
  --green: #22A34A;
  --green-soft: #E8F7ED;
  --red-soft: #FDECEE;
  --yellow: #C9A227;
  --yellow-bg: #F8F1D8;
  --input: #F7F8FA;
  --shadow: 0 1px 2px rgba(16, 18, 27, 0.04), 0 4px 14px rgba(16, 18, 27, 0.06);
  --shadow-lg: 0 2px 6px rgba(16, 18, 27, 0.05), 0 12px 32px rgba(16, 18, 27, 0.10);
  --radius: 16px;
  --radius-sm: 14px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: Inter, Roboto, "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
}

html[data-theme="dark"] {
  --bg: #121316;
  --card: #1E1F24;
  --text: #F3F4F6;
  --muted: #9CA3AF;
  --muted-2: #6B7280;
  --line: #2A2C33;
  --line-2: #26272C;
  --input: #18191D;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 6px 18px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
  --green-soft: #16351f;
  --red-soft: #3a1518;
  --yellow-bg: #3a3318;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
html { height: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.35;
  min-height: 100%;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.003em;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { max-width: 100%; display: block; }

#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  background: var(--bg);
}

#view {
  padding: 14px 16px calc(var(--nav-h) + var(--safe-b) + 20px);
  min-height: 100dvh;
}

h1.page-title {
  margin: 6px 2px 14px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px 16px;
}
.card + .card { margin-top: 12px; }

/* brand */
.brand-bar {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 16px 18px 15px;
  margin: 0 0 18px;
  color: #fff;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 55%),
    linear-gradient(135deg, #1F6FFF 0%, #0A84FF 48%, #0B4FD6 100%);
  box-shadow: 0 10px 26px rgba(11, 79, 214, 0.32), inset 0 1px 0 rgba(255,255,255,0.18);
}
.brand-bar::after {
  content: "";
  position: absolute;
  right: -30px; top: -40px;
  width: 150px; height: 150px;
  border-radius: 50%;
  border: 18px solid rgba(255,255,255,0.07);
}
.brand-mark {
  position: relative;
  font-size: 28px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.brand-mark span {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 8px 3px;
  border-radius: 8px;
  background: #fff;
  color: #0B4FD6;
  font-style: italic;
  text-shadow: none;
}
.brand-sub {
  position: relative;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.82);
  text-transform: uppercase;
}

/* forms / search */
.field { margin-bottom: 0; position: relative; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="url"],
.input {
  width: 100%;
  background: var(--input);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  min-width: 0;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .input:focus {
  background: var(--card);
  border-color: rgba(10, 132, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.10);
}
html[data-theme="dark"] .field input:focus,
html[data-theme="dark"] .input:focus { background: #1A1B20; }

.ac-list {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}
.ac-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 10px;
  min-width: 0;
}
.ac-item:hover, .ac-item.active { background: var(--line-2); }
.ac-item .ac-logo {
  width: 28px; height: 28px; flex: 0 0 28px;
  object-fit: contain;
}
.ac-item .ac-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-item .ac-meta {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-empty { padding: 10px 12px; font-size: 13px; color: var(--muted); }

.search-hint {
  margin: 10px 2px 0;
  font-size: 12px;
  color: var(--muted);
}

/* recent */
.section-label {
  margin: 20px 2px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.recent-item .avatar, .ph-photo, .ph-photo img {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line-2);
  flex: 0 0 44px;
}
.recent-item .nm {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-item .meta { font-size: 12px; color: var(--muted); }
.recent-item .chev { margin-left: auto; color: var(--muted-2); }

/* player header */
.page-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}
.back-btn {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  display: grid; place-items: center;
  color: var(--text);
}
.back-btn svg { width: 20px; height: 20px; }
.page-head .htitle {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.player-card { padding: 16px; }
.player-top {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.ph-photo {
  width: 72px; height: 72px; flex: 0 0 72px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--line-2);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px rgba(10,132,255,0.28);
}
.ph-photo img { width: 72px; height: 72px; }
.ph-info { min-width: 0; flex: 1; }
.ph-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.ph-team {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
}
.ph-team img { width: 20px; height: 20px; flex: 0 0 20px; object-fit: contain; }
.ph-team span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avg-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 14px;
}
.avg-box {
  background: var(--line-2);
  border-radius: 12px;
  padding: 8px 4px 7px;
  text-align: center;
  min-width: 0;
}
.avg-box .v {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.avg-box .l {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

/* chips / range */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 0 12px;
  padding: 0 0 2px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(10, 132, 255, 0.28);
}

.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.league-tabs {
  display: flex;
  background: var(--line-2);
  border-radius: 14px;
  padding: 4px;
  margin: 0 0 16px;
}
.league-tabs button {
  flex: 1;
  border-radius: 11px;
  padding: 9px 6px;
  font-size: 14px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.league-tabs button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
}

.range-tabs {
  display: flex;
  background: var(--line-2);
  border-radius: 12px;
  padding: 3px;
  flex: 1;
}
.range-tabs button {
  flex: 1;
  border-radius: 10px;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.range-tabs button.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
}

.line-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.line-field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.line-field input {
  width: 72px;
  background: var(--input);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px 8px;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.line-field input:focus {
  border-color: rgba(10, 132, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.10);
}

/* hit + stats */
.hit-banner {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.hit-banner.good { background: var(--green-soft); color: var(--green); }
.hit-banner.bad { background: var(--red-soft); color: var(--miss); }
.hit-banner.mid { background: var(--yellow-bg); color: var(--yellow); }
.hit-banner .pct { font-size: 22px; letter-spacing: -0.03em; }
.hit-banner .lbl { font-size: 14px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 6px;
}
.stat-grid .box {
  text-align: center;
  min-width: 0;
}
.stat-grid .v {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-grid .l {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}
.mpg-note {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin: 4px 0 10px;
}

/* chart */
.chart-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
  scrollbar-width: thin;
}
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg .val {
  font-size: 9px;
  font-weight: 800;
  fill: var(--text);
  text-anchor: middle;
  font-variant-numeric: tabular-nums;
}
.chart-svg .opp, .chart-svg .dt, .chart-svg .min {
  text-anchor: middle;
  fill: var(--muted);
  font-weight: 700;
}
.chart-svg .opp { font-size: 8px; }
.chart-svg .dt { font-size: 7.5px; }
.chart-svg .min { font-size: 7px; fill: var(--muted-2); }
.chart-svg .line-lab {
  font-size: 9px;
  font-weight: 800;
  fill: var(--muted);
}

.legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.legend i {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  margin-right: 5px;
}
.legend .g { background: var(--green); }
.legend .r { background: var(--miss); }

/* settings */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  min-width: 0;
}
.setting-row + .setting-row { border-top: 1px solid var(--line-2); }
.setting-row .slabel { font-weight: 700; min-width: 0; }
.setting-row .shint { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 2px; }

.toggle {
  position: relative;
  width: 48px; height: 28px; flex: 0 0 48px;
  border-radius: 999px;
  background: #D1D5DB;
  border: 0;
  transition: background 0.15s;
}
.toggle.on { background: var(--accent); }
.toggle i {
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
  display: block;
}
.toggle.on i { transform: translateX(20px); }

.btn-secondary {
  display: block;
  width: 100%;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  margin-top: 12px;
}

.note {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 16px;
  font-size: 14px;
}

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  background: var(--red-soft);
  color: var(--miss);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
}

/* nav */
#tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  bottom: 0;
  z-index: 40;
  background: rgba(255,255,255,0.92);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid rgba(16,18,27,0.06);
  box-shadow: 0 -6px 20px rgba(16,18,27,0.05);
  display: flex;
  padding: 6px 4px calc(6px + var(--safe-b));
  height: calc(var(--nav-h) + var(--safe-b));
}
html[data-theme="dark"] #tabbar {
  background: rgba(30,31,36,0.92);
  border-top-color: rgba(255,255,255,0.06);
}
#tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  min-width: 0;
  padding: 4px 0 0;
  position: relative;
}
#tabbar button svg { width: 22px; height: 22px; }
#tabbar button.active { color: var(--accent); }
#tabbar button.active::before {
  content: "";
  position: absolute;
  top: -6px; left: 50%;
  width: 28px; height: 3px;
  margin-left: -14px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  z-index: 80;
  background: #1A1A1A;
  color: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  max-width: 90%;
  box-shadow: var(--shadow-lg);
}
#toast[hidden] { display: none !important; }

@media (max-width: 370px) {
  .ph-name { font-size: 18px; }
  .avg-box .v { font-size: 13px; }
  .hit-banner .pct { font-size: 18px; }
}
