/* =============================== LOGIN =============================== */
.login {
  --p: #3dfc8f; --p-dim: #1b7a46; --p-faint: rgba(61, 252, 143, .08);
  position: fixed; inset: 0; overflow: hidden; background: #020604; color: var(--p);
  font-family: var(--mono); letter-spacing: .04em;
}
.login-map { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-scan {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.28) 2px 3px);
  mix-blend-mode: multiply;
}
.login-scan::after {
  content: ""; position: absolute; left: 0; right: 0; height: 120px; top: -120px;
  background: linear-gradient(to bottom, transparent, rgba(61,252,143,.05), transparent);
  animation: sweep 7s linear infinite;
}
@keyframes sweep { to { transform: translateY(calc(100vh + 120px)); } }
.login-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; gap: 16px;
  padding: 14px 22px; font-size: 12px; color: var(--p-dim); border-bottom: 1px solid rgba(61,252,143,.15);
  background: rgba(2,6,4,.6);
}
.blink { color: #ff5f56; animation: blink 1.6s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

.login-stats { position: absolute; top: 72px; width: 230px; display: grid; gap: 16px; font-size: 12px; }
.login-stats--left { left: 22px; }
.login-stats--right { right: 22px; bottom: 64px; grid-template-rows: auto 1fr; }
.stat { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid rgba(61,252,143,.18); background: rgba(2,10,6,.72); }
.stat-k { color: var(--p-dim); font-size: 11px; }
.stat-v { font-size: 20px; color: var(--p); text-shadow: 0 0 8px rgba(61,252,143,.5); }
.bars { display: flex; gap: 3px; height: 14px; align-items: flex-end; }
.bars i { flex: 1; background: rgba(61,252,143,.15); height: 100%; transition: background .4s; }
.bars i.on { background: var(--p); box-shadow: 0 0 6px rgba(61,252,143,.6); }
.bars i.hot { background: #ffb547; }
.log {
  border: 1px solid rgba(61,252,143,.18); background: rgba(2,10,6,.72); padding: 10px 12px;
  overflow: hidden; font-size: 11px; line-height: 1.7; color: var(--p-dim);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.log b { color: var(--p); font-weight: normal; }
.log .warn { color: #ffb547; }

.login-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(380px, calc(100vw - 32px)); padding: 30px 28px 24px;
  background: rgba(2, 10, 6, .86); border: 1px solid rgba(61,252,143,.4);
  box-shadow: 0 0 0 1px rgba(61,252,143,.06), 0 0 40px rgba(61,252,143,.12), inset 0 0 30px rgba(61,252,143,.05);
}
.login-card::before, .login-card::after {
  content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--p);
}
.login-card::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.login-card::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }
.login-badge {
  display: inline-block; font-size: 11px; color: #ff5f56; border: 1px solid #ff5f56; padding: 2px 8px; margin-bottom: 14px;
}
.login-title { font-family: var(--mono); font-size: 56px; line-height: 1; margin: 0 0 6px; letter-spacing: .3em; color: var(--p); text-shadow: 0 0 18px rgba(61,252,143,.55); font-weight: normal; }
.login-sub { margin: 0 0 22px; font-size: 12px; color: var(--p-dim); }
.login-form { display: grid; gap: 10px; }
.login-form label { color: var(--p-dim); font-size: 12px; margin: 0; }
.login-form input {
  background: #010402; border: 1px solid rgba(61,252,143,.35); color: var(--p); border-radius: 0;
  font-family: var(--mono); font-size: 16px; padding: 11px 12px; caret-color: var(--p);
}
.login-form input::placeholder { color: rgba(61,252,143,.3); }
.login-form input:focus { border-color: var(--p); box-shadow: 0 0 0 1px var(--p), 0 0 14px rgba(61,252,143,.25); }
#code { font-size: 26px; letter-spacing: .5em; text-align: center; }
.login-form button[type=submit] {
  margin-top: 6px; font-family: var(--mono); font-size: 14px; letter-spacing: .12em; text-transform: uppercase;
  padding: 12px; border: 1px solid var(--p); background: rgba(61,252,143,.12); color: var(--p); cursor: pointer;
}
.login-form button[type=submit]:hover:not(:disabled) { background: var(--p); color: #021007; }
.login-form button:disabled { opacity: .5; cursor: wait; }
.login-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.login-links button { background: none; border: 0; color: var(--p-dim); font: inherit; font-size: 12px; cursor: pointer; padding: 4px 0; }
.login-links button:hover { color: var(--p); }
.login-msg { min-height: 1.4em; margin: 16px 0 0; font-size: 12px; color: var(--p-dim); }
.login-msg.err { color: #ff5f56; }
.login-ticker {
  position: absolute; left: 0; right: 0; bottom: 0; height: 30px; overflow: hidden; white-space: nowrap;
  border-top: 1px solid rgba(61,252,143,.15); background: rgba(2,6,4,.7); font-size: 11px; color: var(--p-dim);
}
.login-ticker div { display: inline-block; padding: 8px 0; animation: tick 60s linear infinite; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }

@media (max-width: 900px) { .login-stats { display: none; } }
@media (max-width: 520px) { .login-top span:nth-child(2) { display: none; } .login-title { font-size: 44px; } }
@media (prefers-reduced-motion: reduce) { .login *, .login *::after { animation: none !important; } }

/* =============================== SHELL =============================== */
.shell { display: grid; grid-template-rows: 46px 1fr; height: 100vh; height: 100dvh; }
.bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 10px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 20;
}
.bar-left { display: flex; }
.bar-right { display: flex; justify-content: flex-end; gap: 4px; }
.grid-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px;
  background: none; color: var(--green); cursor: pointer; fill: currentColor; transition: background .15s;
}
.grid-btn:hover, .grid-btn[aria-expanded="true"] { background: var(--surface-2); }
.bar-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 18px; letter-spacing: .35em; padding: 6px 4px 6px 12px;
  background: none; border: 0; color: var(--text); cursor: pointer;
}
.bar-title:hover { color: var(--green); }
.bar-link { background: none; border: 0; font: inherit; font-size: 14px; font-weight: 500; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.bar-link:hover { background: var(--surface-2); }
.bar-link--green { color: var(--green); }
.bar-link--red { color: var(--red); }

.stage { position: relative; min-height: 0; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }

/* launcher: expands from the grid icon */
.launcher {
  position: fixed; top: 52px; left: 8px; z-index: 30;
  width: min(560px, calc(100vw - 16px)); max-height: calc(100dvh - 64px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
  padding: 14px 16px 18px;
  transform-origin: 20px -29px;
  clip-path: circle(0 at 20px -29px); opacity: 0; visibility: hidden;
  transition: clip-path .32s cubic-bezier(.2,.7,.2,1), opacity .2s, visibility 0s .32s;
}
.launcher.open { clip-path: circle(150% at 20px -29px); opacity: 1; visibility: visible; transition: clip-path .38s cubic-bezier(.2,.7,.2,1), opacity .15s; }
.launcher h3 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.launcher h3:first-child { margin-top: 2px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 4px; }
.tile {
  display: grid; justify-items: center; gap: 8px; padding: 14px 6px 12px; border-radius: 8px;
  background: none; border: 0; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-align: center;
}
.tile:hover, .tile:focus-visible { background: var(--surface-2); }
.tile img, .tile .tile-letter { width: 40px; height: 40px; object-fit: contain; }
.tile-letter { display: grid; place-items: center; border-radius: 10px; background: var(--green-dim); color: var(--green-strong); font-weight: 600; font-size: 18px; }
.tile .ext { font-size: 11px; color: var(--muted); }
.launcher-empty { color: var(--muted); padding: 10px 4px; margin: 0; }

/* feedback modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.6); padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { width: min(480px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: grid; gap: 6px; }
.modal-box select, .modal-box textarea { margin-bottom: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60;
  background: var(--surface-2); border: 1px solid var(--green-dim); color: var(--text); padding: 10px 16px; border-radius: 8px; font-size: 14px;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .bar-title { letter-spacing: .2em; font-size: 16px; }
  .bar-link { padding: 8px 6px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .launcher, .launcher.open, .toast { transition: none; } }
.bar-right { grid-column: 3; }
