* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* Canvas — near-neutral white */
  --bg: #F7F8FC; --bg-pure: #FFFFFF; --bg-subtle: #F1F1FC;
  /* Glass — raised white */
  --glass: rgba(255,255,255,.78); --glass-strong: rgba(255,255,255,.86);
  --glass-soft: rgba(255,255,255,.6); --glass-border: rgba(30,35,60,.07);
  /* Typography — graphite */
  --text: #181A24; --text-secondary: #7B8093; --muted: #9aa0b2;
  /* The single accent — sophisticated indigo */
  --accent: #6266F1; --accent-hover: #5458e6; --accent-soft: #F1F1FC;
  /* Light-effect tints (glow/specular only, never fills) */
  --blue-light: #8CB8FF; --violet-light: #8B78F6;
  --glow: linear-gradient(120deg, rgba(140,184,255,.45), rgba(139,120,246,.35));
  /* Borders — cool hairline */
  --line: rgba(20,24,45,.07); --border-active: rgba(98,102,241,.3);
  /* Shadows — neutral/cool grey, not blue */
  --shadow-sm: 0 1px 2px rgba(15,20,40,.04), 0 10px 30px rgba(35,45,90,.05);
  --shadow-md: 0 2px 6px rgba(15,20,40,.05), 0 16px 44px rgba(35,45,90,.07);
  --shadow-glow: 0 12px 40px rgba(98,102,241,.10);
  /* legacy aliases (kept so nothing breaks) */
  --purple: var(--accent); --violet: var(--accent); --blue: var(--accent);
  --blue-deep: var(--accent); --pink: #e11d74; --green: #16a34a;
  --gradient-primary: var(--accent); --glass-line: var(--glass-border); --bg-soft: var(--bg-subtle);
}
.glass {
  background: var(--glass); backdrop-filter: blur(20px) saturate(130%); -webkit-backdrop-filter: blur(20px) saturate(130%);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm);
}
html { background: #fff; }
body {
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  letter-spacing: -0.01em; padding-bottom: 100px;
  background:
    radial-gradient(circle at 12% 8%, rgba(140,184,255,.07), transparent 26%),
    radial-gradient(circle at 88% 6%, rgba(139,120,246,.06), transparent 26%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--accent); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- lock / login screen ---------- */
.lock-screen {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(circle at 15% 10%, rgba(140,184,255,.08), transparent 30%),
    radial-gradient(circle at 85% 90%, rgba(139,120,246,.06), transparent 30%),
    var(--bg);
}
.lock-card {
  width: 100%; max-width: 360px; text-align: center;
  background: var(--glass-strong); backdrop-filter: blur(20px) saturate(130%); -webkit-backdrop-filter: blur(20px) saturate(130%);
  border: 1px solid var(--glass-border); border-radius: 24px;
  padding: 38px 28px; box-shadow: var(--shadow-md);
}
.lock-badge {
  width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 20px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 1.9rem;
  box-shadow: var(--shadow-glow);
}
.lock-card h1 { color: var(--violet); font-family: "Space Grotesk", sans-serif; font-size: 1.5rem; margin-bottom: 4px; }
.lock-sub { color: var(--muted); font-size: .9rem; margin-bottom: 26px; }
.lock-card input {
  width: 100%; background: rgba(255,255,255,.8); border: 1px solid rgba(33,45,90,.12);
  color: var(--text); border-radius: 12px; padding: 13px 16px; font-size: 1rem; text-align: center; margin-bottom: 12px;
}
.lock-card input::placeholder { color: var(--muted); }
.lock-card input:focus { outline: none; border-color: var(--purple); background: #fff; }
.lock-error { color: var(--pink); font-size: .85rem; min-height: 1.2em; margin-top: 10px; }

/* ---------- setup wizard ---------- */
.setup-screen {
  position: fixed; inset: 0; z-index: 50; background: #fff;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.setup-card { max-width: 440px; width: 100%; text-align: center; }
.setup-emoji { font-size: 3rem; margin-bottom: 8px; }
.setup-card h1 { color: var(--violet); margin-bottom: 10px; font-size: 1.6rem; }
.setup-card .lead { color: var(--muted); line-height: 1.55; margin-bottom: 16px; font-size: .95rem; }
.setup-card .how { list-style: none; text-align: left; margin: 0 auto 22px; max-width: 360px; }
.setup-card .how li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.setup-card .how li:last-child { border-bottom: none; }
.setup-card .how b { color: var(--purple); margin-right: 6px; }
.url-example {
  font-family: Consolas, monospace; font-size: .85rem; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px;
  word-break: break-all;
}
.url-example b { color: var(--pink); }
.big-input { width: 100%; font-size: 1.1rem; text-align: center; padding: 12px; margin-bottom: 14px; }
.btn.big { width: 100%; padding: 13px; font-size: 1rem; margin-bottom: 10px; }
.btn.link { background: none; border: none; color: var(--muted); text-decoration: underline; font-size: .85rem; }
.fine-inline { font-size: .78rem; }
.login-status { font-size: .85rem; margin-bottom: 10px; min-height: 1.2em; }
.login-status.ok { color: #059654; font-weight: 600; }
.login-status.bad { color: var(--pink); }
.dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 26px; }
.dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots span.on { background: var(--purple); }

/* ---------- banner / header ---------- */
.banner {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  background: rgba(255,255,255,.72); backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.crest {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
  background: var(--bg-pure); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  background-size: cover; background-position: center;
}
.header-main { flex: 1; min-width: 0; }
.team-name { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.3rem; color: var(--text); letter-spacing: -0.02em; line-height: 1.1; }
.profile { color: var(--text-secondary); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.meta-line { color: var(--accent); font-size: .76rem; font-weight: 600; margin-top: 3px; }
.meta-line.busy { color: var(--accent); }
.dot { color: var(--muted); margin: 0 2px; }
/* display font for headings, stats, player names */
.setup-card h1, .section h2, .stat b, .plate .pname, .decision .d-title, h1 { font-family: "Space Grotesk", "Segoe UI", sans-serif; }
.banner-right { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.icon-btn { border-radius: 50%; }

/* ---------- buttons / inputs ---------- */
.btn { background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 16px; cursor: pointer; font-size: .88rem; }
.btn:hover { border-color: var(--border-active); }
.btn.primary { background: var(--accent); color: #fff; border: none; font-weight: 600; box-shadow: 0 2px 8px rgba(98,102,241,.2); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.small { padding: 4px 10px; font-size: .76rem; }
.btn.round { border-radius: 50%; width: 42px; height: 42px; padding: 0; font-size: 1.1rem; flex: none; }
.btn.danger { color: var(--pink); border-color: var(--pink); }
.btn:disabled { opacity: .5; cursor: wait; }
input { background: #fff; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 12px; font-size: .92rem; }
input:focus { outline: none; border-color: var(--purple); }

/* ---------- stats row ---------- */
main { max-width: 760px; margin: 0 auto; padding: 16px; }
.stats-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { flex: 1; min-width: 100px; background: var(--bg-pure); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; text-align: center; box-shadow: var(--shadow-sm); }
.stat b { display: block; font-size: 1.3rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.stat span { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 500; }

/* ---------- pitch ---------- */
.pitch-wrap { margin-bottom: 22px; }
.pitch {
  position: relative; border-radius: 18px 18px 0 0; padding: 22px 8px 16px;
  background: linear-gradient(180deg, #059f4d 0%, #12c265 50%, #059f4d 100%);
  background-size: 100% 25%;
  min-height: 300px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  box-shadow: 0 12px 34px rgba(4,145,74,.28);
}
.pitch::before {
  content: ""; position: absolute; inset: 10px; border: 2px solid rgba(255,255,255,.35);
  border-radius: 6px; pointer-events: none;
}
.pitch::after {
  content: ""; position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  width: 130px; height: 56px; border: 2px solid rgba(255,255,255,.35); border-top: none;
  border-radius: 0 0 8px 8px; pointer-events: none;
}
.pitch-empty { color: #fff; text-align: center; margin: auto; font-weight: 600; opacity: .85; }
.prow { display: flex; justify-content: center; gap: 4px; position: relative; z-index: 1; }
.player { width: 78px; text-align: center; cursor: default; }
.kit-wrap { position: relative; width: 40px; height: 38px; margin: 0 auto 2px; }
.kit { width: 40px; height: auto; display: block; filter: drop-shadow(0 3px 4px rgba(0,0,0,.3)); }
.kit-fallback {
  width: 36px; height: 36px; margin: 0 auto; border-radius: 50%;
  background: rgba(255,255,255,.85); color: var(--purple); font-weight: 800; font-size: .64rem;
  display: flex; align-items: center; justify-content: center;
}
.kit-wrap .cap-badge {
  position: absolute; top: -4px; right: -2px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--purple); color: #fff; font-size: .6rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.4); z-index: 1;
}
.kit-wrap .cap-badge.v { background: #555; }
.kit-wrap .live-pts {
  position: absolute; bottom: -4px; right: -6px; min-width: 20px; height: 20px; border-radius: 10px;
  background: var(--blue); color: #fff; font-size: .68rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.4); border: 1.5px solid #fff;
}
.kit-wrap .flag {
  position: absolute; bottom: -2px; left: -2px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--pink); color: #fff; font-size: .62rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.plate {
  background: rgba(255,255,255,.16); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 6px; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.plate .pname { display: block; color: #fff; font-size: .66rem; font-weight: 700; padding: 2px 4px 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.plate .pmeta { display: block; background: rgba(255,255,255,.92); color: var(--text); font-size: .6rem; font-weight: 600;
  padding: 1px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bench {
  display: flex; justify-content: center; gap: 4px; padding: 12px 8px;
  background: rgba(247,245,249,.6); backdrop-filter: blur(10px); border-radius: 0 0 18px 18px;
}
.bench:empty { display: none; }
.bench .plate .pname { background: rgba(111,106,117,.4); }

/* ---------- sections ---------- */
.section { margin-bottom: 20px; }
.section h2 { font-size: .95rem; margin-bottom: 10px; display: inline-flex; align-items: center; gap: 8px; }
.spark { color: var(--accent); font-size: .9em; }
.count { font-size: .7rem; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 20px; padding: 2px 10px; color: var(--muted); font-weight: 500; }
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary h2::after { content: "▸"; color: var(--muted); font-size: .8rem; }
details[open] summary h2::after { content: "▾"; }

.decision {
  background: var(--glass); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--glass-line); border-left: 3px solid var(--accent);
  border-radius: 14px; padding: 13px 16px; margin-bottom: 10px;
  box-shadow: 0 6px 20px rgba(33,45,90,.06);
}
.decision.transfer { border-left-color: var(--accent); }
.decision .d-title { font-weight: 700; margin-bottom: 4px; }
.decision .d-title .out { color: var(--pink); } .decision .d-title .in { color: #059654; }
.decision .d-sub { color: var(--muted); font-size: .82rem; line-height: 1.45; margin-bottom: 8px; }
.decision .d-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.decision.dismissed { opacity: .4; }
.gain-tag { color: #059654; font-weight: 700; font-size: .82rem; }
.hit-tag { color: var(--pink); font-weight: 700; font-size: .72rem; background: rgba(225,29,116,.1); border-radius: 6px; padding: 1px 6px; }
.opinion { margin-top: 8px; }
.opinion-body { background: rgba(150,60,255,.08); border-radius: 10px; padding: 10px 12px; font-size: .82rem; line-height: 1.5; white-space: pre-wrap; }
.opinion-body b { color: var(--purple); }

.watchlist .wl { display: flex; justify-content: space-between; align-items: center; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: .86rem; }
.watchlist .wl:last-child { border-bottom: none; }
.wl .meta { color: var(--muted); font-size: .76rem; }
.pos { font-size: .64rem; border-radius: 4px; padding: 1px 6px; font-weight: 700; color: #fff; margin-right: 6px; }
.pos.GKP { background: #d4a017; } .pos.DEF { background: #2d6cdf; }
.pos.MID { background: #7b3fbf; } .pos.FWD { background: #e0475b; }

.settings-body { padding-top: 6px; display: flex; flex-direction: column; gap: 16px; }
.setting-row { display: flex; flex-direction: column; gap: 6px; }
.setting-row label { font-size: .72rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .4px; }
.setting-row input { width: 100%; }
.setting-row .row-inline { display: flex; gap: 8px; align-items: center; }
.setting-row .row-inline input { flex: 1; min-width: 0; }
#authStatus { display: block; margin-top: 4px; font-size: .74rem; }
.toggle { display: flex; gap: 8px; align-items: flex-start; font-size: .84rem; cursor: pointer; }
.toggle input { margin-top: 3px; }
.fine { font-size: .72rem; color: var(--muted); }
.constraints .chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 20px; padding: 3px 12px; margin: 0 6px 6px 0; font-size: .8rem; }
.chip.lock { border-color: #059654; } .chip.ban { border-color: var(--pink); }
.chip button { background: none; border: none; color: var(--muted); cursor: pointer; }

.activity { max-height: 240px; overflow-y: auto; padding-top: 8px; }
.act { font-size: .8rem; padding: 4px 0 4px 10px; border-left: 3px solid var(--green); margin-bottom: 4px; }
.act time { color: var(--muted); font-size: .66rem; display: block; }

/* ---------- anchored chat (ChatGPT-style pill) ---------- */
.chatbar {
  position: fixed; bottom: 18px; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: center; padding: 0 16px; pointer-events: none;
}
.chat-pill {
  pointer-events: auto;
  width: 100%; max-width: 640px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.65); backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255,255,255,.7); border-radius: 28px;
  padding: 6px 6px 6px 20px;
  box-shadow: 0 12px 40px rgba(35,0,58,.16);
}
.chat-pill input { flex: 1; border: none; padding: 10px 0; font-size: .95rem; background: transparent; }
.chat-pill input:focus { outline: none; }
.send-btn {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  font-size: 1.05rem; font-weight: 700; box-shadow: var(--shadow-glow);
  display: flex; align-items: center; justify-content: center;
}
.send-btn:hover { filter: brightness(1.08); }
.chat-panel {
  position: fixed; bottom: 78px; left: 50%; transform: translateX(-50%); z-index: 29;
  width: calc(100% - 32px); max-width: 640px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  max-height: 46vh; overflow-y: auto; padding: 14px 16px;
  box-shadow: 0 16px 40px rgba(35,0,58,.14);
}
.chat-log { display: flex; flex-direction: column; gap: 8px; }
.msg { border-radius: 12px; padding: 8px 14px; font-size: .87rem; line-height: 1.45; max-width: 85%; white-space: pre-wrap; }
.msg.agent { background: var(--bg-soft); border: 1px solid var(--line); align-self: flex-start; }
.msg.user { background: var(--accent); color: #fff; align-self: flex-end; }
.msg.thinking { color: var(--muted); font-style: italic; }

/* ---------- gear menu + icon buttons ---------- */
.icon-btn { background: rgba(74,29,150,.06); border: 1px solid var(--line); border-radius: 10px; width: 36px; height: 36px; cursor: pointer; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: rgba(74,29,150,.12); }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 44px; z-index: 40; min-width: 210px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--glass-line); border-radius: 14px; padding: 6px;
  box-shadow: 0 16px 40px rgba(33,45,90,.16);
}
.menu-item { display: block; width: 100%; text-align: left; background: none; border: none; border-radius: 9px; padding: 10px 12px; font-size: .88rem; color: var(--text); cursor: pointer; text-decoration: none; }
.menu-item:hover { background: rgba(74,29,150,.08); }
.menu-item.danger { color: var(--pink); }

/* ---------- slide-over panels ---------- */
.panel-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(30,10,60,.28); backdrop-filter: blur(2px); }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 46; width: min(400px, 90vw);
  background: var(--glass-strong); backdrop-filter: blur(28px) saturate(160%); -webkit-backdrop-filter: blur(28px) saturate(160%);
  border-left: 1px solid var(--glass-border); box-shadow: -16px 0 50px rgba(33,45,90,.14);
  padding: 20px; overflow-y: auto; overflow-x: hidden; animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-head h2 { font-size: 1.05rem; color: var(--violet); font-family: "Space Grotesk", sans-serif; }
.panel-head > div { display: flex; gap: 8px; align-items: center; }

/* ---------- live score bar ---------- */
.live-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(100deg, rgba(37,99,235,.14), rgba(120,60,255,.14));
  border: 1px solid var(--glass-line); border-radius: 14px; padding: 10px 16px; margin-bottom: 12px;
}
.live-bar .lb-total { font-family: "Space Grotesk", sans-serif; font-size: 1.6rem; font-weight: 700; color: var(--blue-deep); }
.live-bar .lb-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.live-bar .lb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); display: inline-block; margin-right: 6px; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* compact tweaks */
.brand { font-size: 1rem; }
.stat { padding: 9px 12px; border-radius: 14px; }
.stat b { font-size: 1.2rem; }
.pitch { min-height: 270px; }

@media (max-width: 560px) {
  .player { width: 62px; }
  .banner { gap: 8px; padding: 10px 12px; }
  .profile .tsub { display: none; }
  .stats-row { gap: 7px; }
  .stat { min-width: 72px; padding: 8px 6px; }
  .stat b { font-size: 1.05rem; }
  main { padding: 12px; }
}

/* ---------- confirmation dialog ---------- */
.confirm-backdrop {
  position: fixed; inset: 0; z-index: 70; background: rgba(24,26,36,.32); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.confirm-card {
  width: 100%; max-width: 360px;
  background: var(--glass-strong); backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--glass-border); border-radius: 18px; padding: 22px;
  box-shadow: var(--shadow-md);
}
.confirm-title { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.1rem; margin-bottom: 8px; }
.confirm-body { color: var(--text-secondary); font-size: .9rem; line-height: 1.5; margin-bottom: 18px; }
.confirm-body b { color: var(--text); }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* chip card accent */
.decision.chip-card { border-left-color: var(--accent); background: linear-gradient(180deg, rgba(98,102,241,.04), transparent); }
.decision.summary .d-sub b { color: var(--text); }
