html:not([data-gate="app"]) .shell { display: none !important; }
html[data-gate="app"] .login-gate { display: none; }
html[data-auth="session"] .dev-identity { display: none !important; }
html[data-gate="login"] #sr-status { top: 0; left: 0; }
html[data-gate="login"] { background: #071018; }
html[data-gate="login"],
html[data-gate="login"] body { height: 100%; overflow: hidden; }

.login-gate {
  height: 100%;
  max-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  overflow: hidden;
  background: #071018;
  color: #edf4fa;
}
.login-visual { position: relative; min-width: 0; overflow: hidden; }
.login-stage { position: absolute; inset: 0; }
.login-stage:before,
.login-stage:after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.login-stage:before {
  background:
    radial-gradient(520px 340px at 12% 0%, #1d4f58 0%, transparent 68%),
    linear-gradient(115deg, transparent 0%, #071018 72%);
  z-index: 1;
}
.login-stage:after {
  background: linear-gradient(90deg, transparent 0%, transparent 78%, #071018 100%);
  z-index: 2;
}
.login-orb {
  position: absolute;
  z-index: 0;
  width: 58%;
  height: 70%;
  left: 0;
  bottom: -8%;
  background: radial-gradient(circle at 30% 70%, rgba(158, 231, 216, 0.55), rgba(20, 70, 78, 0.18) 42%, transparent 70%);
  filter: blur(6px);
}
.login-stream {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
}
.login-floor path {
  fill: none;
  stroke: url(#floor-fade);
  stroke-width: 1;
}
.rail { fill: none; stroke-linecap: round; }
.rail-far { stroke: #2f6f74; stroke-width: 2.5; opacity: 0.85; }
.rail-mid { stroke: #7ed4c6; stroke-width: 26; opacity: 0.22; }
.rail-branch, .rail-return { stroke: url(#fork-light); stroke-width: 5; }
.rail-trunk { stroke: url(#trunk-light); stroke-width: 8; }
.rail-trunk { stroke-dasharray: 920; stroke-dashoffset: 920; animation: login-draw 1.7s ease forwards; }
.commit-nodes circle { fill: #071018; stroke: #9ee7d8; stroke-width: 2; }
.merge-node circle:nth-child(2) { fill: #d9fff6; stroke: #f7fffc; stroke-width: 2; }
.merge-glint { fill: #ffffff; stroke: none; }
.login-copy {
  position: absolute;
  z-index: 3;
  top: 48px;
  left: 52px;
  max-width: 540px;
}
.login-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: #9ee7d8;
  font-size: 20px;
  letter-spacing: -0.4px;
}
.login-mark span { font-size: 28px; font-weight: 300; line-height: 1; }
.login-copy h1 {
  margin: 0;
  max-width: none;
  font-size: clamp(36px, 4.5vw, 58px);
  line-height: 1.14;
  letter-spacing: -1.8px;
  font-weight: 600;
}
.login-value {
  margin: 16px 0 0;
  max-width: 28em;
  color: #c9d8e4;
  font-size: 17px;
  line-height: 1.5;
}
.login-panel {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 36px 42px;
  background:
    linear-gradient(180deg, rgba(158, 231, 216, 0.08), transparent 28%),
    #10202d;
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.28);
}
.login-form { width: 100%; }
.login-welcome {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.8px;
  font-weight: 600;
  color: #f4f8fb;
}
.login-lead { margin: 10px 0 28px; color: #b7c8d6; font-size: 16px; }
.login-field { margin-bottom: 18px; }
.login-field label { display: block; margin-bottom: 8px; color: #e4eef6; font-size: 15px; }
.login-field input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid #3c6274;
  border-radius: 10px;
  background: #0b1822;
  color: #f4f8fb;
  font-size: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.login-field input:focus {
  border-color: #9ee7d8;
  box-shadow: 0 0 0 4px rgba(158, 231, 216, 0.18);
  outline: none;
}
.login-secret { position: relative; }
.login-secret input { padding-right: 104px; }
.login-secret button {
  position: absolute;
  top: 8px;
  right: 8px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #9ee7d8;
  font-size: 14px;
}
.login-secret button:hover { background: rgba(158, 231, 216, 0.08); }
.login-error { margin: 0 0 14px; color: #efb7b1; font-size: 15px; line-height: 1.45; }
.login-submit {
  width: 100%;
  height: 52px;
  margin-top: 6px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #e7fff8 0%, #8fd9cb 48%, #67c3b4 100%);
  color: #0d2e2b;
  font-size: 16px;
  font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 10px 24px rgba(8, 40, 38, 0.35);
}
.login-submit:hover { background: linear-gradient(180deg, #f4fffc 0%, #b7eee4 48%, #7ed4c6 100%); }
.login-submit:disabled { opacity: 0.72; }
@media (max-width: 800px) {
  html[data-gate="login"],
  html[data-gate="login"] body { height: auto; overflow-x: hidden; overflow-y: auto; }
  .login-gate {
    display: block;
    height: auto;
    max-height: none;
    min-height: 100dvh;
    overflow: visible;
  }
  .login-visual { height: auto; }
  .login-stage { position: relative; height: auto; }
  .login-stage:before { background: radial-gradient(280px 120px at 0% 0%, #1d4f58, transparent 70%); }
  .login-stage:after { display: none; }
  .login-stream, .login-orb { display: none; }
  .login-copy { position: relative; top: auto; left: auto; max-width: none; padding: 28px 22px 0; }
  .login-copy h1 { font-size: 34px; letter-spacing: -1px; }
  .login-value { font-size: 15px; }
  .login-panel {
    box-shadow: none;
    padding: 22px 22px 32px;
    background: transparent;
  }
  .login-welcome { font-size: 28px; }
  .login-form { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .rail-trunk { animation: none; stroke-dashoffset: 0; }
}
@keyframes login-draw { to { stroke-dashoffset: 0; } }
