:root {
  --bg: #000000;
  --surface: #0a0a0c;
  --surface-2: #141418;
  --line: #222225;
  --ink: #ffffff;
  --muted: #888890;
  --accent: #ccff00;
  --accent-glow: rgba(204, 255, 0, 0.35);
  --warn: #ffb700;
  --danger: #ff0055;
  --ok: #00fa9a;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Space Grotesk", system-ui, sans-serif;
  --radius: 0px;
  --nav-h: 4.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

button, input, select { font: inherit; color: inherit; }
button { 
  cursor: pointer; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; 
  appearance: none; -webkit-appearance: none;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
button:disabled { opacity: 0.3; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button * {
  pointer-events: none;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin: 0;
}

.shell { 
  max-width: 30rem; 
  margin: 0 auto; 
  padding: max(1.5rem, env(safe-area-inset-top)) 1.25rem 2rem; 
}

.top { 
  border-bottom: 2px solid var(--line); 
  padding-bottom: 1rem; 
  margin-bottom: 1.5rem; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
}
.brand { 
  font-family: var(--display);
  font-size: 2.25rem; 
  font-weight: 900; 
  letter-spacing: -0.05em; 
  color: var(--ink); 
  text-transform: uppercase;
  line-height: 1;
}
.brand span { 
  color: var(--accent); 
  text-shadow: 0 0 12px var(--accent-glow); 
}
.gate-brand { 
  font-size: 4.5rem; 
  letter-spacing: -0.06em;
  margin-bottom: 0.5rem; 
  text-align: center; 
}
.tag { 
  font-size: 0.75rem; 
  color: var(--muted); 
  text-transform: uppercase; 
  letter-spacing: 0.1em; 
  margin-top: 0.25rem; 
}

.checkbox-row { 
  display: flex; 
  gap: 0.75rem; 
  align-items: flex-start; 
  margin-top: 1.5rem; 
  cursor: pointer;
  touch-action: manipulation;
}
.checkbox-row input[type="checkbox"] { 
  width: 1.25rem; 
  height: 1.25rem; 
  accent-color: var(--accent); 
  flex-shrink: 0; 
  margin-top: 0.1rem; 
}
.checkbox-row span { 
  font-size: 0.85rem; 
  color: var(--muted); 
  line-height: 1.4; 
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1.25rem;
  position: relative;
  text-align: left;
}
.card::before {
  content: ""; position: absolute; top: -1px; left: -1px; width: 10px; height: 10px;
  border-top: 2px solid var(--accent); border-left: 2px solid var(--accent); opacity: 0; transition: opacity 0.2s;
}
.card:hover::before { opacity: 1; }
.card + .card, .stack > * + * { margin-top: 0.85rem; }

.hero-num { font-size: 4.5rem; font-weight: 900; line-height: 0.85; color: var(--accent); letter-spacing: -0.05em; font-family: var(--display); }
.hero-sub { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 0.5rem; }

.row { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

.label {
  display: block; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.5rem;
}

.input {
  display: flex; align-items: center; min-height: 3.25rem;
  border: 1px solid var(--line); background: var(--bg); padding: 0 1rem;
  transition: border-color 0.2s;
  width: 100%;
}
.input:focus-within { border-color: var(--accent); }
.input input, .input select {
  flex: 1; min-width: 0; width: 100%; border: 0; background: transparent;
  outline: none; font-size: 1.15rem; font-variant-numeric: tabular-nums;
  color-scheme: dark;
}

input[type="time"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}

.search { position: relative; margin-top: 1rem; }
.search input { 
  width: 100%; 
  min-height: 3.25rem; 
  border: 1px solid var(--line); 
  background: var(--bg); 
  padding: 0 1rem 0 2.5rem; 
  outline: none; 
  -webkit-appearance: none; 
  appearance: none;
  border-radius: 0;
  color: var(--ink);
}
.search input:focus { border-color: var(--accent); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-ico { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.chip {
  min-height: 2.25rem; padding: 0 0.75rem; border: 1px solid var(--line);
  background: var(--bg); font-size: 0.75rem; transition: all 0.2s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.chip.on { border-color: var(--accent); background: var(--accent); color: var(--bg); }

.seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; margin-top: 0.5rem; }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg button { min-height: 2.75rem; border: 1px solid var(--line); background: var(--bg); font-size: 0.8rem; }
.seg button.on { border-color: var(--accent); background: var(--accent); color: var(--bg); }

.btn {
  min-height: 3rem; border: 1px solid var(--line); background: var(--surface);
  padding: 0 1.25rem; font-size: 0.85rem;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.1s ease, transform 0.1s ease;
}
.btn:active {
  opacity: 0.75;
  transform: scale(0.98);
}
.btn-primary { border-color: var(--accent); background: var(--accent); color: var(--bg); }
.btn-ghost { border: 0; background: transparent; color: var(--muted); padding: 0; min-height: auto; touch-action: manipulation; }
.btn-ghost:hover { color: var(--accent); }
.btn-block { width: 100%; }

.warn, .flag {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.75rem 1rem; font-size: 0.85rem; margin-top: 0.75rem; border: 1px solid var(--line);
}
.warn { border-color: var(--warn); color: var(--warn); }
.flag-high { border-color: var(--danger); color: var(--danger); }
.flag-low { border-color: var(--accent); color: var(--accent); }
.flag-none { color: var(--muted); }

.syringe-container { margin-top: 1.25rem; padding: 0.5rem 0.15rem; user-select: none; }
.syringe-device { display: flex; align-items: center; position: relative; width: 100%; }
.syringe-needle-cannula { width: 1.15rem; height: 2px; background: linear-gradient(90deg, #666, #fff); flex-shrink: 0; }
.syringe-hub { background: #2a2a30; border: 1px solid #4a4a54; border-radius: 2px 0 0 2px; flex-shrink: 0; transition: height 0.2s; }
.syringe-barrel { position: relative; flex: 1; border: 2px solid #3f3f46; border-left: 0; border-right: 0; background: rgba(18, 18, 22, 0.85); overflow: hidden; box-shadow: inset 0 2px 6px rgba(0,0,0,0.6); transition: height 0.2s; }

.size-30 .syringe-barrel { height: 2.35rem; }
.size-30 .syringe-hub { height: 1.15rem; width: 0.55rem; }
.size-30 .syringe-collar { height: 2.85rem; }
.size-50 .syringe-barrel { height: 2.75rem; }
.size-50 .syringe-hub { height: 1.35rem; width: 0.65rem; }
.size-50 .syringe-collar { height: 3.35rem; }
.size-100 .syringe-barrel { height: 3.15rem; }
.size-100 .syringe-hub { height: 1.55rem; width: 0.75rem; }
.size-100 .syringe-collar { height: 3.8rem; }

.syringe-liquid { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(180deg, #c7ff1a 0%, var(--accent) 50%, #99cc00 100%); box-shadow: inset 0 0 6px rgba(0,0,0,0.35), 0 0 12px var(--accent-glow); transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1); z-index: 1; }
.syringe-stopper { position: absolute; top: 0; bottom: 0; width: 6px; background: #09090b; border-right: 2px solid #52525b; right: -6px; }
.syringe-ticks { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.tick { position: absolute; top: 0; transform: translateX(-50%); }
.tick.major { height: 52%; width: 1.5px; background: rgba(255, 255, 255, 0.95); }
.tick.mid { height: 38%; width: 1.25px; background: rgba(255, 255, 255, 0.65); }
.tick.minor { height: 24%; width: 1px; background: rgba(255, 255, 255, 0.35); }
.tick.major::after { content: ""; position: absolute; bottom: -48%; left: 0; width: 100%; height: 40%; background: rgba(255, 255, 255, 0.95); }
.syringe-collar { width: 0.45rem; background: #27272a; border: 1px solid #52525b; border-radius: 2px; flex-shrink: 0; z-index: 3; }
.syringe-stem { height: 0.65rem; background: #18181b; border-top: 1px solid #3f3f46; border-bottom: 1px solid #3f3f46; flex-shrink: 0; transition: width 0.25s; }
.syringe-thumbpad { width: 0.35rem; height: 2.3rem; background: #3f3f46; border: 1px solid #52525b; border-radius: 2px; flex-shrink: 0; }
.syringe-scale-labels { display: flex; justify-content: space-between; margin-top: 0.45rem; margin-left: 2.1rem; margin-right: 1.8rem; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -0.02em; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; border-top: 1px solid var(--line); background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(10px); z-index: 50; }
.nav-inner { max-width: 30rem; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); padding-bottom: env(safe-area-inset-bottom, 0px); }
.nav button { border: 0; background: transparent; color: var(--muted); font-size: 0.6rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem; touch-action: manipulation; }
.nav button.on { color: var(--accent); }
.nav svg { width: 1.1rem; height: 1.1rem; }

.auth-box {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.btn-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 3.25rem;
  width: 100%;
  border: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: opacity 0.15s ease;
  position: relative;
  touch-action: manipulation;
}

.btn-auth img, .btn-auth svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-auth-google {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.btn-auth-github {
  background: #18181b;
  color: var(--ink);
  border-color: #27272a;
}

.btn-auth-facebook {
  background: #1877f2;
  color: #ffffff;
  border-color: #1877f2;
}

.auth-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
}

.auth-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ok);
}

.auth-status-indicator::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--ok);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--ok);
}

/* Modal helpers */
.modal-backdrop { cursor: pointer; }
.modal-card { cursor: default; pointer-events: auto; }
.modal-card button { pointer-events: auto; }
