/* The gateway's sign-in, sign-up, reset and verify pages (04 §18): the menu panel's look, mirrored by hand from the
   client's ui/tokens.css, ui/ui.css and screens/menu/menu.css (frame, title plate, sunk fields, button tiers).
   Self-contained: nothing of the game is loaded before sign-in. Fonts are served by the gateway under /login/fonts/.
   One column: the fields (`.bw-fields`, a new field goes there), the one gold button, a word, then quiet links. */
@font-face { font-family: "Alegreya SC"; font-weight: 500; font-display: swap; src: url("/login/fonts/alegreya-sc-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Alegreya SC"; font-weight: 700; font-display: swap; src: url("/login/fonts/alegreya-sc-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-weight: 400; font-display: swap; src: url("/login/fonts/alegreya-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-weight: 500; font-display: swap; src: url("/login/fonts/alegreya-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-weight: 700; font-display: swap; src: url("/login/fonts/alegreya-sans-latin-700-normal.woff2") format("woff2"); }

:root {
  --grey-950: #141518;
  --grey-900: #1e1f22;
  --grey-850: #24262a;
  --grey-800: #2a2c30;
  --grey-700: #3c3f45;
  --grey-600: #4b4f56;
  --grey-400: #92969d;
  --grey-300: #a5a8ad;
  --grey-100: #ececec;
  --gold-500: #e0a42e;
  --gold-300: #f0c46a;
  --gold-faint: rgba(224, 164, 46, 0.22);
  --gold-soft: rgba(224, 164, 46, 0.75);
  --on-gold: #1e1f22;
  --red-400: #ff6b4a;
  --edge: #55595f;
  --radius-md: 3px;
  --radius-lg: 4px;
  --sheen: rgba(255, 255, 255, 0.035);
  --bevel-hi: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --bevel-lo: inset 0 -1px 0 rgba(0, 0, 0, 0.28);
  --sunk: inset 0 1px 3px rgba(0, 0, 0, 0.55);
  --shadow-ctl: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-window: 0 14px 36px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.45);
  --surface-panel: linear-gradient(180deg, #2d2f34 0%, var(--grey-800) 22%, #26282c 100%);
  --surface-plate: linear-gradient(180deg, #36393f 0%, #2b2d32 100%);
  --surface-ctl: linear-gradient(180deg, #3b3e44 0%, #2f3136 100%);
  --surface-ctl-hover: linear-gradient(180deg, #474a51 0%, #383b41 100%);
  --surface-gold: linear-gradient(180deg, var(--gold-300) 0%, var(--gold-500) 58%, #cf9424 100%);
  --surface-gold-hover: linear-gradient(180deg, #f7d58a 0%, var(--gold-300) 60%, var(--gold-500) 100%);
  --px: clamp(0.9px, min(0.0625vw, 0.111112vh), 1.5px);
  --sp-2: calc(8 * var(--px));
  --sp-3: calc(12 * var(--px));
  --sp-4: calc(16 * var(--px));
  --sp-5: calc(24 * var(--px));
  --fs-board: calc(28 * var(--px));
  --fs-tab: calc(19 * var(--px));
  --fs-body: calc(17 * var(--px));
  --fs-label: calc(15 * var(--px));
  --ctl-h: max(44px, calc(48 * var(--px)));
  --rim: 4px;
  --pnl-x: var(--sp-5);
  --font-title: "Alegreya SC", Georgia, serif;
  --font-body: "Alegreya Sans", system-ui, sans-serif;
}
html, body { margin: 0; min-height: 100%; }
body { background: var(--grey-900); color: var(--grey-100); font: 14px/1.35 var(--font-body); }

.bw-menu {
  min-height: 100vh; box-sizing: border-box; margin: 0;
  padding: clamp(24px, 12vh, 120px) 16px 48px;
  background:
    radial-gradient(ellipse at 50% 35%, var(--sheen), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 0 L56 16 L56 48 L28 64 L0 48 L0 16 Z M28 64 L28 97 M0 48 L0 81 L28 97 L56 81 L56 48' fill='none' stroke='%232b2d31' stroke-width='1.2'/%3E%3C/svg%3E"),
    var(--grey-900);
}
.bw-menu * { box-sizing: border-box; }
.bw-wordmark {
  display: flex; align-items: center; justify-content: center; gap: 14px; max-width: 420px; margin: 0 auto 24px;
  font: 700 34px/1 var(--font-title); letter-spacing: 0.08em; color: var(--grey-100); text-shadow: 0 2px 0 var(--grey-950);
}
.bw-wordmark-rule {
  flex: 1; height: 7px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='7'%3E%3Cpath d='M3.5 0L7 3.5L3.5 7L0 3.5Z' fill='%23e0a42e'/%3E%3C/svg%3E") var(--at) center / 7px 7px no-repeat,
    linear-gradient(90deg, transparent, var(--grey-700) 30%, var(--grey-700) 70%, transparent) center / 100% 1px no-repeat;
}
.bw-wordmark-rule:first-child { --at: right; }
.bw-wordmark-rule:last-child { --at: left; }

/* Frame: dark outline, steel ring, gold hairline at the rim, gold corner pieces, cast shadow. */
.bw-frame {
  --corner: calc(14 * var(--px));
  position: relative; background: var(--surface-panel); border: 1px solid var(--grey-950); border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--edge), var(--shadow-window);
}
.bw-frame::before {
  content: ""; position: absolute; inset: calc(var(--rim) - 1px); border-radius: 1px; pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--gold-500) 24%, transparent);
}
.bw-frame::after {
  --g: linear-gradient(var(--gold-500), var(--gold-500));
  content: ""; position: absolute; inset: -1px; pointer-events: none; z-index: 2;
  background:
    var(--g) top left / var(--corner) 2px no-repeat, var(--g) top left / 2px var(--corner) no-repeat,
    var(--g) top right / var(--corner) 2px no-repeat, var(--g) top right / 2px var(--corner) no-repeat,
    var(--g) bottom left / var(--corner) 2px no-repeat, var(--g) bottom left / 2px var(--corner) no-repeat,
    var(--g) bottom right / var(--corner) 2px no-repeat, var(--g) bottom right / 2px var(--corner) no-repeat;
}
.bw-panel {
  display: flex; flex-direction: column; gap: var(--sp-4);
  max-width: 420px; margin: 0 auto; padding: var(--rim) var(--pnl-x) var(--sp-5);
  font: 400 var(--fs-body)/1.45 var(--font-body); color: var(--grey-100);
}
/* The title plate, flush inside the rim: a dark foot and a gold line fading out under it. */
.bw-panel > h1 {
  position: relative; margin: 0 calc(var(--rim) - var(--pnl-x)) var(--sp-2); padding: var(--sp-3) calc(var(--pnl-x) - var(--rim));
  font: 700 var(--fs-board)/1.15 var(--font-title); letter-spacing: 0.03em; text-align: left; text-shadow: 0 1px 0 var(--grey-950);
  background: var(--surface-plate); border-bottom: 1px solid var(--grey-950); box-shadow: var(--bevel-hi);
}
.bw-panel > h1::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, var(--gold-soft) 0%, var(--gold-faint) 45%, transparent 92%);
}
.bw-panel > p { margin: 0; }

/* A form or a row of ways out: one column, every control the full width. */
.bw-actions, .bw-fields { display: flex; flex-direction: column; gap: var(--sp-2); }
.bw-actions > .bw-btn-primary { margin-top: var(--sp-2); }
.bw-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--ctl-h); padding: 0 var(--sp-4);
  font: 700 var(--fs-body)/1.2 var(--font-body); white-space: nowrap; color: var(--grey-100); cursor: pointer;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  background: var(--surface-ctl); border: 1px solid var(--grey-600); border-radius: var(--radius-md);
  box-shadow: var(--bevel-hi), var(--bevel-lo), var(--shadow-ctl);
}
a.bw-btn { text-decoration: none; }
.bw-btn:hover:not(:disabled) { color: var(--gold-300); background: var(--surface-ctl-hover); border-color: var(--grey-400); }
.bw-btn:active:not(:disabled) { background: var(--grey-850); box-shadow: var(--sunk); }
.bw-btn:disabled { color: var(--grey-400); background: var(--grey-800); border-color: var(--grey-700); box-shadow: none; text-shadow: none; cursor: default; }
.bw-btn-primary:not(:disabled) {
  background: var(--surface-gold); border-color: #b9841f; color: var(--on-gold); font-size: var(--fs-tab);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), var(--bevel-lo), var(--shadow-ctl);
}
.bw-btn-primary:hover:not(:disabled) { background: var(--surface-gold-hover); border-color: var(--gold-500); color: var(--on-gold); }
.bw-btn-primary:active:not(:disabled) { background: var(--gold-500); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4); }
.bw-btn:focus-visible, .bw-link:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 3px; }
/* Quiet tier (Forgot, Back, the server's name): a word, no box. */
.bw-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); }
.bw-links > span { display: inline-flex; align-items: center; gap: var(--sp-3); }
.bw-links > .bw-links-end { margin-left: auto; }
/* A quiet word inside a form's column (the code step's Back): at the left, not stretched. */
.bw-link-start { align-self: flex-start; }
.bw-link {
  min-height: 44px; padding: 0 var(--sp-2); margin: 0 calc(-1 * var(--sp-2));
  font: 700 var(--fs-body)/1.2 var(--font-body); color: var(--grey-300); cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: var(--radius-md);
}
.bw-link:hover:not(:disabled), .bw-link[aria-pressed="true"] { color: var(--gold-300); }
.bw-link:disabled { color: var(--grey-400); cursor: default; }
/* Field: sunk, its edge gold while typing. 16px or more: no zoom on focus on a phone. */
.bw-input {
  width: 100%; min-width: 0; min-height: var(--ctl-h); padding: 0 var(--sp-3);
  background: var(--grey-950); border: 1px solid var(--grey-600); border-radius: var(--radius-md); box-shadow: var(--sunk);
  color: var(--grey-100); font: 400 max(16px, var(--fs-body))/1.2 var(--font-body);
}
.bw-input::placeholder { color: var(--grey-400); }
.bw-input:focus { border-color: var(--gold-500); outline: none; }
.bw-input:read-only { color: var(--grey-300); }
/* The picker's game that does not answer: no link, greyed, the word at the right. */
.bw-btn-off { justify-content: space-between; gap: var(--sp-3); color: var(--grey-400); background: var(--grey-800); border-color: var(--grey-700); box-shadow: none; text-shadow: none; cursor: default; }
.bw-btn.bw-btn-off:hover { color: var(--grey-400); background: var(--grey-800); border-color: var(--grey-700); }
.bw-error { color: var(--red-400); font-size: var(--fs-label); }
.bw-note { color: var(--grey-300); font-size: var(--fs-label); }
[hidden] { display: none !important; }

