:root {
  --navy: #0b1424;
  --navy-2: #0f1a30;
  --navy-3: #1a2740;
  --line: #223354;
  --orange: #ff7b00;
  --orange-2: #ffa733;
  --text: #ffffff;
  --muted: #a9b4c8;
  --danger: #ff6b66;
  --ok: #3ccf91;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--navy); color: var(--text); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--orange-2); }
[hidden] { display: none !important; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--navy-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 18px; }
.brand img { height: 32px; width: auto; }
.tip { color: var(--text); }
.in { color: var(--orange); }

main { max-width: 640px; margin: 0 auto; padding: 16px; }

h1 { font-size: 24px; margin: 8px 0 16px; }
h2 { font-size: 18px; margin: 20px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
}
a.card { display: block; text-decoration: none; color: inherit; }
a.card:active { background: var(--navy-3); }

.auth-wrap { max-width: 420px; margin: 24px auto; }
.auth-logo { text-align: center; margin-bottom: 8px; }
.auth-logo img { height: 72px; }
.auth-logo h1 { margin: 8px 0 0; }

label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; padding: 12px; font-size: 16px; color: var(--text);
  background: var(--navy); border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; margin: 14px 0; }
.check input { width: 22px; height: 22px; accent-color: var(--orange); }

button {
  font: inherit; cursor: pointer; border: 0; border-radius: 10px; padding: 12px 16px;
  min-height: 44px; background: var(--orange); color: #1a0f00; font-weight: 700;
}
button.secondary { background: var(--navy-3); color: var(--text); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
button.block { width: 100%; margin-top: 16px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--orange-2); padding: 8px; min-height: 0; font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; }
.row.spread { justify-content: space-between; }
.row > * { min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.msg { padding: 10px 12px; border-radius: 8px; margin: 12px 0; font-size: 14px; }
.msg.error { background: rgba(255, 107, 102, 0.12); border: 1px solid var(--danger); color: #ffd2d0; }
.msg.warn { background: rgba(255, 167, 51, 0.12); border: 1px solid var(--orange-2); color: #ffe2bd; }
.msg.ok { background: rgba(60, 207, 145, 0.12); border: 1px solid var(--ok); color: #c9f4e2; }

.tabs { display: flex; gap: 6px; margin: 8px 0 12px; }
.tabs button { flex: 1; background: var(--navy-2); color: var(--muted); border: 1px solid var(--line); }
.tabs button[aria-selected="true"] { background: var(--orange); color: #1a0f00; border-color: var(--orange); }

.player { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.player:last-child { border-bottom: 0; }
.jersey {
  min-width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy-3); border: 1px solid var(--line); font-weight: 800; flex: none;
}
.player .name { flex: 1; font-weight: 600; }
.player .name small { display: block; color: var(--muted); font-weight: 400; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--navy-3); color: var(--muted); }
.pill.locked { background: rgba(60, 207, 145, 0.18); color: var(--ok); }
.pill.live { background: rgba(255, 123, 0, 0.2); color: var(--orange-2); }

.sticky-actions {
  position: sticky; bottom: 0; background: linear-gradient(transparent, var(--navy) 30%);
  padding: 16px 0 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}

.lineup-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lineup-row .who { flex: 1; }
.toggle {
  min-width: 84px; padding: 8px 10px; font-size: 14px; border-radius: 999px;
  background: var(--navy); color: var(--muted); border: 1px solid var(--line); font-weight: 600;
}
.toggle[aria-pressed="true"] { background: var(--orange); color: #1a0f00; border-color: var(--orange); }
.toggle:disabled { opacity: 0.45; }

.modal-back {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65); display: flex; align-items: flex-end;
  justify-content: center; z-index: 20;
}
.modal {
  background: var(--navy-2); border: 1px solid var(--line); border-radius: 16px 16px 0 0;
  width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom));
  background: var(--navy-3); border: 1px solid var(--line); padding: 10px 16px; border-radius: 999px; z-index: 30;
}

@media (min-width: 700px) {
  .modal-back { align-items: center; }
  .modal { border-radius: 16px; }
}
