:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #080d14;
  --panel: #121c29;
  --panel-strong: #172435;
  --line: #28394e;
  --line-soft: #1c2a3b;
  --text: #f4f7fb;
  --muted: #a5b3c5;
  --muted-strong: #c3cfdd;
  --accent: #91e5b3;
  --accent-ink: #07130c;
  --accent2: #77c4f4;
  --danger: #ffaaa8;
  --focus: #f1c878;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: radial-gradient(900px 520px at 78% -12%, rgba(49, 82, 119, .46), transparent 65%), linear-gradient(180deg, #0b121c 0%, var(--bg) 52%, #070b11 100%);
  color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 70%, transparent); outline-offset: 2px; }

.shell { width: min(1220px, 100%); margin: 0 auto; padding: 24px 24px 64px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 10px 0 24px;
  background: linear-gradient(180deg, rgba(8, 13, 20, .98) 55%, rgba(8, 13, 20, .82) 82%, transparent);
  backdrop-filter: blur(12px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; flex: 0 0 auto; place-items: center; width: 42px; height: 42px; border: 1px solid var(--accent); border-radius: 13px; color: var(--accent); font-weight: 850; font-size: 20px; box-shadow: 0 0 0 5px rgba(145, 229, 179, .06); }
.brand h1 { margin: 0; font-size: 20px; line-height: 1; letter-spacing: -.02em; }
.brand small { display: block; max-width: 190px; overflow: hidden; margin-top: 5px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex: 0 1 auto; gap: 7px; align-items: center; justify-content: flex-end; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav button, .ghost { flex: 0 0 auto; min-height: 40px; padding: 9px 12px; border-radius: 10px; color: var(--muted); background: transparent; white-space: nowrap; }
.nav button:hover, .nav button.active, .ghost:hover { color: var(--text); background: var(--panel-strong); }
.badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; margin-left: 5px; padding: 0 5px; border-radius: 99px; color: var(--accent-ink); background: var(--accent); font-size: 11px; font-weight: 800; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 28px 0 20px; }
.hero h2 { margin: 0 0 8px; font-size: clamp(30px, 4vw, 48px); line-height: 1.04; letter-spacing: -.045em; }
.hero p { max-width: 680px; margin: 0; color: var(--muted); line-height: 1.5; }
.panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(145deg, rgba(19, 30, 44, .96), rgba(13, 21, 32, .96)); box-shadow: 0 18px 50px rgba(0, 0, 0, .24); }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.panel-head h3 { margin: 0; font-size: 18px; line-height: 1.2; }
.subtle { color: var(--muted); font-size: 13px; line-height: 1.45; }

