:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel2: #1f2330;
  --text: #f7f8fb;
  --muted: #9aa3b5;
  --line: #2b3040;
  --accent: #6D28FF;
  --green: #27d17f;
  --yellow: #f8c14a;
  --red: #ff6b6b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: radial-gradient(circle at top, #24134f 0, var(--bg) 40%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.screen {
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
}

.hidden, [hidden] { display: none !important; }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 42px auto 28px;
  max-width: 520px;
}

.logo {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #9b5cff);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 24px;
  box-shadow: 0 16px 40px rgba(109, 40, 255, .35);
}

h1, h2, p { margin: 0; }
.brand h1 { font-size: clamp(28px, 7vw, 40px); line-height: 1; }
.brand p, .muted, .footer-note, #updatedText { color: var(--muted); }

.card {
  max-width: 520px;
  margin: 0 auto;
  background: rgba(23, 26, 35, .94);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}

input {
  width: 100%;
  height: 48px;
  margin: 18px 0 12px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #10131b;
  color: var(--text);
  font-size: 15px;
}

button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 15px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 15px;
  touch-action: manipulation;
}

button.ghost {
  background: var(--panel2);
  border: 1px solid var(--line);
}

.status {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.footer-note {
  max-width: 520px;
  margin: 18px auto;
  font-size: 13px;
  text-align: center;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.topbar h1 { font-size: 30px; line-height: 1; }
.topbar button { width: 92px; height: 38px; min-height: 38px; }

.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}

.stat span {
  display: block;
  font-size: 26px;
  font-weight: 900;
}

.stat label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sortbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 10px 0 14px;
  background: rgba(23, 26, 35, .75);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 7px;
}

.sortbtn {
  min-height: 36px;
  border-radius: 12px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 11px;
  padding: 0 3px;
}

.sortbtn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 8px 22px rgba(109, 40, 255, .25);
}

.game {
  background: rgba(23, 26, 35, .96);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 14px 38px rgba(0,0,0,.18);
}

.game-head {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.matchup {
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
}

.matchup span {
  color: var(--muted);
  font-weight: 700;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  max-width: 100%;
}

.toggle-btn {
  min-height: 42px;
  border-radius: 12px;
  background: rgba(109, 40, 255, .18);
  border: 1px solid rgba(109, 40, 255, .55);
  color: white;
  font-size: 13px;
  cursor: pointer;
}

.props {
  border-top: 1px solid var(--line);
}

.props.collapsed {
  display: none !important;
}

.prop {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.045);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.prop:first-child { border-top: 0; }

.prop-left { min-width: 0; }

.player {
  font-weight: 850;
  line-height: 1.25;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.pick {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  line-height: 1.25;
}

.pick.small {
  font-size: 11px;
}

.edge {
  text-align: right;
  color: var(--green);
  font-weight: 900;
  font-size: 14px;
  white-space: nowrap;
}

.conf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 2px 7px;
  margin-left: 4px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 11px;
}

.conf.grade-a {
  background: rgba(39, 209, 127, .16) !important;
  color: var(--green) !important;
}

.conf.grade-b {
  background: rgba(248, 193, 74, .20) !important;
  color: var(--yellow) !important;
}

.conf.grade-c {
  background: rgba(255, 107, 107, .18) !important;
  color: var(--red) !important;
}

.conf.grade-unknown {
  background: rgba(154, 163, 181, .16) !important;
  color: var(--muted) !important;
}

.empty-props {
  padding: 18px;
  color: var(--muted);
  font-size: 14px;
}

@media (min-width: 380px) {
  .sortbtn {
    font-size: 12px;
  }
}

@media (min-width: 720px) {
  .screen {
    max-width: 760px;
    margin: 0 auto;
  }
}
