:root {
  color-scheme: dark;
  --bg: #0b0b0d;
  --surface: #111114;
  --line: rgba(255,255,255,.085);
  --ink: #f5f5f2;
  --muted: #9b9b98;
  --faint: #656563;
  --brand: #ff6b35;
  --brand-low: #bd421c;
  --error: #e89b9b;
  /* Per-app accent. sign-in.js overrides these by client_id; the default is the
     Aditor brand orange, so an unknown app still looks on-brand. --robot-hue /
     --robot-sat tint the shared robot art toward the app accent. */
  --accent: var(--brand);
  --accent-low: var(--brand-low);
  --robot-hue: 0deg;
  --robot-sat: 1;
}
/* Per-app accent, selected by the data-app the server injects from client_id, so
   the right accent paints on the first byte (no flash). Default (no data-app) is
   the brand orange above. sign-in.js only sets the per-app text. */
body[data-app="scorecard"] { --accent: #4f8ef7; --accent-low: #2f6fd6; --robot-hue: 205deg; --robot-sat: 1.1; }
body[data-app="brain"]     { --accent: #a78bfa; --accent-low: #7c5cde; --robot-hue: 245deg; --robot-sat: 1.05; }
body[data-app="gen"]       { --accent: #ff6b35; --accent-low: #bd421c; --robot-hue: 0deg;   --robot-sat: 1; }
body[data-app="editor"]    { --accent: #e3a33a; --accent-low: #a9761b; --robot-hue: 30deg; --robot-sat: 1.08; }
body[data-app="review"]    { --accent: #3b82f6; --accent-low: #2563eb; --robot-hue: 0deg; --robot-sat: 1; }
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 560px at 50% -10%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 64%),
    radial-gradient(640px 520px at -6% 110%, rgba(143,185,230,.05), transparent 65%),
    var(--bg);
}

/* ---------- two-panel shell ---------- */
.split {
  width: min(100%, 1120px); height: min(88vh, 760px);
  display: grid; grid-template-columns: 1.08fr .92fr;
  border: 1px solid var(--line); border-radius: 24px; overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.02));
  box-shadow: inset 0 1px rgba(255,255,255,.05), 0 40px 90px rgba(0,0,0,.55);
}

/* ---------- left brand panel (themed) ---------- */
.panel {
  position: relative; padding: 34px 38px; display: flex; flex-direction: column; overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(620px 440px at 18% 115%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 62%),
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, #0e0e12), #0a0a0d);
}
.wordmark { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 17px; letter-spacing: -.02em; position: relative; z-index: 1; }
.wordmark .mk { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px; background: linear-gradient(180deg, var(--accent), var(--accent-low)); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 40%, transparent); }
.wordmark .app { color: var(--muted); font-weight: 600; }
.headline { margin-top: 34px; font-size: clamp(32px, 4.2vw, 50px); line-height: 1.03; letter-spacing: -.04em; font-weight: 800; max-width: 12ch; position: relative; z-index: 1; }
.headline em { font-style: normal; color: var(--accent); }
.panelfoot { margin-top: auto; color: var(--faint); font: 9px ui-monospace, monospace; letter-spacing: .16em; text-transform: uppercase; position: relative; z-index: 1; }
.robot { position: absolute; right: -18px; bottom: -14px; width: min(52%, 330px); pointer-events: none; filter: hue-rotate(var(--robot-hue)) saturate(var(--robot-sat)) drop-shadow(0 30px 50px rgba(0,0,0,.5)); }
/* Review (FreeFrame/AutoReview): the real recolored-blue robot asset + its drop-shadow-
   only filter are rendered server-side on the <img> (see renderSignIn robotSrc/robotStyle),
   so there is no CSS content swap here and --robot-hue is 0 above - the asset is already blue. */

/* ---------- right form panel ---------- */
.formside { padding: 40px clamp(28px, 4vw, 60px); display: flex; flex-direction: column; justify-content: center; overflow: auto; }
.formwrap { width: 100%; max-width: 340px; margin: 0 auto; }
.eyebrow { color: var(--faint); font: 600 10px ui-monospace, monospace; letter-spacing: .2em; text-transform: uppercase; }
h1 { margin: 9px 0 0; font-size: 26px; letter-spacing: -.035em; font-weight: 700; }
.sub { margin: 6px 0 22px; color: var(--muted); font-size: 13px; }

