/* Accounts: the sign-in card on the loading screen and in a dialog, the
   account chip, padlocks on locked controls. Tactical-glass look: dark blue
   glass, hairline edges, corner ticks, blue for action, gold sparingly. */

:root {
  --auth-lock-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7.5 10V7.8a4.5 4.5 0 0 1 9 0V10h.9A1.6 1.6 0 0 1 19 11.6v7.8a1.6 1.6 0 0 1-1.6 1.6H6.6A1.6 1.6 0 0 1 5 19.4v-7.8A1.6 1.6 0 0 1 6.6 10zm2 0h5V7.8a2.5 2.5 0 0 0-5 0z'/%3E%3C/svg%3E");
  --auth-ease: cubic-bezier(0.16, 0.84, 0.24, 1);
  --auth-gold: #c8a96a;
}

/* ---- the loading screen makes room --------------------------------------- */

.loading-splash .boot-cinema {
  transition: transform 1100ms var(--auth-ease), opacity 600ms ease;
}
.loading-splash.has-auth .boot-cinema {
  transform: translateX(clamp(150px, 19vw, 300px));
}
.loading-splash.has-auth.auth-decided .boot-cinema {
  transform: none;
}

.auth-splash {
  position: absolute;
  left: clamp(20px, 7vw, 120px);
  top: 50%;
  z-index: 3;
  width: min(360px, calc(100vw - 40px));
  opacity: 0;
  transform: translate(-48px, -50%);
  pointer-events: none;
  transition: transform 900ms var(--auth-ease), opacity 700ms ease;
}
.loading-splash.has-auth .auth-splash {
  opacity: 1;
  transform: translate(0, -50%);
  pointer-events: auto;
  transition-delay: 180ms;
}
.loading-splash.has-auth.auth-decided .auth-splash {
  opacity: 0;
  transform: translate(-36px, -50%);
  pointer-events: none;
  transition-delay: 700ms;
}

/* ---- the card --------------------------------------------------------------- */

.auth-card {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 24px 24px 20px;
  color: var(--text, #e4eaf2);
  background:
    linear-gradient(180deg, rgba(110, 176, 255, 0.07), transparent 38%),
    linear-gradient(180deg, rgba(18, 28, 44, 0.9), rgba(8, 13, 22, 0.94));
  border: 1px solid rgba(120, 184, 255, 0.22);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(160, 205, 255, 0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  font-family: "Segoe UI", "Bahnschrift", sans-serif;
}
/* A scan line crosses the card once as it arrives. */
.auth-card::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -40%;
  height: 40%;
  background: linear-gradient(180deg, transparent, rgba(110, 176, 255, 0.10), transparent);
  pointer-events: none;
  animation: auth-scan 1600ms var(--auth-ease) 500ms both;
}
.auth-tick {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(160, 200, 240, 0.45);
  pointer-events: none;
}
.auth-tick--tl { top: 6px; left: 6px; border-right: 0; border-bottom: 0; }
.auth-tick--tr { top: 6px; right: 6px; border-left: 0; border-bottom: 0; }
.auth-tick--bl { bottom: 6px; left: 6px; border-right: 0; border-top: 0; }
.auth-tick--br { bottom: 6px; right: 6px; border-left: 0; border-top: 0; }

/* Everything in the card arrives one after another. */
.auth-step {
  animation: auth-rise 620ms var(--auth-ease) both;
  animation-delay: calc(var(--i, 0) * 55ms + 420ms);
}
.auth-dialog .auth-step { animation-delay: calc(var(--i, 0) * 40ms + 80ms); }

.auth-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(168, 190, 216, 0.7);
  font: 700 9px/1 "Bahnschrift", "Segoe UI", sans-serif;
  letter-spacing: 0.38em;
  text-transform: uppercase;
}
.auth-kicker-icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--auth-gold);
  border: 1px solid rgba(200, 169, 106, 0.4);
  border-radius: 4px;
}
.auth-kicker-icon svg { width: 12px; height: 12px; }
.auth-title {
  margin: 0;
  color: #eef6ff;
  font: 300 26px/1.1 "Segoe UI", "Bahnschrift", sans-serif;
  letter-spacing: 0.01em;
}
.auth-reason {
  margin: -4px 0 0;
  color: rgba(200, 220, 242, 0.72);
  font-size: 12px;
  line-height: 1.45;
}

