:root {
  --bg: #05090c;
  --bg-deep: #02060a;
  --panel: #091119;
  --panel-soft: #071014;
  --panel-raised: #0a141b;
  --border: #20343d;
  --border-bright: #176b79;
  --cyan: #00bed6;
  --cyan-dark: #007f91;
  --white: #f6f8f9;
  --muted: #93a3a8;
  --muted-2: #667980;
  --green: #18c77d;
  --red: #e4322b;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html { background: var(--bg); color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 84% 8%, rgba(0, 190, 214, 0.09), transparent 30%),
    radial-gradient(circle at 10% 90%, rgba(0, 127, 145, 0.07), transparent 32%),
    var(--bg);
  color: var(--white);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.bta-app { min-height: 100vh; display: flex; position: relative; overflow: hidden; }

.side-rail {
  width: 248px;
  min-height: 100vh;
  padding: 28px 20px 22px;
  background: rgba(3, 7, 10, 0.94);
  border-right: 1px solid rgba(32, 52, 61, 0.9);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  backdrop-filter: blur(18px);
}

.brand-button { width: 116px; height: 54px; background: none; border: 0; cursor: pointer; padding: 0; }
.brand-button img { width: 100%; height: 100%; object-fit: contain; }
.rail-nav { margin-top: 42px; display: grid; gap: 8px; }
.nav-label, .eyebrow { margin: 0; color: var(--cyan); font-size: 11px; line-height: 1.3; font-weight: 800; letter-spacing: 1.35px; text-transform: uppercase; }
.nav-label { color: var(--muted-2); margin: 0 14px 7px; }

.nav-button {
  width: 100%; min-height: 48px; border: 1px solid transparent; border-radius: 11px;
  display: flex; align-items: center; gap: 13px; padding: 0 14px; color: var(--muted);
  background: transparent; cursor: pointer; text-align: left; font-size: 14px; font-weight: 650;
  transition: .18s ease;
}
.nav-button span { font: 700 10px/1 ui-monospace, monospace; color: var(--muted-2); }
.nav-button:hover { color: var(--white); border-color: rgba(32, 52, 61, .8); background: rgba(9, 17, 25, .55); }
.nav-button.active { color: var(--white); border-color: var(--border); background: linear-gradient(100deg, rgba(0, 190, 214, .13), rgba(9, 17, 25, .72)); box-shadow: inset 3px 0 0 var(--cyan); }
.nav-button.active span { color: var(--cyan); }

.rail-status, .operator-card { display: flex; align-items: center; gap: 11px; }
.rail-status { margin-top: auto; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(9, 17, 25, .66); }
.status-light { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(24, 199, 125, .1), 0 0 14px rgba(24, 199, 125, .7); }
.rail-status strong, .operator-card strong { display: block; font-size: 12px; }
.rail-status small, .operator-card small { display: block; margin-top: 3px; color: var(--muted-2); font-size: 10px; }
.operator-card { margin-top: 12px; padding: 12px 4px; }
.operator-avatar { width: 36px; height: 36px; border: 1px solid var(--border-bright); border-radius: 9px; display: grid; place-items: center; color: var(--cyan); font-size: 11px; font-weight: 800; background: var(--panel); }

.app-surface { width: calc(100% - 248px); min-height: 100vh; margin-left: 248px; }
.topbar { height: 92px; padding: 0 40px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(32, 52, 61, .78); background: rgba(5, 9, 12, .75); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 22px; letter-spacing: -.45px; margin: 5px 0 0; }
.topbar-actions { display: flex; align-items: center; gap: 11px; }
.live-pill { min-height: 34px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; color: #b9c7ca; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; }
.live-pill > span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(24, 199, 125, .75); }
.live-pill.mini { min-height: 28px; padding: 0 9px; font-size: 9px; }
.icon-button { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--panel); color: var(--cyan); font-weight: 900; cursor: pointer; }

