/* The account pages — login (views/login.ejs) and the world picker (views/shardPicker.ejs).
 *
 * Its own stylesheet for the same reason landing.css is: game.css is 22,000 lines of live
 * game UI, and the old .auth-page styles in it produced the single tall column the login
 * page was reported for ("too much height, can be wider"). These pages share the landing
 * page's palette — restated, not imported — so the walk from theidleshard.com through login
 * and into the game reads as one place.
 *
 * register.ejs / forgot-password.ejs / reset-password.ejs still use game.css's .auth-page
 * shell; they are single-form pages where the tall narrow column is actually right.
 */

:root {
  --shade: #0b0d12;
  --panel: rgba(15, 17, 22, 0.78);
  --well: #080a0e;
  --accent: #ffb578;
  --accent-strong: #f08a42;
  --accent-bright: #ffc98f;
  --ink: #e6e9ee;
  --ink-dim: #c3c8d0;
  --muted: #8d949f;
  --edge: rgba(255, 158, 88, 0.22);
  --edge-soft: rgba(255, 158, 88, 0.10);
  --accent-rgb: 255, 181, 120;
  --good: #58b06a;
  --bad: #d96a5e;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 0.68, 0.24, 1);
}

* { box-sizing: border-box; }

body.authx {
  margin: 0;
  min-height: 100vh;
  background: var(--shade);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The same Britain the landing hero opens on, held far darker — these pages are forms, and
   the art is a room to stand in rather than the thing being read. Fixed, so the page
   scrolling (short as it now is) slides over a still world. */
.authx-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--authx-art);
  background-size: cover;
  background-position: center 30%;
}
.authx-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(240, 138, 66, 0.07), transparent 60%),
    linear-gradient(180deg, rgba(8, 10, 14, 0.86), rgba(8, 10, 14, 0.94));
}

.authx-shell {
  width: min(1060px, 94vw);
  padding: 34px 0 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---------------------------------------------------------------- header --------------- */

/* One row where the old page stacked three: crest, wordmark and the in-development notice
   share the line, which alone reclaims most of the height the report was about. */
.authx-head {
  display: flex;
  align-items: center;
  gap: 16px;
}
.authx-head img {
  width: 74px;
  height: 74px;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.6));
}
.authx-title {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.authx-tagline {
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 5px;
}
/* The in-development notice, now sitting under the login card rather than in the masthead
   corner (see login.ejs). Full width of its column and centred, so it reads as a banner
   belonging to the form above it instead of a stray pill. */
.authx-devnote {
  margin: 0;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--edge);
  background: rgba(240, 138, 66, 0.08);
  color: var(--accent);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-align: center;
}

/* ---------------------------------------------------------------- layout --------------- */

/* ONE column now, not two. The waitlist moved off-canvas (see the drawer below), so what
   is left is the login card and the two notes under it — centred at the width the card
   actually wants rather than stretched across half a 1060px shell. */
.authx-grid {
  display: grid;
  grid-template-columns: minmax(0, 440px);
  justify-content: center;
  gap: 22px;
  align-items: start;
}
.authx-col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

/* ---------------------------------------------------------------- waitlist drawer ------ */

/* A button that has to sit in a row of links without looking like the odd one out. It is a
   <button> because it opens a drawer rather than going anywhere (login.ejs), and this is
   the whole of what makes it read as its siblings. */
.authx-linklike {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.authx-linklike:hover { text-decoration: underline; }

/* The dimmer. Its `hidden` attribute is removed by the script the moment the drawer is
   first opened — before that it must not intercept clicks even at zero opacity, and
   pointer-events alone would leave a keyboard user able to tab into nothing. */
.authx-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(6, 8, 12, 0.62);
  opacity: 0;
  transition: opacity 320ms ease;
  /* NOT optional. The scrim covers the entire viewport and, once revealed, stays in the
     DOM so it can fade out — at opacity 0 it is invisible but still the topmost element,
     so without this it silently ate every click on the page after the drawer's first
     close: the login fields could not be focused and nothing explained why. Transparent
     to the pointer unless it is actually up. */
  pointer-events: none;
}
.authx-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* The drawer itself. TRANSLATED off-screen, never display:none — the Turnstile widget
   inside renders on page load and needs a real layout box to render into (see login.ejs).
   That also gives the slide something to animate, which display cannot do. */
