/* The public entrance has one light palette, independent of account themes. */
#auth-screen {
  color-scheme: light;
  --bg: #f5f4ec;
  --text: #283c2f;
  --muted: #71806f;
  --panel: #fffef9;
  --surface: #fffef9;
  --border: #dfe3d7;
  --focus-accent: #53744b;
  --focus-on-accent: #ffffff;
  --focus-raised: #ffffff;
  --focus-hover: #edf1e6;
  --focus-active: #e7eddf;
  --soft-hover: #edf1e6;
  position: fixed;
  z-index: 80;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  color: var(--text);
}

#auth-screen[hidden] { display: none; }

#auth-screen .auth-shell {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(min-content, 1fr) auto;
  gap: 28px;
  width: 100%;
  min-height: max(580px, 100dvh);
  overflow: hidden;
  padding: clamp(22px, 3vw, 40px) clamp(24px, 3.5vw, 56px) 24px;
  background:
    radial-gradient(ellipse at 12% 28%, #dce5c877, transparent 52%),
    radial-gradient(ellipse at 90% 82%, #eae1c766, transparent 48%),
    var(--bg);
}

#auth-screen .auth-topbar {
  z-index: 3;
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

#auth-screen .auth-brand { display: flex; align-items: center; gap: 9px; }
#auth-screen .auth-brand img { width: 34px; height: 34px; border-radius: 8px; }
#auth-screen .auth-brand strong { color: var(--text); font-size: 15px; font-weight: 750; letter-spacing: -0.5px; }
#auth-screen button { font-family: inherit; cursor: pointer; }
#auth-screen :is(button, a):focus-visible { outline: 3px solid #53744b; outline-offset: 4px; }

#auth-screen .auth-language-switch { margin-left: auto; }
#auth-screen .header-menu-button {
  display: flex;
  min-width: 70px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
}
#auth-screen .auth-language-chevron { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
#auth-screen .header-menu-button:is(:hover, [aria-expanded="true"]) { background: #edf1e6; color: var(--text); }
#auth-screen .header-menu-panel { border-color: var(--border); border-radius: 9px; background: var(--panel); color: var(--text); padding: 5px; }
#auth-screen .header-menu-panel button { min-height: 38px; color: var(--text); font-weight: 500; }
#auth-screen .header-menu-panel button:is(:hover, :focus-visible, .active) { background: #edf1e6; color: var(--text); }

#auth-screen .auth-login-card {
  z-index: 2;
  display: flex;
  width: min(390px, 100%);
  min-width: 0;
  flex-direction: column;
  align-items: center;
  align-self: center;
  justify-self: center;
  margin: 24px 0;
  padding: 42px 38px 31px;
  border: 1px solid #dce2d2;
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 24px 70px #22392214, 0 0 0 8px #f5f4ec66;
  text-align: center;
}
#auth-screen .auth-login-logo { display: block; width: 67px; height: 67px; margin-bottom: 22px; border-radius: 14px; }
#auth-screen .auth-login-card h1 { margin: 0; color: var(--text); font-size: 32px; font-weight: 750; line-height: 1.15; letter-spacing: -1.35px; }
#auth-screen .auth-login-card .eyebrow { display: flex; align-items: center; gap: 7px; margin: 15px 0 32px; color: var(--focus-accent); font-size: 10px; font-weight: 600; letter-spacing: 1.8px; text-transform: uppercase; }
#auth-screen .auth-login-card .eyebrow::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
#auth-screen .google-sign-in-button { display: grid; width: 100%; min-height: 44px; place-items: center; }
#auth-screen .auth-legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; margin-top: 17px; }
#auth-screen .auth-legal-link { display: inline-flex; min-height: 32px; align-items: center; padding: 4px 8px; color: #667460; font-size: 11px; text-decoration: none; }
#auth-screen .auth-legal-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
#auth-screen .auth-status { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
#auth-screen .auth-status:empty { display: none; }
#auth-screen .auth-status.error { color: #9f3e31; }
#auth-screen #auth-retry { margin-top: 12px; }
#auth-screen .auth-footer { z-index: 2; align-self: end; color: #6f7b66; font-size: 10px; letter-spacing: 0.2px; }

#auth-screen .local-auth-form { display: grid; width: 100%; gap: 12px; margin-top: 18px; border-top: 1px solid var(--border); padding-top: 18px; text-align: left; }
#auth-screen .local-auth-form[hidden] { display: none; }
#auth-screen .local-auth-divider { color: var(--muted); font-size: 12px; font-weight: 600; }
#auth-screen .local-auth-form label { display: grid; gap: 6px; color: var(--text); font-size: 12px; }
#auth-screen .local-auth-form input { width: 100%; min-height: 44px; border: 1px solid var(--border); border-radius: 7px; background: #ffffff; color: var(--text); padding: 9px 11px; font: inherit; }
#auth-screen :is(.local-auth-form button, #auth-retry) { min-height: 42px; border: 0; border-radius: 7px; background: var(--focus-accent); color: var(--focus-on-accent); padding: 9px 14px; font-size: 12px; font-weight: 600; }
#auth-screen :is(.local-auth-form button, #auth-retry):hover { background: #41613c; }