/* Phones: the panel fills the width, the wordmark and plate are tighter. */
@media (max-width: 560px) {
  :root { --pnl-x: 18px; --fs-board: 22px; --fs-tab: 18px; --fs-body: 16px; --fs-label: 14px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; }
  .bw-menu { padding: 20px 8px 28px; }
  .bw-wordmark { font-size: 26px; margin-bottom: 16px; }
}
@media (max-height: 500px) {
  .bw-menu { padding-top: 8px; }
  .bw-wordmark { display: none; }
}

/* The account page (/account): the facts, a strip of sections (the open one's fields show under it), a Yes / No ask. */
.bw-board { display: flex; flex-direction: column; gap: var(--sp-4); }
.bw-facts { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0; }
.bw-fact { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--sp-3); overflow-wrap: anywhere; }
.bw-fact > .bw-note:first-child { min-width: 4.5em; }
.bw-fact > .bw-link { min-height: 0; padding-top: 2px; padding-bottom: 2px; }
.bw-tabs { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.bw-tabs > .bw-btn { flex: 1 1 auto; padding: 0 var(--sp-3); }
.bw-btn[aria-expanded="true"] { color: var(--gold-300); border-color: var(--gold-500); background: var(--grey-850); box-shadow: var(--sunk); }
.bw-ask { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.bw-ask > span { flex: 1 1 auto; font-weight: 700; }
.bw-ask > .bw-btn { min-width: 72px; }
.bw-qr { align-self: center; width: 180px; height: 180px; background: #fff; border-radius: var(--radius-md); }
textarea.bw-codes { height: auto; padding: var(--sp-2) var(--sp-3); resize: none; font-family: ui-monospace, Menlo, Consolas, monospace; line-height: 1.5; }
a.bw-link { display: inline-flex; align-items: center; text-decoration: none; }

/* The admin page (/admin): wider, a section per list; each row its name, its facts, then its controls in a wrap. */
.bw-panel.bw-panel-wide { max-width: 760px; }
.bw-sec { display: flex; flex-direction: column; gap: var(--sp-2); }
.bw-sec > h2 { margin: 0; font: 700 var(--fs-tab)/1.2 var(--font-title); letter-spacing: 0.03em; color: var(--grey-100); border-bottom: 1px solid var(--grey-700); padding-bottom: 4px; }
.bw-sec > p { margin: 0; }
.bw-list { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.bw-row { display: flex; flex-direction: column; gap: 4px; padding: var(--sp-2) var(--sp-3); background: var(--grey-850); border: 1px solid var(--grey-700); border-radius: var(--radius-md); }
.bw-row[data-disabled="true"] > .bw-row-name { color: var(--grey-400); }
.bw-row-name { font-weight: 700; overflow-wrap: anywhere; }
.bw-row-facts { display: flex; flex-wrap: wrap; gap: 0 var(--sp-3); overflow-wrap: anywhere; }
.bw-row-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: 0; }
.bw-row-acts > .bw-btn-primary { margin-top: 0; }
.bw-grow { flex: 1 1 14em; width: auto; }
.bw-num { flex: 0 0 5em; width: 5em; }