.btn { min-height: 42px; padding: 10px 15px; border-radius: 10px; color: var(--accent-ink); background: var(--accent); font-weight: 800; transition: transform .15s ease, filter .15s ease; }
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.secondary { color: var(--text); border: 1px solid var(--line); background: var(--panel-strong); }
.btn.danger { color: var(--danger); border: 1px solid #704351; background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.field { display: grid; gap: 7px; margin: 12px 0; }
.field label { color: var(--muted); font-size: 13px; }
.field input, .field select, .field textarea, .row input, .row select, .searchline input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--text); background: #0b131e; }
.field input::placeholder, .row input::placeholder, .searchline input::placeholder { color: #718197; }
.field input:focus, .field select:focus, .field textarea:focus, .row input:focus, .row select:focus, .searchline input:focus { border-color: var(--accent); }
.field textarea { min-height: 92px; resize: vertical; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row input { flex: 1 1 220px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.event-grid, .post-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.card { min-width: 0; padding: 16px; border: 1px solid var(--line-soft); border-radius: 13px; background: rgba(11, 19, 30, .88); }
.card h4 { margin: 0 0 7px; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.card p { margin: 5px 0; color: var(--muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.event-card { border-left: 3px solid var(--accent2); }
.post-card { border-left: 3px solid var(--accent); }

.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px; max-height: min(420px, 46vh); padding: 2px 4px 2px 0; overflow: auto; scrollbar-color: var(--line) transparent; }
.chip { display: grid; grid-template-rows: auto auto; align-content: start; min-width: 0; min-height: 76px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; color: var(--muted-strong); background: #0b131e; font-size: 13px; text-align: left; }
.chip:hover { border-color: var(--accent2); color: var(--text); }
.chip.following { border-color: #42745a; color: var(--accent); background: #12251d; }
.team-chip-main { display: flex; align-items: center; gap: 8px; min-width: 0; line-height: 1.25; }
.team-chip-name { min-width: 0; overflow-wrap: anywhere; }
.chip small { display: block; margin: 4px 0 0 32px; color: var(--muted); font-size: 10px; line-height: 1.25; }
.team-chip-logo, .team-chip-initial { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 6px; object-fit: contain; vertical-align: middle; }
.team-chip-initial { border-radius: 50%; color: var(--accent2); background: #1a3046; font-size: 12px; font-weight: 800; }
.searchline { display: flex; gap: 9px; margin: 10px 0 13px; }

.event-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sport-badge, .event-status, .post-intent { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted-strong); background: #0c1623; font-size: 11px; font-weight: 750; letter-spacing: .03em; text-transform: uppercase; }
.event-status { color: var(--accent2); }
.matchup { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 10px 0; color: var(--muted-strong); font-size: 13px; }
.team-logo { width: 26px; height: 26px; object-fit: contain; vertical-align: middle; }
.versus { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.event-actions { margin-top: 13px; }
.event-actions .btn { flex: 1 1 130px; }
.post-intent { margin-bottom: 10px; color: var(--accent); border-color: #315b47; background: #10221b; }
.feed-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.feed-tabs button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #0b131e; font-size: 12px; }
.feed-tabs button.active { border-color: var(--accent); color: var(--accent-ink); background: var(--accent); }
.friend-results { display: grid; gap: 10px; margin-top: 16px; }
.friend-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-users { display: grid; gap: 12px; margin-top: 16px; }
.admin-user-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.admin-user-head p { margin: 5px 0 0; }
.admin-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 10px; margin-top: 14px; }
.admin-controls .field { margin: 0; }
.admin-controls .setting-toggle { margin: 0; min-height: 76px; }
.admin-controls > .btn { min-height: 44px; }
.admin-preview { border-color: var(--accent2); }
.invite-result { display: grid; gap: 10px; margin-top: 15px; }
.invite-link { flex: 1 1 260px !important; min-width: 0; color: var(--muted-strong) !important; }
.setting-toggle { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #0b131e; }
.setting-toggle input { margin-top: 4px; accent-color: var(--accent); }
.setting-toggle span { display: grid; gap: 4px; }
.setting-toggle small { color: var(--muted); line-height: 1.45; }

.notice { padding: 13px 14px; border: 1px solid #3a5169; border-radius: 11px; color: #c6d4e6; background: #122033; }
.notice.error { border-color: #824652; color: #ffd0d0; background: #29161e; }
.empty { padding: 18px 0; color: var(--muted); }
.modal-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); overflow-y: auto; overscroll-behavior: contain; background: rgba(2, 5, 9, .78); }
.modal { width: min(620px, 100%); max-height: min(720px, calc(100dvh - 28px)); overflow: auto; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: #111b28; box-shadow: 0 24px 80px rgba(0,0,0,.45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h3 { margin: 0; }
.x { min-width: 40px; min-height: 40px; border-radius: 10px; color: var(--muted); background: transparent; font-size: 26px; line-height: 1; }
.x:hover { color: var(--text); background: var(--panel-strong); }
.checks { display: flex; flex-wrap: wrap; gap: 12px 16px; color: var(--muted); font-size: 13px; }
.checks label { display: flex; align-items: flex-start; gap: 7px; line-height: 1.4; }
.toast { position: fixed; right: 16px; bottom: max(18px, env(safe-area-inset-bottom)); left: 16px; z-index: 30; width: fit-content; max-width: calc(100% - 32px); margin: 0 auto; padding: 12px 17px; border-radius: 99px; color: #0b1a11; background: #e9f5ed; font-weight: 700; text-align: center; box-shadow: 0 12px 34px rgba(0,0,0,.3); }

.auth-wrap { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.auth { width: min(440px, 100%); }
.auth h1 { margin: 0 0 8px; font-size: 34px; }
.auth p { color: var(--muted); line-height: 1.5; }
.auth .panel { margin-top: 20px; }
.terms { width: min(780px, 100%); margin: 0 auto; }
.terms h2 { margin-top: 18px; font-size: 38px; }
.terms h3 { margin-top: 27px; }
.terms p, .terms li { color: #c3cedd; line-height: 1.65; }
.footer { padding: 30px 0; color: var(--muted); font-size: 13px; text-align: center; }

@media (max-width: 860px) {
  .shell { padding: 18px 18px 54px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 13px; padding-bottom: 18px; }
  .nav { width: 100%; justify-content: flex-start; }
  .hero { align-items: stretch; flex-direction: column; gap: 14px; }
  .hero .btn { width: 100%; }
}

@media (max-width: 620px) {
  .shell { padding: 12px 12px 42px; }
  .topbar { margin: 0 -12px; padding: 8px 12px 15px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
  .brand h1 { font-size: 18px; }
  .brand small { max-width: 150px; }
  .nav { gap: 5px; padding-bottom: 2px; }
  .nav button, .ghost { min-height: 42px; padding: 9px 11px; }
  .hero { margin: 22px 0 16px; }
  .hero h2 { font-size: clamp(28px, 9vw, 38px); }
  .panel { padding: 15px; border-radius: 14px; }
  .panel-head { flex-direction: column; gap: 5px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .admin-controls { grid-template-columns: 1fr; }
  .event-grid, .post-grid { grid-template-columns: 1fr; }
  .chips { grid-template-columns: repeat(auto-fill, minmax(min(100%, 175px), 1fr)); max-height: 360px; }
  .searchline { display: block; }
  .searchline input { display: block; }
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { width: 100%; max-height: min(760px, 92dvh); padding: 18px 15px max(18px, env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; }
  .footer { padding: 24px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