#auth-screen .auth-backdrop { position: absolute; z-index: -2; inset: 0; pointer-events: none; }
#auth-screen .auth-backdrop-halo { position: absolute; z-index: -1; inset: 0; pointer-events: none; background: radial-gradient(ellipse 36% 46% at 50% 51%, var(--bg) 12%, #f5f4ece6 44%, #f5f4ec00 100%); }
#auth-screen .auth-preview-frame { position: absolute; left: 0; top: 0; width: 420px; height: 288px; overflow: hidden; border: 1px solid #d6dfca; border-radius: 10px; background: #fffef9; color: #304531; box-shadow: 0 18px 48px #2c44241a; opacity: 0.8; will-change: transform; transform-origin: center; }
#auth-screen .auth-preview-browser { display: flex; height: 23px; align-items: center; gap: 4px; padding: 0 10px; border-bottom: 1px solid #e5e9de; }
#auth-screen .auth-preview-browser > span { width: 4px; height: 4px; border-radius: 50%; background: #d6dfca; }
#auth-screen .auth-preview-browser small { margin-left: auto; color: #7d8a75; font-size: 8px; }
#auth-screen .auth-preview-nav { display: flex; height: 38px; align-items: center; gap: 6px; border-bottom: 1px solid #e5e9de; padding: 0 13px; }
#auth-screen .auth-preview-nav img { width: 20px; height: 20px; border-radius: 4px; }
#auth-screen .auth-preview-nav strong { font-size: 10px; font-weight: 650; letter-spacing: -0.3px; }
#auth-screen .auth-preview-nav > span { margin-left: auto; color: #7a896f; font-size: 9px; }
#auth-screen .auth-preview-board-layout { display: grid; grid-template-columns: 196px minmax(0, 1fr); align-items: start; gap: 18px; padding: 14px 15px; }
#auth-screen .auth-preview-board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: 196px; height: 196px; overflow: hidden; border-radius: 3px; }
#auth-screen .auth-preview-square { display: grid; place-items: center; background: #e8ecd9; }
#auth-screen .auth-preview-square.dark { background: #92a77f; }
#auth-screen .auth-preview-square.highlighted { box-shadow: inset 0 0 0 30px #d4df8299; }
#auth-screen .auth-preview-square img { width: 23px; height: 23px; }
#auth-screen .auth-preview-sidebar h2 { margin: 4px 0 12px; font-size: 13px; font-weight: 600; letter-spacing: -0.2px; }
#auth-screen .auth-preview-sidebar p { margin: 0 0 14px; color: #7a876f; font-size: 10px; }
#auth-screen .auth-preview-moves { display: grid; gap: 3px; padding: 6px; border-radius: 5px; background: #f0f3e9; }
#auth-screen .auth-preview-moves > div { display: grid; grid-template-columns: 22px 1fr 1fr; padding: 5px 3px; border-radius: 3px; font-size: 11px; }
#auth-screen .auth-preview-moves > div.current { background: #e0e9d6; }
#auth-screen .auth-preview-moves > div > span:first-child { color: #7a896f; }
#auth-screen .auth-preview-action { margin-top: 14px; border-radius: 5px; background: #e9efdf; padding: 8px 6px; color: #4f7044; font-size: 10px; text-align: center; }
#auth-screen .auth-preview-player { display: flex; align-items: center; gap: 8px; margin: 0 0 13px; padding-bottom: 10px; border-bottom: 1px solid #e5e9de; font-size: 11px; }
#auth-screen .auth-preview-player img { width: 28px; height: 28px; padding: 3px; border-radius: 50%; background: #e9efdf; }
#auth-screen .auth-preview-stack { display: grid; gap: 8px; }
#auth-screen .auth-preview-stack > span { border: 1px solid #e0e6d7; border-radius: 5px; padding: 10px 8px; font-size: 10px; }
#auth-screen .auth-preview-list { padding: 18px 20px; }
#auth-screen .auth-preview-list h2 { margin: 0 0 17px; font-size: 15px; font-weight: 600; letter-spacing: -0.3px; }
#auth-screen .auth-preview-tabs { display: flex; gap: 16px; margin-bottom: 16px; font-size: 10px; color: #7a896f; }
#auth-screen .auth-preview-tabs > span:first-child { color: #4f7044; }
#auth-screen .auth-preview-list-row { display: flex; min-height: 44px; align-items: center; gap: 9px; margin: 7px 0; border: 1px solid #e0e6d7; border-radius: 6px; padding: 8px 10px; font-size: 11px; }
#auth-screen .auth-preview-list-row small { margin-left: auto; border-radius: 4px; background: #edf2e5; padding: 5px 7px; color: #668456; font-size: 9px; }
#auth-screen .auth-preview-list-icon { width: 20px; color: #6c8556; font-size: 20px; text-align: center; }
#auth-screen .auth-preview-rounds { display: flex; justify-content: space-between; gap: 10px; margin: 4px 0 16px; }
#auth-screen .auth-preview-rounds > span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: #f0f3e9; color: #7a896f; font-size: 10px; }
#auth-screen .auth-preview-rounds > span.current { background: #73915f; color: #ffffff; }

@media (max-width: 759px) {
  #auth-screen .auth-shell { gap: 22px; min-height: max(560px, 100dvh); padding: 22px 22px 20px; }
  #auth-screen .auth-brand strong { font-size: 13px; }
  #auth-screen .auth-brand img { width: 30px; height: 30px; }
  #auth-screen .auth-login-card { width: min(350px, 100%); padding: 35px 24px 26px; border-radius: 22px; }
  #auth-screen .auth-login-card h1 { font-size: 29px; }
  #auth-screen .auth-login-logo { width: 62px; height: 62px; margin-bottom: 21px; }
  #auth-screen .auth-backdrop-halo { background: radial-gradient(ellipse 85% 39% at 50% 51%, var(--bg) 18%, #f5f4eceb 50%, #f5f4ec00 100%); }
  #auth-screen .auth-preview-frame { opacity: 0.69; }
}

@media (pointer: coarse) {
  #auth-screen .header-menu-button,
  #auth-screen .header-menu-panel button,
  #auth-screen .auth-legal-link { min-height: 44px; }
  #auth-screen .local-auth-form input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  #auth-screen .auth-preview-frame { will-change: auto; }
}