label { display: block; margin: 0 0 8px; color: var(--muted); font-size: 12px; }
input { width: 100%; padding: 13px 14px; color: var(--ink); background: #060609; border: 1px solid #202024; border-radius: 10px; outline: none; font: inherit; box-shadow: inset 0 2px 5px #000; }
input:focus { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: inset 0 2px 5px #000, 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }

button, .button { width: 100%; margin-top: 13px; padding: 12px 16px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--accent-low) 82%, #000); color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 90%, #fff 4%), var(--accent-low)); box-shadow: inset 0 1px rgba(255,255,255,.28), 0 12px 22px color-mix(in srgb, var(--accent) 22%, transparent); font: 650 13px inherit; cursor: pointer; text-decoration: none; text-align: center; display: block; }
button:disabled { opacity: .5; cursor: wait; }
.secondary { border-color: var(--line); color: var(--ink); background: rgba(255,255,255,.04); box-shadow: none; }
.row { display: flex; gap: 10px; }
.row > * { min-width: 0; }
.row .secondary { flex: 1; }
.row button { flex: 1.3; }
.message { min-height: 20px; margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 11px; line-height: 1.5; }
.message.error { color: var(--error); }
.hidden { display: none !important; }
.code input, .codein { text-align: center; letter-spacing: .24em; font: 500 22px ui-monospace, monospace; }

/* Chooser layout: the per-app lane sets which method appears first via #methods. */
#methods { display: flex; flex-direction: column; }
.method { display: flex; flex-direction: column; }
#password-block { order: 0; }
#divider { order: 1; }
#google-block { order: 2; }
#methods.google-first #google-block { order: 0; }
#methods.google-first #divider { order: 1; }
#methods.google-first #password-block { order: 2; }
/* When Google is not configured, only email+password and the OTP fallback show. */
body[data-google-enabled="false"] #google-block,
body[data-google-enabled="false"] #divider { display: none; }

#divider { display: flex; align-items: center; color: var(--faint); font: 9px ui-monospace, monospace; letter-spacing: .18em; text-transform: uppercase; margin: 16px 0; }
#divider span { padding: 0 10px; }
#divider::before, #divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

#google { display: flex; align-items: center; justify-content: center; gap: 10px; }
#google .gmark { flex: 0 0 auto; background: #fff; border-radius: 3px; padding: 2px; box-sizing: content-box; }

.links { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; text-align: center; }
.link { width: auto; margin: 0; padding: 2px; border: none; background: none; box-shadow: none; color: var(--muted); font: 600 12px inherit; cursor: pointer; text-decoration: underline; }
.link:hover { color: var(--ink); }
.back { margin-top: 10px; }
.context { margin: 13px 0 0; padding: 13px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.2); }
.context strong { display: block; font-size: 13px; }
.context span { color: var(--muted); font-size: 11px; }
.note { color: var(--muted); font-size: 12px; line-height: 1.6; }

/* Consent, account preparation and signed-out pages share the compact shell.
   The sign-in redesign removed their sizing and left the logo at natural size. */
body:has(> main:not(.split)), body[data-google-only="true"] {
  min-height: 100svh;
  padding: 24px;
  background: var(--bg);
}
main:not(.split) { width: min(100%, 420px); }
.brand { text-align: center; margin-bottom: 24px; }
.brand .mark { display: block; width: 40px; height: 40px; object-fit: contain; margin: 0 auto 16px; }
.brand p { color: var(--muted); line-height: 1.5; font-size: 16px; }
main:not(.split) .card { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
main:not(.split) .foot { margin-top: 24px; text-align: center; color: var(--muted); font-size: 12px; }
main:not(.split) .context span { display: block; margin-top: 8px; font-size: 14px; line-height: 1.5; }
main:not(.split) .note { font-size: 14px; }
main:not(.split) button { min-height: 44px; }
#restart { margin-top: 0; min-height: 44px; display: grid; place-items: center; }
button:focus-visible, .button:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
button:active { opacity: .85; }
body[data-google-only="true"] .split {
  width: min(100%, 420px); height: auto; min-height: 0;
  grid-template-columns: 1fr; border-radius: 16px; box-shadow: none;
  background: var(--surface);
}
body[data-google-only="true"] .panel { min-height: 0; padding: 24px 24px 0; border: 0; background: none; }
body[data-google-only="true"] .headline,
body[data-google-only="true"] .robot,
body[data-google-only="true"] .panelfoot,
body[data-google-only="true"] .eyebrow,
body[data-google-only="true"] #password-block,
body[data-google-only="true"] #divider,
body[data-google-only="true"] .links { display: none; }
body[data-google-only="true"] .formside { padding: 24px; }
body[data-google-only="true"] .sub { font-size: 16px; line-height: 1.5; }
body[data-google-only="true"] #google { min-height: 44px; }

/* ---------- stack on narrow screens ---------- */
@media (max-width: 860px) {
  body { padding: 0; }
  .split { grid-template-columns: 1fr; height: auto; min-height: 100vh; border-radius: 0; border: none; }
  .panel { min-height: 212px; padding: 26px 24px; }
  .headline { font-size: 29px; margin-top: 58px; }
  .robot { width: 188px; right: -8px; opacity: .92; }
  .formside { padding: 30px 22px 46px; }
}