.authx-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 41;
  width: min(460px, 100vw);
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, rgba(16, 19, 26, 0.98), rgba(11, 13, 18, 0.99));
  border-left: 1px solid var(--edge);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.55);
  transform: translateX(100%);
  transition: transform 340ms cubic-bezier(0.22, 0.75, 0.3, 1);
  /* Closed, it is out of the tab order as well as off the screen. `visibility` transitions
     stepwise, so it flips only once the slide has finished — animating out still shows the
     panel the whole way. */
  visibility: hidden;
  transition-property: transform, visibility;
  transition-duration: 340ms, 0s;
  transition-delay: 0s, 340ms;
}
.authx-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition-delay: 0s, 0s;
}
.authx-drawer-inner { padding: 18px 18px 40px; }
.authx-drawer .authx-card { border-radius: 14px; }

.authx-drawer-close {
  appearance: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--edge);
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  margin: 0 0 12px auto;
  display: block;
}
.authx-drawer-close:hover { color: var(--ink); border-color: var(--accent); }

/* The invite path, kept but demoted — small print under the list, not a second headline. */
.authx-invited {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}
.authx-invited a { color: var(--accent); }

.authx-card {
  background: var(--panel);
  border: 1px solid var(--edge-soft);
  border-radius: 16px;
  padding: 28px 30px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.authx-card h1,
.authx-card h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 24px;
  margin: 0 0 6px;
}
.authx-card h2 { font-size: 20px; }
.authx-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 20px;
}

/* ---------------------------------------------------------------- forms ---------------- */

