:root {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111b2c;
  --surface-strong: #16243a;
  --line: #27364d;
  --text: #f3f6fb;
  --muted: #9baac0;
  --accent: #52d6b5;
  --accent-strong: #2daf92;
  --danger: #ff8e8e;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }

.shell {
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 22px max(32px, env(safe-area-inset-bottom));
}

.view { min-height: calc(100vh - 60px); }

#login-view {
  display: grid;
  align-content: center;
  max-width: 420px;
  margin: 0 auto;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 22px;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
  font-size: 28px;
}

h1, h2, p { margin: 0; }
h1 { font-size: 32px; letter-spacing: 0; }
h2 { font-size: 24px; letter-spacing: 0; }
.muted { color: var(--muted); }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 1px; }

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 30px;
}

label { display: grid; gap: 7px; color: var(--muted); font-size: 14px; }
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 13px 14px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}
input:focus { border-color: var(--accent); }

.primary-button, .gate-button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #07151a;
  font-weight: 700;
}
.primary-button { min-height: 48px; margin-top: 6px; }
.primary-button:hover, .gate-button:hover { background: #72e2c5; }

.error { color: var(--danger); font-size: 14px; }

.topbar, .status-line, .section-heading { display: flex; align-items: center; }
.topbar { justify-content: space-between; }
.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
}
.icon-button:hover { color: var(--text); border-color: var(--muted); }

.status-line {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status-dot.online { background: var(--accent); }
.status-dot.offline { background: var(--danger); }

.control-section { padding-top: 32px; }
.section-heading { justify-content: space-between; margin-bottom: 20px; }
.section-heading h2 { margin-top: 3px; }
.gate-symbol { color: var(--accent); font-size: 30px; }
.gate-button {
  position: relative;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  display: flex;
  width: 100%;
  min-height: 112px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  font-size: 18px;
}
.gate-button-icon { font-size: 28px; }
#gate-hold-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 10px;
  border: 0;
  appearance: none;
  background: transparent;
  pointer-events: none;
}
#gate-hold-progress::-webkit-progress-bar { background: transparent; }
#gate-hold-progress::-webkit-progress-value { background: #07594b; }
#gate-hold-progress::-moz-progress-bar { background: #07594b; }
.gate-button.holding { outline: 2px solid var(--text); outline-offset: 3px; }
.feedback { min-height: 24px; margin-top: 14px; color: var(--muted); font-size: 14px; }
.feedback.success { color: var(--accent); }
.feedback.error { color: var(--danger); }

@media (min-width: 600px) {
  .shell { padding-top: 52px; }
  .gate-button { min-height: 136px; font-size: 20px; }
}