.auth-tabs {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  background: rgba(120, 184, 255, 0.06);
  border: 1px solid rgba(120, 184, 255, 0.14);
  border-radius: 7px;
}
.auth-tabs button {
  position: relative;
  z-index: 1;
  height: 28px;
  color: rgba(200, 220, 242, 0.62);
  background: none;
  border: 0;
  font: 700 10.5px/1 "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease;
}
.auth-tabs button[aria-selected="true"] { color: #eaf4ff; }
.auth-tabs button[hidden] { display: none; }
.auth-tab-ink {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  background: linear-gradient(180deg, rgba(61, 139, 255, 0.34), rgba(61, 139, 255, 0.16));
  border: 1px solid rgba(120, 184, 255, 0.45);
  border-radius: 5px;
  box-shadow: 0 0 12px rgba(61, 139, 255, 0.25);
  transition: transform 420ms var(--auth-ease);
}
.auth-tabs:has(button[data-tab="up"][hidden]) .auth-tab-ink { width: calc(100% - 6px); }
.auth-card.is-signup .auth-tab-ink { transform: translateX(100%); }

.auth-form {
  display: grid;
  gap: 10px;
}
.auth-field {
  display: grid;
  gap: 5px;
}
.auth-field[hidden] { display: none; }
.auth-field > span {
  color: rgba(168, 190, 216, 0.66);
  font: 700 9px/1 "Bahnschrift", "Segoe UI", sans-serif;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.auth-field input {
  height: 36px;
  padding: 0 12px;
  color: #eaf4ff;
  background: rgba(4, 8, 14, 0.66);
  border: 1px solid rgba(120, 184, 255, 0.18);
  border-radius: 6px;
  font: 400 14px/1 "Segoe UI", sans-serif;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.auth-field input:focus {
  background: rgba(8, 14, 24, 0.82);
  border-color: rgba(110, 176, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(61, 139, 255, 0.35), 0 0 16px rgba(61, 139, 255, 0.22);
}
.auth-card.is-signup .auth-field--again { animation: auth-rise 420ms var(--auth-ease) both; }

.auth-error {
  min-height: 15px;
  color: #ff8f86;
  font-size: 12px;
  line-height: 1.25;
}
.auth-error:empty { min-height: 0; }

.auth-submit {
  position: relative;
  height: 38px;
  overflow: hidden;
  color: var(--ink, #eaf4ff);
  background: linear-gradient(180deg, rgba(61, 139, 255, 0.5), rgba(61, 139, 255, 0.24));
  border: 1px solid rgba(120, 184, 255, 0.72);
  border-radius: 6px;
  font: 700 11.5px/1 "Segoe UI", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: box-shadow 0.18s ease, transform 0.08s ease, background 0.18s ease;
}
.auth-submit:hover { box-shadow: 0 0 16px rgba(61, 139, 255, 0.45); }
.auth-submit:active { transform: scale(0.985); }
.auth-submit:disabled { cursor: progress; }
/* Busy: light runs along the button. */
.auth-card.is-busy .auth-submit::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(190, 225, 255, 0.35), transparent);
  animation: auth-shimmer 900ms linear infinite;
}

.auth-guest {
  justify-self: center;
  padding: 4px 6px;
  color: rgba(168, 190, 216, 0.7);
  background: none;
  border: 0;
  font: 600 11.5px/1.2 "Segoe UI", sans-serif;
  cursor: pointer;
  transition: color 0.18s ease;
}
.auth-guest b { display: inline-block; transition: transform 0.2s ease; }
.auth-guest:hover { color: #dce9f8; }
.auth-guest:hover b { transform: translateX(3px); }
.auth-guest[hidden] { display: none; }

.auth-card.is-shake { animation: auth-shake 380ms ease; }

/* Done: the form steps aside, a check draws itself. */
.auth-done {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: linear-gradient(180deg, rgba(14, 22, 36, 0.96), rgba(8, 13, 22, 0.98));
  animation: auth-fade 380ms ease both;
}
.auth-done[hidden] { display: none; }
.auth-check { width: 56px; height: 56px; }
.auth-check circle,
.auth-check path {
  fill: none;
  stroke: #6eb0ff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-check circle { stroke-dasharray: 145; stroke-dashoffset: 145; animation: auth-draw 620ms var(--auth-ease) 80ms forwards; }
.auth-check path { stroke-dasharray: 36; stroke-dashoffset: 36; animation: auth-draw 420ms var(--auth-ease) 560ms forwards; }
.auth-done-text {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: rgba(214, 230, 248, 0.86);
  font-size: 13px;
}
.auth-done-text b { color: #fff; }

.auth-role,
.account-role {
  padding: 2px 7px;
  color: #cfe3f8;
  border: 1px solid rgba(120, 184, 255, 0.4);
  border-radius: 999px;
  font: 700 9px/1.4 "Segoe UI", sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.auth-role--supporter,
.account-role--supporter,
.auth-role--admin,
.account-role--admin {
  color: #f1dfb7;
  border-color: rgba(200, 169, 106, 0.6);
  background: rgba(200, 169, 106, 0.1);
}

/* ---- the dialog --------------------------------------------------------------- */

.auth-dialog {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 16px;
}
.auth-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 10, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 240ms ease;
}
.auth-dialog .auth-card {
  width: min(360px, 100%);
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  transition: opacity 240ms ease, transform 320ms var(--auth-ease);
}
.auth-dialog.is-open .auth-dialog-backdrop { opacity: 1; }
.auth-dialog.is-open .auth-card { opacity: 1; transform: none; }
.auth-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 26px;
  height: 26px;
  color: rgba(200, 220, 242, 0.6);
  background: none;
  border: 0;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.auth-close:hover { color: #fff; }

/* ---- "this is for supporters" ------------------------------------------------- */

.auth-notice {
  position: fixed;
  top: 64px;
  left: 50%;
  z-index: 9001;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  color: #e9f1fb;
  background: linear-gradient(180deg, rgba(22, 31, 48, 0.96), rgba(12, 18, 30, 0.96));
  border: 1px solid rgba(200, 169, 106, 0.45);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  font-size: 12.5px;
  line-height: 1.35;
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
  transition: opacity 220ms ease, transform 320ms var(--auth-ease);
}
.auth-notice.is-on { opacity: 1; transform: translate(-50%, 0); }
.auth-notice-icon { display: grid; width: 18px; height: 18px; color: var(--auth-gold); flex: none; }
.auth-notice-icon svg { width: 18px; height: 18px; }

/* ---- the account chip ---------------------------------------------------------- */

.account-wrap { position: relative; display: flex; align-items: center; margin-right: 10px; }
.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px 0 8px;
  color: #cfe0f2;
  background: rgba(120, 184, 255, 0.07);
  border: 1px solid rgba(120, 184, 255, 0.24);
  border-radius: 6px;
  font: 700 11px/1 "Segoe UI", sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.account-chip:hover { background: rgba(120, 184, 255, 0.16); border-color: rgba(120, 184, 255, 0.4); }
.account-chip svg { width: 15px; height: 15px; }
.account-chip:not(.is-signed) { color: #eaf4ff; border-color: rgba(120, 184, 255, 0.55); box-shadow: 0 0 10px rgba(61, 139, 255, 0.18); }
.account-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  display: grid;
  gap: 10px;
  min-width: 180px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(22, 31, 48, 0.97), rgba(12, 18, 30, 0.97));
  border: 1px solid rgba(120, 184, 255, 0.24);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  animation: auth-rise 220ms var(--auth-ease) both;
}
.account-menu[hidden] { display: none; }
.account-menu-who { display: grid; gap: 3px; color: rgba(200, 220, 242, 0.7); font-size: 11px; }
.account-menu-who b { color: #fff; font-size: 13px; }
.account-menu-out {
  height: 28px;
  color: #ffd2cd;
  background: rgba(255, 95, 82, 0.08);
  border: 1px solid rgba(255, 95, 82, 0.35);
  border-radius: 6px;
  font: 700 10.5px/1 "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.account-menu-out:hover { background: rgba(255, 95, 82, 0.16); }

/* ---- motion ---------------------------------------------------------------------- */

@keyframes auth-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes auth-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes auth-scan { from { transform: translateY(0); } to { transform: translateY(380%); } }
@keyframes auth-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes auth-draw { to { stroke-dashoffset: 0; } }
@keyframes auth-shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

/* Narrow screens: the readout rises and shrinks, the card comes up from below. */
@media (max-width: 820px) {
  .loading-splash.has-auth .boot-cinema { transform: translateY(-27vh) scale(0.6); }
  .auth-splash {
    left: 50%;
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    transform: translate(-50%, 40px);
  }
  .loading-splash.has-auth .auth-splash { transform: translate(-50%, 0); }
  .loading-splash.has-auth.auth-decided .auth-splash { transform: translate(-50%, 30px); }
  .auth-card { padding: 18px 18px 16px; gap: 10px; }
  .account-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .loading-splash .boot-cinema,
  .auth-splash,
  .auth-dialog .auth-card,
  .auth-tab-ink { transition: none; }
  .auth-step,
  .auth-card::before,
  .auth-card.is-shake,
  .auth-check circle,
  .auth-check path { animation: none; }
  .auth-check circle,
  .auth-check path { stroke-dashoffset: 0; }
}

/* ---- Node Studio: maps kept on the server -------------------------------------- */

.mg-btn--cloud { width: 100%; margin-top: 6px; justify-content: center; }
.mg-cloud { display: grid; gap: 6px; margin: 10px 0 4px; }
.mg-cloud[hidden] { display: none; }
.mg-cloud-row.is-current { box-shadow: inset 2px 0 0 var(--auth-gold); }

/* ---- V9 opened without the right ------------------------------------------------- */

.v9-locked .auth-card { width: min(420px, 100%); opacity: 1; transform: none; }
.v9-locked .auth-submit { display: flex; align-items: center; justify-content: center; text-decoration: none; }

/* ---- the Terms ------------------------------------------------------------------- */

.auth-terms {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(200, 220, 242, 0.78);
  font-size: 12px;
}
.auth-terms[hidden] { display: none; }
.auth-terms input { accent-color: #3d8bff; }
.auth-link {
  padding: 0;
  color: #9fccff;
  background: none;
  border: 0;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.terms-win { z-index: 9100; }
.terms-card { width: min(720px, 100%); grid-template-rows: auto minmax(0, 1fr) auto; }
.terms-body { color: rgba(214, 230, 248, 0.86); font-size: 13px; line-height: 1.55; }
.terms-body h3 { margin: 10px 0 0; color: #eef6ff; font: 600 13px/1.3 "Segoe UI", sans-serif; letter-spacing: 0.04em; }
.terms-body p, .terms-body ul { margin: 0; }
.terms-body ul { padding-left: 18px; display: grid; gap: 3px; }
.terms-lede { color: rgba(168, 190, 216, 0.85); }
.terms-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(120, 184, 255, 0.12);
}

/* ---- the sign-in card sits on the right of the loading screen (owner) ------------ */

.loading-splash.has-auth .boot-cinema {
  transform: translateX(calc(-1 * clamp(150px, 19vw, 300px)));
}
.auth-splash {
  left: auto;
  right: clamp(20px, 7vw, 120px);
  transform: translate(48px, -50%);
}
.loading-splash.has-auth.auth-decided .auth-splash {
  transform: translate(36px, -50%);
}
@media (max-width: 820px) {
  .loading-splash.has-auth .boot-cinema { transform: translateY(-27vh) scale(0.6); }
  .auth-splash { left: 50%; right: auto; transform: translate(-50%, 40px); }
  .loading-splash.has-auth.auth-decided .auth-splash { transform: translate(-50%, 30px); }
}