.content-area { padding: 32px 40px 48px; max-width: 1440px; margin: 0 auto; }
.view-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.tactical-panel, .tactical-card { border: 1px solid var(--border); background: linear-gradient(145deg, rgba(10, 20, 27, .98), rgba(5, 10, 13, .97)); border-radius: 15px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.tactical-card::after, .tactical-panel::after { content: ""; position: absolute; width: 18px; height: 18px; top: -1px; right: -1px; border-top: 1px solid rgba(0, 190, 214, .72); border-right: 1px solid rgba(0, 190, 214, .72); pointer-events: none; }

.welcome-panel { grid-column: 1 / -1; min-height: 242px; display: flex; align-items: center; padding: 34px 40px; background: linear-gradient(90deg, rgba(2, 6, 8, .98) 0%, rgba(2, 6, 8, .93) 48%, rgba(2, 6, 8, .32) 100%), url('/assets/member-background.webp') center / cover; }
.welcome-copy { width: min(620px, 70%); position: relative; z-index: 2; }
.welcome-copy h2 { margin: 8px 0 8px; font-size: clamp(30px, 4vw, 48px); line-height: .98; letter-spacing: -1.9px; }
.welcome-copy > p:not(.eyebrow) { max-width: 580px; color: #b6c2c6; line-height: 1.6; font-size: 14px; }
.welcome-actions { display: flex; gap: 10px; margin-top: 23px; }
.primary-button, .secondary-button, .compact-button, .map-button, .danger-button {
  min-height: 46px; border-radius: 11px; padding: 0 18px; border: 1px solid var(--border);
  font-size: 12px; font-weight: 800; cursor: pointer; transition: transform .16s ease, filter .16s ease;
}
.primary-button { background: linear-gradient(135deg, var(--cyan), var(--cyan-dark)); color: #011014; border-color: transparent; box-shadow: 0 9px 28px rgba(0, 190, 214, .19); }
.primary-button span, .map-button span { margin-left: 12px; font-size: 17px; }
.secondary-button, .map-button { background: rgba(7, 16, 20, .84); color: var(--white); border-color: var(--border); }
.primary-button:hover, .secondary-button:hover, .compact-button:hover, .map-button:hover, .danger-button:hover { transform: translateY(-1px); filter: brightness(1.1); }
.welcome-tiger { position: absolute; right: 38px; bottom: -58px; width: 245px; opacity: .26; filter: drop-shadow(0 0 24px rgba(0, 190, 214, .2)); mix-blend-mode: screen; }
.panel-grid { position: absolute; inset: 0; opacity: .1; background-image: linear-gradient(rgba(0,190,214,.23) 1px, transparent 1px), linear-gradient(90deg, rgba(0,190,214,.23) 1px, transparent 1px); background-size: 34px 34px; mask-image: linear-gradient(90deg, #000, transparent 75%); }

.metrics-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.metric-card { min-height: 145px; padding: 20px; box-shadow: none; }
.metric-code { color: var(--muted-2); font: 700 10px/1 ui-monospace, monospace; }
.metric-card > strong { display: block; margin-top: 17px; font-size: 32px; line-height: 1; letter-spacing: -1.4px; }
.metric-card p { margin: 7px 0 14px; color: #dce5e7; font-size: 13px; font-weight: 700; }
.metric-card small { color: var(--cyan); font-size: 10px; text-transform: uppercase; letter-spacing: .65px; }

.next-game { grid-column: span 7; min-height: 246px; padding: 24px; }
.task-card { grid-column: span 5; min-height: 246px; padding: 24px; }
.card-kicker { color: #b8c9cc; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; display: flex; align-items: center; gap: 9px; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; box-shadow: 0 0 0 5px rgba(24, 199, 125, .09), 0 0 14px rgba(24, 199, 125, .7); }
.game-card-main { display: flex; justify-content: space-between; gap: 20px; margin-top: 27px; }
.game-card-main h3, .section-heading h3 { margin: 6px 0; font-size: 22px; letter-spacing: -.6px; }
.game-card-main p:not(.eyebrow) { color: var(--muted); margin: 0; font-size: 12px; }
.game-time { text-align: right; }
.game-time small { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.game-time strong { display: block; margin-top: 7px; color: var(--cyan); font: 800 25px/1 ui-monospace, monospace; }
.game-card-footer { margin-top: 27px; padding-top: 17px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 18px; }
.mini-team { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.mini-team strong { color: var(--white); margin-left: 4px; }
.team-mark { width: 9px; height: 9px; border-radius: 3px; background: var(--cyan); box-shadow: 0 0 10px rgba(0,190,214,.45); }
.team-mark.green { background: var(--green); box-shadow: 0 0 10px rgba(24,199,125,.45); }
.team-mark.black { background: #58686d; box-shadow: none; }
.compact-button { min-height: 40px; margin-left: auto; background: linear-gradient(135deg, var(--cyan), var(--cyan-dark)); color: #011014; border: 0; }

.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.section-heading h3 { margin-top: 5px; }
.count-badge, .selection-hint { color: var(--muted); border: 1px solid var(--border); background: var(--panel-soft); border-radius: 20px; padding: 6px 9px; font-size: 9px; text-transform: uppercase; letter-spacing: .5px; }
.task-row { width: 100%; min-height: 63px; padding: 0; border: 0; border-top: 1px solid var(--border); background: none; color: var(--white); display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer; }
.task-row:first-of-type { margin-top: 14px; }
.task-row:hover strong { color: var(--cyan); }
.task-row > span:nth-child(2) { display: grid; gap: 4px; flex: 1; }
.task-row strong { font-size: 12px; transition: .16s; }
.task-row small { color: var(--muted-2); font-size: 10px; }
.task-row b { color: var(--cyan); }
.task-check { width: 17px; height: 17px; border-radius: 5px; border: 1px solid var(--border-bright); }

.game-command-bar { border: 1px solid var(--border); border-radius: 15px; padding: 17px 20px; background: rgba(9,17,25,.74); display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.game-command-bar > div { display: flex; align-items: center; gap: 14px; }
.game-command-bar h2 { margin: 3px 0 4px; font-size: 18px; }
.game-command-bar small { color: var(--muted); font-size: 11px; }
.map-button { min-height: 42px; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; }
.game-primary { display: grid; gap: 18px; }
.timer-panel { min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 35%, rgba(0,190,214,.11), transparent 52%), linear-gradient(145deg, #07141a, #050b0f); }
.timer-panel > p:not(.eyebrow) { color: var(--muted); font-size: 11px; margin: 8px 0 18px; }
.timer-value { color: var(--white); font: 850 clamp(40px, 7vw, 62px)/1 ui-monospace, "SFMono-Regular", monospace; letter-spacing: -3px; text-shadow: 0 0 28px rgba(0,190,214,.19); }
.timer-toggle { min-height: 37px; padding: 0 14px; border: 1px solid var(--border); border-radius: 9px; background: rgba(9,17,25,.78); color: var(--muted); font-size: 10px; font-weight: 800; cursor: pointer; }
.timer-toggle.paused { color: #011014; background: var(--cyan); border-color: var(--cyan); }
.team-section { padding: 3px 0 0; }
.score-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.score-card { min-height: 142px; padding: 19px; border: 1px solid var(--border); border-radius: 15px; background: linear-gradient(145deg, rgba(10,20,27,.96), rgba(5,10,13,.96)); color: var(--white); text-align: left; cursor: pointer; position: relative; transition: .17s ease; }
.score-card:hover { transform: translateY(-2px); border-color: var(--border-bright); }
.score-card.selected { border-color: var(--cyan); box-shadow: inset 0 0 0 1px rgba(0,190,214,.18), 0 12px 38px rgba(0,190,214,.08); }
.score-card .team-mark { position: absolute; top: 19px; right: 19px; }
.score-card small { color: var(--muted); font-size: 11px; }
.score-card > strong { display: block; margin: 12px 0; font-size: 31px; letter-spacing: -1.3px; }
.score-card em { color: var(--muted); font-size: 11px; font-style: normal; letter-spacing: 0; }
.selected-label { color: var(--muted-2); font-size: 9px; text-transform: uppercase; letter-spacing: .7px; }
.score-card.selected .selected-label { color: var(--cyan); }
.event-actions { padding: 20px; box-shadow: none; }
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 15px; }
.event-button { min-height: 70px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel-soft); color: var(--white); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; cursor: pointer; }
.event-button span { color: var(--cyan); font: 800 16px/1 ui-monospace, monospace; }
.event-button.primary-event { color: #011014; background: linear-gradient(135deg, var(--cyan), var(--cyan-dark)); border-color: transparent; }
.event-button.primary-event span { color: #011014; }
.event-button.danger-event { border-color: rgba(228,50,43,.45); color: #ff8c87; background: rgba(79,10,10,.27); }
.event-button.danger-event span { color: var(--red); }
.end-game-button { min-height: 48px; border: 1px solid rgba(228,50,43,.58); border-radius: 11px; background: rgba(79,10,10,.25); color: #ff5f59; font-size: 11px; font-weight: 800; cursor: pointer; }
.activity-panel { min-height: 100%; padding: 22px; box-shadow: none; }
.event-list { margin-top: 16px; }
.event-row { min-height: 64px; display: grid; grid-template-columns: 40px 12px 1fr auto; gap: 8px; align-items: center; border-top: 1px solid rgba(32,52,61,.75); }
.event-row time { color: var(--muted-2); font: 700 10px/1 ui-monospace, monospace; }
.event-line { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 9px rgba(0,190,214,.6); }
.event-row div { display: grid; gap: 4px; }
.event-row strong { font-size: 11px; }
.event-row small { color: var(--muted-2); font-size: 9px; }
.event-row b { color: var(--cyan); font: 800 11px/1 ui-monospace, monospace; }
.event-row b.neutral { color: var(--muted-2); }

.map-card, .journal-card { padding: 24px; }
.map-toolbar, .journal-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; }
.map-toolbar h2, .journal-heading h2 { margin: 5px 0 0; font-size: 26px; }
.map-image-wrap { position: relative; border: 1px solid var(--border); border-radius: 13px; overflow: hidden; min-height: 520px; background: var(--bg-deep); }
.map-image-wrap img { width: 100%; height: 100%; min-height: 520px; display: block; object-fit: cover; opacity: .78; }
.map-image-wrap::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 100px rgba(0,0,0,.75); pointer-events: none; }
.map-signal { position: absolute; z-index: 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--cyan); color: #021014; font: 900 11px/1 ui-monospace, monospace; box-shadow: 0 0 0 7px rgba(0,190,214,.13), 0 0 25px rgba(0,190,214,.48); }
.signal-a { left: 39%; top: 38%; }.signal-b { left: 61%; top: 51%; }.signal-c { left: 50%; top: 68%; }
.map-legend { position: absolute; left: 18px; bottom: 18px; z-index: 3; display: flex; gap: 16px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 9px; background: rgba(3,7,10,.88); color: var(--muted); font-size: 10px; }
.map-legend span { display: flex; align-items: center; gap: 7px; }
.green-dot, .cyan-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }.cyan-dot { background: var(--cyan); }
.journal-heading > div > span { color: var(--muted); font-size: 11px; }
.event-list.expanded .event-row { min-height: 76px; grid-template-columns: 60px 16px 1fr auto; }
.event-list.expanded .event-row strong { font-size: 13px; }

.bottom-nav { display: none; }
.toast { position: fixed; z-index: 80; right: 24px; bottom: 24px; min-height: 48px; max-width: 390px; padding: 0 17px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--border-bright); border-radius: 11px; background: rgba(7,16,20,.96); box-shadow: var(--shadow); color: var(--white); font-size: 12px; font-weight: 700; animation: toast-in .22s ease-out; }
.toast span { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px rgba(0,190,214,.7); }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

.modal-backdrop { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(0,3,5,.82); backdrop-filter: blur(8px); }
.modal-card { width: min(440px, 100%); padding: 27px; border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(145deg, #0b171e, #050b0f); box-shadow: 0 28px 90px rgba(0,0,0,.7); }
.modal-card h2 { margin: 7px 0; font-size: 25px; }.modal-card > p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.55; }
.eyebrow.danger { color: #ff625c; }
.modal-option, .danger-button { width: 100%; min-height: 48px; margin-top: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: var(--white); font-weight: 800; font-size: 12px; cursor: pointer; }
.modal-option.danger-option, .danger-button { border-color: rgba(228,50,43,.5); color: #ff736d; background: rgba(75,10,10,.26); }
.text-button { width: 100%; margin-top: 10px; min-height: 38px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.modal-summary { display: grid; gap: 9px; margin: 18px 0; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.modal-summary span { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }.modal-summary strong { color: var(--white); }
.modal-team { margin: 16px 0 0; padding: 10px 12px; border-left: 3px solid var(--cyan); background: rgba(0,190,214,.08); color: var(--white) !important; font-weight: 800; }
.adjustment-form { display: grid; gap: 14px; margin-top: 17px; }
.adjustment-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.adjustment-presets button { min-height: 40px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); color: var(--cyan); font: 800 12px/1 ui-monospace, monospace; cursor: pointer; }
.adjustment-presets button:hover { border-color: var(--cyan); }
.adjustment-submit { width: 100%; margin-top: 2px; }

.modal-backdrop { overflow-y: auto; }
.new-game-card { width: min(820px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.modal-heading h2 { margin: 7px 0 0; }
.modal-close { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--muted); font-size: 22px; cursor: pointer; }
.new-game-form { display: grid; gap: 20px; margin-top: 22px; }
.new-game-form fieldset { min-width: 0; margin: 0; padding: 17px; border: 1px solid var(--border); border-radius: 12px; background: rgba(5,10,13,.62); }
.new-game-form legend, .form-legend { margin: 0 0 14px; padding: 0 7px 0 0; color: var(--cyan); font-size: 10px; line-height: 1.3; font-weight: 850; letter-spacing: 1px; text-transform: uppercase; }
.form-grid { display: grid; gap: 13px; }
.form-grid.two-columns { grid-template-columns: 1fr 1fr; }
.field-wide { grid-column: 1 / -1; }
.field input, .field select { width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 10px; background: rgba(9,17,25,.85); color: var(--white); padding: 0 12px; font: inherit; }
.field input:focus, .field select:focus { outline: 2px solid var(--cyan); outline-offset: 2px; }
.field-disabled { opacity: .48; }
.team-setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.team-setup-card { position: relative; display: grid; grid-template-columns: 1fr 110px; gap: 10px; padding: 15px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel-soft); }
.team-setup-card > .team-mark { position: absolute; right: 13px; top: 13px; }
.fieldset-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.fieldset-heading .form-legend { margin-bottom: 4px; }
.fieldset-heading small { color: var(--muted-2); font-size: 10px; }
.mini-button { width: auto; min-height: 36px; padding: 0 12px; font-size: 10px; }
.new-player-list { display: grid; gap: 8px; margin-top: 13px; }
.new-player-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 38px; gap: 8px; align-items: center; padding: 10px; border: 1px solid rgba(32,52,61,.75); border-radius: 10px; background: var(--panel-soft); }
.new-player-row input, .new-player-row select { width: 100%; min-width: 0; height: 42px; padding: 0 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel); color: var(--white); font: inherit; font-size: 12px; }
.remove-player-button { width: 38px; height: 38px; border: 1px solid rgba(228,50,43,.35); border-radius: 9px; background: rgba(75,10,10,.2); color: #ff736d; cursor: pointer; }
.start-now-option { display: flex; gap: 12px; align-items: flex-start; padding: 15px; border: 1px solid var(--border-bright); border-radius: 11px; background: rgba(0,190,214,.06); cursor: pointer; }
.start-now-option input { width: 19px; height: 19px; accent-color: var(--cyan); }
.start-now-option span { display: grid; gap: 4px; }
.start-now-option strong { font-size: 12px; }
.start-now-option small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions .text-button { margin: 0; border: 1px solid var(--border); border-radius: 10px; }
.modal-actions .primary-button { width: 100%; }

@media (max-width: 1050px) {
  .side-rail { width: 204px; }
  .app-surface { width: calc(100% - 204px); margin-left: 204px; }
  .content-area { padding-left: 24px; padding-right: 24px; }
  .topbar { padding: 0 24px; }
  .game-layout { grid-template-columns: 1fr; }
  .activity-panel { min-height: auto; }
}

@media (max-width: 760px) {
  body { background: var(--bg); }
  .bta-app { display: block; overflow: visible; }
  .side-rail { display: none; }
  .app-surface { width: 100%; margin: 0; padding-bottom: 74px; }
  .topbar { height: 68px; padding: 0 14px; background: rgba(3,7,10,.92); }
  .topbar h1 { font-size: 17px; margin-top: 2px; }
  .topbar .eyebrow { font-size: 8px; }
  .live-pill { display: none; }
  .content-area { padding: 14px 12px 28px; }
  .view-grid { display: block; }
  .welcome-panel { min-height: 245px; padding: 24px 20px; border-radius: 13px; }
  .welcome-copy { width: 100%; }
  .welcome-copy h2 { font-size: 34px; }
  .welcome-copy > p:not(.eyebrow) { font-size: 12px; max-width: 86%; }
  .welcome-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .primary-button, .secondary-button { width: 100%; }
  .welcome-tiger { width: 160px; opacity: .15; right: -24px; bottom: -25px; }
  .metrics-grid { grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 10px 0; }
  .metric-card { min-height: 118px; padding: 14px 10px; border-radius: 11px; }
  .metric-card > strong { font-size: 26px; margin-top: 14px; }
  .metric-card p { min-height: 30px; margin: 6px 0; font-size: 10px; }
  .metric-card small { font-size: 7px; line-height: 1.35; }
  .next-game, .task-card { margin-top: 10px; padding: 18px; min-height: auto; border-radius: 13px; }
  .game-card-main { display: block; margin-top: 20px; }.game-card-main h3 { font-size: 20px; }
  .game-time { display: none; }
  .game-card-footer { gap: 10px; flex-wrap: wrap; margin-top: 20px; }.compact-button { width: 100%; margin: 3px 0 0; }
  .game-command-bar { padding: 14px; border-radius: 12px; }.game-command-bar h2 { font-size: 15px; }.game-command-bar small { font-size: 9px; }
  .map-button { min-height: 38px; padding: 0 10px; font-size: 9px; }.map-button span { display: none; }
  .timer-panel { min-height: 190px; border-radius: 12px; }.timer-value { font-size: 44px; letter-spacing: -2.5px; }
  .score-grid { gap: 8px; }.score-card { min-height: 128px; padding: 15px; border-radius: 12px; }.score-card .team-mark { top: 15px; right: 15px; }.score-card > strong { font-size: 26px; }
  .event-actions { padding: 16px; border-radius: 12px; }.action-grid { grid-template-columns: repeat(2, 1fr); gap: 7px; }.event-button { min-height: 66px; }
  .activity-panel { padding: 18px; border-radius: 12px; }
  .end-game-button { margin-bottom: 2px; }
  .bottom-nav { position: fixed; inset: auto 0 0; z-index: 40; height: 68px; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(3,7,10,.96); border-top: 1px solid var(--border); backdrop-filter: blur(18px); padding: 5px 8px max(5px, env(safe-area-inset-bottom)); }
  .bottom-nav button { border: 0; background: none; color: var(--muted-2); display: grid; place-content: center; gap: 3px; cursor: pointer; }
  .bottom-nav button span { font: 800 9px/1 ui-monospace, monospace; }.bottom-nav button small { font-size: 9px; font-weight: 700; }
  .bottom-nav button.active { color: var(--cyan); }
  .toast { right: 12px; left: 12px; bottom: 81px; max-width: none; }
  .map-card, .journal-card { padding: 14px; border-radius: 12px; }
  .map-toolbar, .journal-heading { align-items: flex-start; }.map-toolbar h2, .journal-heading h2 { font-size: 20px; }.map-toolbar .secondary-button, .journal-heading .secondary-button { width: auto; padding: 0 10px; min-height: 38px; font-size: 9px; }
  .map-image-wrap, .map-image-wrap img { min-height: 600px; }.map-image-wrap img { object-position: center; }
  .map-legend { right: 10px; left: 10px; bottom: 10px; justify-content: center; }
  .event-list.expanded .event-row { grid-template-columns: 44px 10px 1fr auto; }
  .new-game-card { width: 100%; max-height: calc(100vh - 18px); padding: 19px 14px; }
  .new-game-form { gap: 13px; margin-top: 17px; }
  .new-game-form fieldset { padding: 13px; }
  .form-grid.two-columns, .team-setup-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .team-setup-card { grid-template-columns: minmax(0, 1fr) 92px; padding: 12px; }
  .new-player-row { grid-template-columns: minmax(0, 1fr) 108px 36px; padding: 8px; }
  .new-player-row input, .new-player-row select { font-size: 11px; padding: 0 8px; }
  .modal-actions { position: sticky; bottom: -19px; padding: 12px 0 max(0px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, #071015 18%); }
}

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

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

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(460px, 1.15fr);
  background: var(--bg-deep);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(30px, 7vw, 86px);
  position: relative;
  z-index: 2;
}

.auth-brand { width: min(220px, 56vw); margin-bottom: 54px; }
.auth-panel h1 { margin: 10px 0 12px; font-size: clamp(36px, 5vw, 62px); line-height: .95; letter-spacing: -2.4px; }
.auth-panel > p:not(.eyebrow) { color: var(--muted); line-height: 1.65; max-width: 520px; }
.auth-form { display: grid; gap: 14px; margin-top: 30px; max-width: 460px; }
.field { display: grid; gap: 7px; }
.field span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .7px; }
.field input {
  width: 100%; min-height: 50px; border: 1px solid var(--border); border-radius: 10px;
  background: rgba(9,17,25,.85); color: var(--white); padding: 0 14px; font: inherit;
}
.field input:focus { outline: 2px solid var(--cyan); outline-offset: 2px; }
.auth-submit { width: 100%; margin-top: 5px; }
.auth-error { min-height: 18px; margin: 0; color: #ff7771 !important; font-size: 12px; }
.auth-visual { position: relative; min-height: 100vh; overflow: hidden; background: linear-gradient(90deg, #03070a 0%, transparent 36%), url('./bta-team.webp') center / cover; }
.auth-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0,190,214,.18), transparent 55%), radial-gradient(circle at 50% 50%, transparent, rgba(0,0,0,.56)); }
.auth-visual img { position: absolute; z-index: 2; width: min(270px, 42%); right: 7%; bottom: 6%; filter: drop-shadow(0 15px 45px rgba(0,0,0,.6)); }

.sync-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 800; }
.sync-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(24,199,125,.7); }
.sync-badge.syncing::before { background: var(--cyan); animation: sync-pulse .8s infinite alternate; }
.sync-badge.offline::before { background: var(--red); box-shadow: 0 0 12px rgba(228,50,43,.6); }
@keyframes sync-pulse { to { opacity: .25; } }

.button-busy { pointer-events: none; opacity: .58; }
.empty-state { padding: 28px 12px; color: var(--muted); text-align: center; font-size: 12px; }
.operator-card button { margin-left: auto; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; }

@media (max-width: 850px) {
  .auth-screen { display: block; background: linear-gradient(rgba(2,6,10,.75), rgba(2,6,10,.98)), url('./bta-team.webp') 62% center / cover; }
  .auth-panel { min-height: 100vh; padding: 28px 22px; justify-content: center; }
  .auth-visual { display: none; }
  .auth-brand { margin-bottom: 36px; }
}