.authx-card label {
  display: block;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.authx-card input,
.authx-card textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  /* Dark wells, deliberately — the old page's white inputs were the brightest thing on the
     screen and read as a different product glued onto this one. */
  background: var(--well);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  letter-spacing: normal;
  text-transform: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.authx-card input:focus,
.authx-card textarea:focus {
  outline: none;
  border-color: rgba(var(--accent-rgb), 0.55);
  box-shadow: 0 0 0 3px rgba(240, 138, 66, 0.12);
}
.authx-card textarea { resize: vertical; min-height: 64px; }

.authx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 20px;
  border-radius: 9px;
  border: 1px solid rgba(var(--accent-rgb), 0.55);
  background: rgba(240, 138, 66, 0.14);
  color: var(--accent);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.authx-btn:hover { background: rgba(240, 138, 66, 0.24); border-color: var(--accent); color: var(--accent-bright); }
.authx-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.authx-btn[disabled] {
  cursor: default;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.authx-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  font-size: 13.5px;
}
.authx-links a { color: var(--ink-dim); text-decoration: none; }
.authx-links a:hover { color: var(--accent); }

.authx-error {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid rgba(217, 106, 94, 0.4);
  background: rgba(217, 106, 94, 0.1);
  color: #eba49b;
  font-size: 14px;
}
.authx-success {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid rgba(88, 176, 106, 0.4);
  background: rgba(88, 176, 106, 0.1);
  color: #93cf9f;
  font-size: 14px;
}

/* The legal-accept partial (partials/legalAccept.ejs) is styled by game.css everywhere
   else it appears; this page doesn't load game.css, so the box's chrome is restated here.
   The scroll region's max-height is the load-bearing line: without it the ENTIRE Terms of
   Service unrolls inline and the login page is five thousand pixels tall again — which is
   exactly the report this redesign answers. The scroll-to-accept behaviour itself is
   public/js/legalAccept.js's and unchanged. */
.authx-card .cf-turnstile { margin: 4px 0 14px; }
.legal-accept { margin: 4px 0 16px; }
.legal-accept-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.legal-accept-title {
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.legal-accept-open { font-size: 12.5px; color: var(--ink-dim); text-decoration: none; }
.legal-accept-open:hover { color: var(--accent); }
.legal-accept-scroll {
  max-height: 150px;
  overflow-y: auto;
  padding: 12px 14px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--well);
  font-size: 12.5px;
  color: var(--muted);
}
.legal-accept-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.legal-accept-scroll h4 { margin: 14px 0 6px; color: var(--ink-dim); font-size: 12.5px; }
.legal-accept-scroll h4:first-child { margin-top: 0; }
.legal-accept-scroll p, .legal-accept-scroll li { margin: 0 0 8px; line-height: 1.55; }
.legal-accept-scroll ul { margin: 0 0 8px; padding-left: 18px; }
/* The tick row — the label resets game-form styling the card's own label rule set above
   (uppercase micro-labels are for inputs, not a sentence you agree to). */
.legal-accept-hint { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.legal-accept-check {
  display: flex !important;
  align-items: flex-start;
  gap: 9px;
  margin: 10px 0 0;
  font-size: 13px;
  letter-spacing: normal !important;
  text-transform: none !important;
  color: var(--ink-dim);
}
.legal-accept-check a { color: var(--accent); text-decoration: none; }
.legal-accept-check input[type="checkbox"] {
  display: inline-block;
  width: auto;
  margin: 3px 0 0;
  accent-color: var(--accent-strong);
}

/* ---------------------------------------------------------------- discord -------------- */

.authx-discord {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 20px;
  border-radius: 13px;
  background: rgba(88, 101, 242, 0.11);
  border: 1px solid rgba(88, 101, 242, 0.34);
  text-decoration: none;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}
.authx-discord:hover { background: rgba(88, 101, 242, 0.19); transform: translateY(-2px); }
.authx-discord svg { width: 26px; height: 26px; fill: #8d9bff; flex: none; }
.authx-discord strong { display: block; color: var(--ink); font-size: 14.5px; }
.authx-discord span { display: block; font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- footer --------------- */

.authx-foot {
  display: flex;
  justify-content: center;
  gap: 22px;
  font-size: 13px;
}
.authx-foot a { color: var(--muted); text-decoration: none; }
.authx-foot a:hover { color: var(--accent); }

/* ---------------------------------------------------------------- world picker --------- */

.shard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.shard-card {
  background: var(--panel);
  border: 1px solid var(--edge-soft);
  border-radius: 16px;
  padding: 26px 28px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.shard-card.is-online:hover { border-color: rgba(var(--accent-rgb), 0.35); transform: translateY(-3px); }
.shard-card.is-offline { opacity: 0.75; }

.shard-card-head { display: flex; align-items: center; gap: 10px; }
.shard-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}
.is-online .shard-dot {
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(88, 176, 106, 0.6);
  animation: shard-pulse 2.6s infinite;
}
.is-offline .shard-dot { background: var(--bad); box-shadow: 0 0 10px rgba(217, 106, 94, 0.5); }
/* Locked: a maintenance window. Up, but shut — amber, because it is neither the green of
   "come in" nor the red of "gone", and the ember accent is what this UI already means by
   "attention". */
.is-locked .shard-dot { background: var(--accent-strong); box-shadow: 0 0 10px rgba(240, 138, 66, 0.55); }
@keyframes shard-pulse {
  0% { box-shadow: 0 0 0 0 rgba(88, 176, 106, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(88, 176, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(88, 176, 106, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .is-online .shard-dot { animation: none; }
  .authx-discord:hover, .shard-card.is-online:hover { transform: none; }
  /* The drawer still MOVES — it is off-canvas, so its position is what makes it open or
     shut — it simply stops sliding. Duration only; the visibility delay goes with it so
     nothing lingers a third of a second after the panel has already arrived. */
  .authx-drawer { transition-duration: 0s, 0s; transition-delay: 0s, 0s; }
  .authx-scrim { transition-duration: 0s; }
}

.shard-name { font-family: var(--serif); font-size: 20px; }
.shard-status {
  margin-left: auto;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.is-online .shard-status { color: var(--good); }
.is-offline .shard-status { color: var(--bad); }
.is-locked .shard-status { color: var(--accent); }
.shard-card.is-locked { opacity: 0.92; }

.shard-blurb { margin: 0; color: var(--ink-dim); font-size: 14px; }
.shard-meta { margin: 0 0 6px; color: var(--muted); font-size: 12.5px; }

/* The enter control reuses .authx-btn's look via this alias, because shardPicker.js swaps
   the element between <a> and <button> and only knows the .shard-enter class. */
.shard-enter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: 11px 20px;
  border-radius: 9px;
  border: 1px solid rgba(var(--accent-rgb), 0.55);
  background: rgba(240, 138, 66, 0.14);
  color: var(--accent);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.shard-enter:hover { background: rgba(240, 138, 66, 0.24); border-color: var(--accent); }
.shard-enter[disabled] {
  cursor: default;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.shard-logout { text-align: center; margin: 0; }
.shard-logout button {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}
.shard-logout button:hover { color: var(--accent); }

/* ---------------------------------------------------------------- responsive ----------- */

@media (max-width: 860px) {
  .authx-grid, .shard-list { grid-template-columns: 1fr; }
  /* Full-bleed on a phone: a 460px panel on a 380px screen is a drawer with nowhere to
     open into. min(460px, 100vw) above already caps it; this drops the border that would
     otherwise draw a line down the very edge of the display. */
  .authx-drawer { border-left: 0; }
  .authx-shell { padding-top: 24px; }
}
