/* OpenTES3 web theme: the look of Morrowind's own menus, for every page around the game.
 *
 * ONE stylesheet for the chooser (/), the door (/join), the sign-in page (/play), the game page's
 * HTML overlays (index.html) and the mods page. Pages link it and use the classes below; they do
 * not re-invent colors.
 *
 * What it is made of, and why nothing here is retail:
 *   - Colors: Morrowind's UI color values (the [Fonts] FontColor_color_* fallbacks OpenMW reads
 *     from openmw.cfg). Numbers, not assets.
 *   - Fonts: OpenMW's own "Mystic Cards" (the Morrowind-style UI face) and "Demonic Letters"
 *     (Daedric), both SIL OFL 1.1, copied from openmw/files/data/fonts with their licences.
 *   - The window frame, bevels, buttons and scrollbars are drawn in CSS to match the in-game
 *     menus. Morrowind.bsa's textures (tx_menubook*, the menu frames) are retail and copyrighted:
 *     this repo is public and these pages are served to anonymous visitors, so they never ship.
 *
 * Usage: <link rel="stylesheet" href="/ui/omw-theme.css"> and class="mw" on <body> (or on the
 * root of an overlay) to opt in. Everything is scoped under .mw so an overlay on the game page
 * cannot restyle the engine canvas or anything that has not asked for it.
 */

@font-face {
  font-family: "Mystic Cards";
  src: url("fonts/MysticCards.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Demonic Letters";
  src: url("fonts/DemonicLetters.ttf") format("truetype");
  font-display: swap;
}

:root {
  /* Text: Morrowind's FontColor_color_normal / _over / _pressed / disabled / header */
  --mw-text: #caa560;          /* 202,165,96   normal */
  --mw-text-over: #dfc99f;     /* 223,201,159  hover, headers */
  --mw-text-pressed: #f3eddd;  /* 243,237,221  pressed, selected */
  --mw-text-disabled: #b3a887; /* 179,168,135  */
  --mw-text-dim: #8c7a52;      /* secondary lines, hints */
  --mw-link: #707ecf;          /* 112,126,207  topic / link */
  --mw-link-over: #8f9be0;
  --mw-active: #6070ca;        /* 96,112,202   active item */
  --mw-good: #8fbf5a;          /* confirmations */
  --mw-bad: #d7643c;           /* errors, refusals */

  /* Bars: health / magicka / fatigue (the HUD colours) */
  --mw-health: #c83c1e;
  --mw-magicka: #35459f;
  --mw-fatigue: #00963c;

  /* Frame: the bronze bevel round every Morrowind window */
  --mw-frame-hi: #a38a5c;      /* lit edge */
  --mw-frame: #6e5a3a;         /* body of the border */
  --mw-frame-lo: #2e2416;      /* shaded edge */
  --mw-frame-outer: #0d0a06;   /* hairline outside the bevel */

  /* Fills */
  --mw-fill: rgba(12, 9, 6, 0.86);        /* window body */
  --mw-fill-solid: #0f0c08;
  --mw-fill-raised: rgba(40, 31, 19, 0.75); /* buttons, row hover */
  --mw-fill-sunken: rgba(0, 0, 0, 0.55);  /* inputs, list wells */
  --mw-select: rgba(202, 165, 96, 0.16);  /* selected row */
  --mw-parchment: #d9c9a3;                /* books, scrolls, notes */
  --mw-ink: #2b1d0e;

  --mw-font: "Mystic Cards", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --mw-font-daedric: "Demonic Letters", var(--mw-font);
  --mw-radius: 0;               /* Morrowind windows are square */
  --mw-gap: 12px;

  /* The title screen's measures (OT3-701): every page before the game puts the same masthead at
   * the same height, so moving between them changes what is under the title, not the title. */
  --mw-page-top: clamp(18px, 7vh, 76px);
  --mw-mast: clamp(42px, 10vw, 76px);
}

/* ------------------------------------------------------------------ base */

.mw {
  color: var(--mw-text);
  font-family: var(--mw-font);
  font-size: 17px;              /* Mystic Cards runs small: 17px reads like the in-game 16 */
  line-height: 1.35;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}
/* The backdrop: night over the Ashlands. A low lamp-glow behind the title, a dull ember along the
 * foot of the screen (Red Mountain, far off), black at the edges. .mw-backdrop puts the same
 * picture on any full-screen layer that is not <body> (the game page's loading screen). */
body.mw, .mw-backdrop {
  background:
    radial-gradient(ellipse 62% 44% at 50% 26%, rgba(150, 104, 48, 0.20), rgba(80, 54, 24, 0.08) 52%, transparent 76%),
    radial-gradient(ellipse 150% 60% at 50% 128%, rgba(198, 90, 46, 0.20), rgba(198, 90, 46, 0.04) 40%, transparent 64%),
    radial-gradient(ellipse 130% 100% at 50% 45%, transparent 52%, rgba(0, 0, 0, 0.9) 100%),
    #0a0805;
}
body.mw {
  margin: 0;
  min-height: 100vh;
  background-attachment: fixed;
}
.mw a { color: var(--mw-link); text-decoration: none; }
.mw a:hover, .mw a:focus-visible { color: var(--mw-link-over); text-decoration: underline; }
.mw h1, .mw h2, .mw h3, .mw .mw-header {
  color: var(--mw-text-over);
  font-family: var(--mw-font);
  font-weight: normal;
  letter-spacing: 0.04em;
  margin: 0 0 0.5em;
}
.mw h1 { font-size: 34px; }
.mw h2 { font-size: 24px; }
.mw h3 { font-size: 19px; }
.mw p { margin: 0 0 0.8em; }
.mw small, .mw .mw-dim { color: var(--mw-text-dim); }
.mw .mw-daedric { font-family: var(--mw-font-daedric); letter-spacing: 0.08em; }
.mw ::selection { background: rgba(202, 165, 96, 0.35); color: var(--mw-text-pressed); }
.mw :focus-visible { outline: 1px solid var(--mw-text-over); outline-offset: 2px; }

/* ------------------------------------------------------------------ window */
/* A Morrowind window: dark body, bronze bevel, optional title bar.
 *   <section class="mw-window"><header class="mw-window-title">Options</header> ... </section> */

.mw .mw-window, .mw-window.mw {
  position: relative;
  background: var(--mw-fill);
  border: 2px solid var(--mw-frame);
  border-top-color: var(--mw-frame-hi);
  border-left-color: var(--mw-frame-hi);
  border-right-color: var(--mw-frame-lo);
  border-bottom-color: var(--mw-frame-lo);
  outline: 1px solid var(--mw-frame-outer);
  box-shadow:
    inset 0 0 0 1px var(--mw-frame-outer),
    inset 0 0 0 2px rgba(163, 138, 92, 0.18),
    0 0 0 3px rgba(0, 0, 0, 0.45);
  padding: 14px 16px 16px;
  border-radius: var(--mw-radius);
  backdrop-filter: blur(2px);
}
.mw .mw-window-title {
  margin: -14px -16px 12px;
  padding: 6px 16px 5px;
  text-align: center;
  color: var(--mw-text-over);
  font-size: 18px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--mw-frame-lo);
  box-shadow: 0 1px 0 rgba(163, 138, 92, 0.25);
  background: linear-gradient(rgba(110, 90, 58, 0.25), rgba(110, 90, 58, 0.05));
}
/* Corner studs: the small square rivets Morrowind's frames carry. */
.mw .mw-window.mw-studs::before, .mw .mw-window.mw-studs::after {
  content: ""; position: absolute; top: -4px; width: 6px; height: 6px;
  background: var(--mw-frame-hi); box-shadow: inset -1px -1px 0 var(--mw-frame-lo);
}
.mw .mw-window.mw-studs::before { left: -4px; }
.mw .mw-window.mw-studs::after { right: -4px; }

/* A sunken well inside a window (lists, the chat log, the character list). */
.mw .mw-well {
  background: var(--mw-fill-sunken);
  border: 1px solid var(--mw-frame-lo);
  border-right-color: rgba(163, 138, 92, 0.35);
  border-bottom-color: rgba(163, 138, 92, 0.35);
  padding: 6px 8px;
}
/* The thin gold rule Morrowind uses between sections. */
.mw .mw-rule, .mw hr {
  border: 0; height: 1px; margin: 12px 0;
  background: linear-gradient(90deg, transparent, var(--mw-frame-hi) 15%, var(--mw-frame-hi) 85%, transparent);
  opacity: 0.6;
}

/* ------------------------------------------------------------------ buttons */
/* Morrowind buttons are words in a thin bevelled box: tan text, lighter on hover, pale when
 * pressed. .mw-button-primary is the one obvious next step on a screen. */

.mw .mw-button, .mw button.mw-button, .mw a.mw-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 34px; padding: 4px 16px;
  font: inherit; font-size: 17px; letter-spacing: 0.04em;
  color: var(--mw-text);
  background: var(--mw-fill-raised);
  border: 1px solid var(--mw-frame);
  border-top-color: var(--mw-frame-hi); border-left-color: var(--mw-frame-hi);
  border-right-color: var(--mw-frame-lo); border-bottom-color: var(--mw-frame-lo);
  border-radius: 0;
  cursor: pointer; text-decoration: none; user-select: none;
  transition: color 80ms linear, background-color 80ms linear;
}
.mw .mw-button:hover, .mw .mw-button:focus-visible { color: var(--mw-text-over); background: rgba(70, 55, 34, 0.8); text-decoration: none; }
.mw .mw-button:active, .mw .mw-button[aria-pressed="true"] {
  color: var(--mw-text-pressed);
  border-top-color: var(--mw-frame-lo); border-left-color: var(--mw-frame-lo);
  border-right-color: var(--mw-frame-hi); border-bottom-color: var(--mw-frame-hi);
  background: rgba(20, 15, 9, 0.9);
}
.mw .mw-button:disabled, .mw .mw-button[aria-disabled="true"] { color: var(--mw-text-disabled); opacity: 0.55; cursor: default; }
.mw .mw-button-primary { color: var(--mw-text-over); border-color: var(--mw-frame-hi); box-shadow: 0 0 0 1px var(--mw-frame-outer); }
.mw .mw-button-primary:hover { color: var(--mw-text-pressed); }
.mw .mw-button-large { min-height: 46px; padding: 8px 26px; font-size: 21px; }
/* The base rule's element-qualified selectors (.mw a.mw-button, .mw button.mw-button) outweigh a
 * single-class modifier, so on an <a> or <button> -large and -primary did nothing. Repeated at the
 * same weight (later wins); :hover/:active/:disabled above still outrank them. */
.mw a.mw-button-large, .mw button.mw-button-large { min-height: 46px; padding: 8px 26px; font-size: 21px; }
.mw a.mw-button-primary, .mw button.mw-button-primary { color: var(--mw-text-over); border-color: var(--mw-frame-hi); }
.mw a.mw-button-primary:hover, .mw button.mw-button-primary:hover { color: var(--mw-text-pressed); }
/* One height whatever the element: <button> is border-box by default, <a> and <label> were not, so
 * they came out 10px taller beside it. */
.mw .mw-button { box-sizing: border-box; }
/* Plain text "buttons" like the main menu's entries (New, Load, Options, ...). */
.mw .mw-menu { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mw .mw-menu-item {
  font: inherit; font-size: 24px; letter-spacing: 0.05em; color: var(--mw-text);
  background: none; border: 0; padding: 4px 12px; cursor: pointer; text-shadow: 0 2px 6px #000;
}
.mw .mw-menu-item:hover, .mw .mw-menu-item:focus-visible { color: var(--mw-text-over); outline: none; }
.mw .mw-menu-item:active { color: var(--mw-text-pressed); }

/* ------------------------------------------------------------------ inputs */

.mw .mw-input, .mw input.mw-input, .mw select.mw-input, .mw textarea.mw-input {
  font: inherit; font-size: 17px; color: var(--mw-text-over);
  background: var(--mw-fill-sunken);
  border: 1px solid var(--mw-frame-lo);
  border-right-color: rgba(163, 138, 92, 0.45); border-bottom-color: rgba(163, 138, 92, 0.45);
  border-radius: 0; padding: 6px 9px; min-height: 34px; box-sizing: border-box;
}
.mw .mw-input::placeholder { color: var(--mw-text-dim); opacity: 1; }
.mw .mw-input:focus { outline: none; border-color: var(--mw-frame-hi); box-shadow: 0 0 0 1px rgba(202, 165, 96, 0.3); }
.mw .mw-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.mw .mw-field > label { color: var(--mw-text-over); font-size: 16px; }
.mw .mw-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.mw .mw-check input { accent-color: var(--mw-text); }
/* Every checkbox and radio inside .mw is drawn in the frame colours: a sunken square (round for a
 * radio) with a tan tick, so no browser-white box sits in a Morrowind window. */
.mw input[type="checkbox"], .mw input[type="radio"] {
  appearance: none; -webkit-appearance: none; margin: 0 2px 0 0; flex: none;
  width: 16px; height: 16px; vertical-align: -3px; cursor: pointer;
  background: var(--mw-fill-sunken);
  border: 1px solid var(--mw-frame-lo);
  border-right-color: rgba(163, 138, 92, 0.55); border-bottom-color: rgba(163, 138, 92, 0.55);
  display: inline-grid; place-content: center;
}
.mw input[type="radio"] { border-radius: 50%; }
.mw input[type="checkbox"]::before {
  content: ""; width: 9px; height: 5px; margin-top: -3px;
  border-left: 2px solid var(--mw-text-over); border-bottom: 2px solid var(--mw-text-over);
  transform: rotate(-45deg) scale(0); transition: transform 80ms linear;
}
.mw input[type="radio"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mw-text-over); transform: scale(0); transition: transform 80ms linear; }
.mw input[type="checkbox"]:checked::before { transform: rotate(-45deg) scale(1); }
.mw input[type="radio"]:checked::before { transform: scale(1); }
.mw input[type="checkbox"]:hover, .mw input[type="radio"]:hover { border-color: var(--mw-frame-hi); }
.mw input[type="checkbox"]:disabled, .mw input[type="radio"]:disabled { opacity: 0.5; cursor: default; }

/* ------------------------------------------------------------------ lists */
/* Rows like the save list, the spell list, the inventory names. */

.mw .mw-list { list-style: none; margin: 0; padding: 0; }
.mw .mw-list > li, .mw .mw-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 8px; cursor: default; color: var(--mw-text);
  border-bottom: 1px solid rgba(46, 36, 22, 0.8);
}
.mw .mw-list > li[role="button"], .mw .mw-list > li.mw-pick, .mw .mw-row.mw-pick { cursor: pointer; }
.mw .mw-list > li:hover, .mw .mw-row:hover { color: var(--mw-text-over); background: rgba(70, 55, 34, 0.35); }
.mw .mw-list > li[aria-selected="true"], .mw .mw-row[aria-selected="true"], .mw .mw-row.mw-selected {
  color: var(--mw-text-pressed); background: var(--mw-select);
}
.mw .mw-row .mw-row-aside { margin-left: auto; color: var(--mw-text-dim); font-size: 15px; }

/* ------------------------------------------------------------------ tabs */

.mw .mw-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--mw-frame); margin-bottom: 10px; }
.mw .mw-tab {
  font: inherit; font-size: 17px; color: var(--mw-text-dim); background: rgba(20, 15, 9, 0.8);
  border: 1px solid var(--mw-frame-lo); border-bottom: 0; padding: 4px 14px; cursor: pointer;
}
.mw .mw-tab:hover { color: var(--mw-text-over); }
.mw .mw-tab[aria-selected="true"] { color: var(--mw-text-over); background: var(--mw-fill-raised); border-color: var(--mw-frame); }

/* ------------------------------------------------------------------ bars */
/* <div class="mw-bar mw-bar-health"><span style="width:62%"></span><b>45/72</b></div> */

.mw .mw-bar {
  position: relative; height: 14px; min-width: 120px;
  background: #000; border: 1px solid var(--mw-frame-lo); box-shadow: inset 0 0 0 1px #000;
}
.mw .mw-bar > span { display: block; height: 100%; background: var(--mw-text); }
.mw .mw-bar > b { position: absolute; inset: 0; font-weight: normal; font-size: 12px; line-height: 14px; text-align: center; color: var(--mw-text-pressed); text-shadow: 0 1px 2px #000; }
.mw .mw-bar-health > span { background: linear-gradient(var(--mw-health), #7a2210); }
.mw .mw-bar-magicka > span { background: linear-gradient(var(--mw-magicka), #1d2660); }
.mw .mw-bar-fatigue > span { background: linear-gradient(var(--mw-fatigue), #005522); }
.mw .mw-bar-progress > span { background: linear-gradient(var(--mw-text), #7a6236); }

/* ------------------------------------------------------------------ parchment */
/* Books, scrolls, letters: the in-game book look (light page, dark ink). For notices and
 * long-form text, not for controls. */

.mw .mw-parchment {
  color: var(--mw-ink); background: var(--mw-parchment);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(255, 250, 230, 0.5), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(120, 90, 40, 0.25), transparent 55%);
  border: 1px solid #8a6f43; box-shadow: 0 6px 30px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(120, 90, 40, 0.35);
  padding: 22px 26px;
}
.mw .mw-parchment h1, .mw .mw-parchment h2, .mw .mw-parchment h3 { color: #3a250f; }
.mw .mw-parchment a { color: #2f3f8f; }

/* ------------------------------------------------------------------ messages */
/* The message box (centered, a line of text and buttons) and the corner notifications. */

.mw .mw-msgbox { max-width: 460px; margin: 0 auto; text-align: center; }
.mw .mw-msgbox .mw-msgbox-buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mw .mw-notice {
  color: var(--mw-text-over); background: rgba(8, 6, 4, 0.8); border: 1px solid var(--mw-frame-lo);
  padding: 6px 12px; font-size: 16px; text-shadow: 0 1px 2px #000;
}
.mw .mw-notice.mw-bad, .mw .mw-error { color: var(--mw-bad); }
.mw .mw-notice.mw-good, .mw .mw-ok { color: var(--mw-good); }

/* ------------------------------------------------------------------ tooltip */

.mw .mw-tooltip {
  position: absolute; z-index: 1000; pointer-events: none; max-width: 320px;
  color: var(--mw-text); background: rgba(8, 6, 4, 0.94); border: 1px solid var(--mw-frame);
  padding: 6px 10px; font-size: 15px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
}

/* ------------------------------------------------------------------ scrollbars */

.mw, .mw * { scrollbar-color: var(--mw-frame) rgba(0, 0, 0, 0.6); scrollbar-width: thin; }
.mw ::-webkit-scrollbar { width: 12px; height: 12px; }
.mw ::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.6); border-left: 1px solid var(--mw-frame-lo); }
.mw ::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, var(--mw-frame-hi), var(--mw-frame) 40%, var(--mw-frame-lo));
  border: 1px solid var(--mw-frame-outer);
}
.mw ::-webkit-scrollbar-thumb:hover { background: linear-gradient(90deg, #c2a56e, var(--mw-frame-hi) 40%, var(--mw-frame)); }

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

.mw .mw-stack { display: flex; flex-direction: column; gap: var(--mw-gap); }
.mw .mw-row-flex { display: flex; align-items: center; gap: var(--mw-gap); flex-wrap: wrap; }
.mw .mw-center { display: grid; place-items: center; min-height: 100vh; padding: 24px; box-sizing: border-box; }
.mw .mw-spacer { flex: 1; }
.mw .mw-steps { display: flex; gap: 6px; justify-content: center; color: var(--mw-text-dim); font-size: 15px; }
.mw .mw-steps > [aria-current="step"] { color: var(--mw-text-over); }
.mw .mw-steps > .mw-done { color: var(--mw-text); }

/* The spinner Morrowind does not have: a slow-turning ring in the frame colours, for waits. */
.mw .mw-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--mw-frame-lo); border-top-color: var(--mw-text);
  animation: mw-spin 1.1s linear infinite;
}
@keyframes mw-spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ title screen (OT3-701) */
/* The masthead: a Daedric line, the name in large Mystic Cards, one line under it. Fixed line
 * heights, so its height is known (the sign-in page hangs its window frame from it, below).
 *   <header class="mw-masthead"><div class="mw-masthead-glyph" aria-hidden="true">opentes</div>
 *     <div class="mw-masthead-name">OpenTES3</div><div class="mw-masthead-tag">...</div></header>
 * Not scoped under .mw: the game page's loading screen uses it without opting its root in. */
.mw-masthead { text-align: center; margin: 0 auto 22px; font-family: var(--mw-font); }
.mw-masthead-glyph, .mw .door-wrap .door-glyph {
  margin: 0; height: 22px; overflow: hidden; white-space: nowrap;
  font-family: var(--mw-font-daedric); font-size: 17px; line-height: 22px; letter-spacing: 0.32em;
  color: var(--mw-text-dim);
}
.mw-masthead-name, .mw .door-wrap .door .door-name {
  margin: 0; height: calc(var(--mw-mast) * 1.08); white-space: nowrap;
  font-family: var(--mw-font); font-weight: normal; font-size: var(--mw-mast); line-height: 1.08;
  letter-spacing: 0.06em; color: var(--mw-text-over); text-shadow: 0 3px 10px #000;
}
.mw-masthead-tag, .mw .door-wrap .door .door-kicker {
  margin: 2px 0 0; height: 24px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 17px; line-height: 24px; letter-spacing: 0.08em; color: var(--mw-text-dim);
}

/* Ash on the wind: two sheets of specks drifting down and across, the far one slower. Drawn
 * behind the page on <body class="mw">, or inside any box given <div class="mw-ash">. Only
 * transforms move, so the compositor does it; reduced motion leaves the specks still. */
body.mw::before, body.mw::after, .mw-ash::before, .mw-ash::after {
  content: ""; position: fixed; z-index: -1; inset: -360px -720px; pointer-events: none;
  background-repeat: repeat; will-change: transform;
}
.mw-ash { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.mw-ash::before, .mw-ash::after { position: absolute; z-index: 0; }
body.mw::before, .mw-ash::before {
  background-size: 720px 360px; opacity: 0.5;
  background-image:
    radial-gradient(circle at 337px 83px, rgba(214, 190, 150, 0.33) 0 0.7px, transparent 1.5px),
    radial-gradient(circle at 554px 54px, rgba(214, 190, 150, 0.32) 0 0.7px, transparent 1.5px),
    radial-gradient(circle at 525px 115px, rgba(214, 190, 150, 0.23) 0 0.9px, transparent 1.7px),
    radial-gradient(circle at 77px 129px, rgba(214, 190, 150, 0.25) 0 0.9px, transparent 1.7px),
    radial-gradient(circle at 585px 69px, rgba(214, 190, 150, 0.49) 0 1.0px, transparent 1.8px),
    radial-gradient(circle at 602px 37px, rgba(214, 190, 150, 0.38) 0 0.9px, transparent 1.7px),
    radial-gradient(circle at 232px 29px, rgba(214, 190, 150, 0.38) 0 0.8px, transparent 1.6px),
    radial-gradient(circle at 435px 79px, rgba(214, 190, 150, 0.37) 0 1.0px, transparent 1.8px),
    radial-gradient(circle at 579px 98px, rgba(214, 190, 150, 0.25) 0 1.0px, transparent 1.8px),
    radial-gradient(circle at 198px 196px, rgba(214, 190, 150, 0.25) 0 1.1px, transparent 1.9px),
    radial-gradient(circle at 583px 36px, rgba(214, 190, 150, 0.39) 0 0.9px, transparent 1.7px),
    radial-gradient(circle at 550px 224px, rgba(214, 190, 150, 0.44) 0 0.9px, transparent 1.7px),
    radial-gradient(circle at 470px 191px, rgba(214, 190, 150, 0.3) 0 1.1px, transparent 1.9px);
  animation: mw-ash-near 44s linear infinite;
}
body.mw::after, .mw-ash::after {
  background-size: 480px 240px; opacity: 0.4;
  background-image:
    radial-gradient(circle at 363px 205px, rgba(190, 160, 120, 0.24) 0 0.6px, transparent 1.4px),
    radial-gradient(circle at 274px 132px, rgba(190, 160, 120, 0.36) 0 0.6px, transparent 1.4px),
    radial-gradient(circle at 153px 161px, rgba(190, 160, 120, 0.38) 0 0.5px, transparent 1.3px),
    radial-gradient(circle at 220px 48px, rgba(190, 160, 120, 0.34) 0 0.5px, transparent 1.3px),
    radial-gradient(circle at 256px 113px, rgba(190, 160, 120, 0.21) 0 0.6px, transparent 1.4px),
    radial-gradient(circle at 397px 148px, rgba(190, 160, 120, 0.3) 0 0.7px, transparent 1.5px),
    radial-gradient(circle at 166px 93px, rgba(190, 160, 120, 0.33) 0 0.6px, transparent 1.4px),
    radial-gradient(circle at 302px 210px, rgba(190, 160, 120, 0.28) 0 0.7px, transparent 1.5px);
  animation: mw-ash-far 96s linear infinite;
}
/* Each sheet moves by whole tiles, so the loop has no seam. */
@keyframes mw-ash-near { to { transform: translate3d(-720px, 360px, 0); } }
@keyframes mw-ash-far { to { transform: translate3d(-480px, 240px, 0); } }

/* One page becomes the next WITHOUT a cross-document view transition (@view-transition). The
 * pages share this backdrop and put the masthead at one height, and the browser holds the old
 * page's paint until the new one's first, so the name stays put and only what is under it
 * changes; each page fades its own window in (.mw-fade-in). A view transition would look much the
 * same but takes pointer input away from the page while it runs, and the release scenarios click
 * the door's buttons with a real mouse as soon as they appear. */
.mw .mw-fade-in { animation: mw-fade-in 220ms ease both; }
@keyframes mw-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* A screen-reader-only heading (the title screen has no visible "choose" line). */
.mw .mw-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ------------------------------------------------------------------ the sign-in page (OT3-701) */
/* server/web/play.html, which the gateway serves at /play. Its markup is one window holding the
 * name, the lede and the buttons; these rules lay it out as the same title screen as the chooser
 * and the door: the name lifted out above as the masthead (flex order), the window frame drawn
 * from below the masthead down (::before), and "What you need" unfolding as a paper notice.
 * They live here, not in that page, so the page's own file is not touched. */
/* body.mw: the page's own phone rule (.mw .door-wrap { padding: 16px }) comes later in the
 * cascade; the masthead must stay at the shared height there too. */
body.mw .door-wrap { place-items: start center; padding-top: var(--mw-page-top); }
.mw .door-wrap .door {
  display: flex; flex-direction: column; isolation: isolate; max-width: 480px; padding-top: 0; margin-top: -2px; /* its unseen top border */
  background: none; border-color: transparent; outline: 0; box-shadow: none; backdrop-filter: none;
}
.mw .door-wrap .door::before {
  content: ""; position: absolute; z-index: -1; width: auto; height: auto;
  left: -2px; right: -2px; bottom: -2px; top: calc(22px + var(--mw-mast) * 1.08 + 26px + 22px);
  background: var(--mw-fill);
  border: 2px solid var(--mw-frame);
  border-color: var(--mw-frame-hi) var(--mw-frame-lo) var(--mw-frame-lo) var(--mw-frame-hi);
  outline: 1px solid var(--mw-frame-outer);
  box-shadow: inset 0 0 0 1px var(--mw-frame-outer), inset 0 0 0 2px rgba(163, 138, 92, 0.18), 0 0 0 3px rgba(0, 0, 0, 0.45);
}
.mw .door-wrap .door::after { content: none; }
.mw .door-wrap .door-glyph { order: -5; }
.mw .door-wrap .door .door-name { order: -4; }
.mw .door-wrap .door .door-kicker { order: -3; margin-bottom: 22px; }
.mw .door-wrap .door > .mw-window-title { order: -2; margin-top: 0; }
.mw .door-wrap .door .door-lede { margin: 6px auto 16px; color: var(--mw-text-disabled); }
.mw .door-wrap .door-more > summary { list-style: none; letter-spacing: 0.04em; }
.mw .door-wrap .door-more > summary::before { content: "\25B8\00A0"; font-size: 13px; }
.mw .door-wrap .door-more[open] > summary::before { content: ""; }
.mw .door-wrap .door-more > summary::-webkit-details-marker { display: none; }
.mw .door-wrap .door-more[open] {
  margin: 16px -4px 4px; padding: 14px 18px 16px; color: var(--mw-ink);
  background: var(--mw-parchment);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(255, 250, 230, 0.5), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(120, 90, 40, 0.25), transparent 55%);
  border: 1px solid #8a6f43; box-shadow: inset 0 0 40px rgba(120, 90, 40, 0.35);
}
.mw .door-wrap .door-more[open] > summary { color: #3a250f; font-size: 19px; }
.mw .door-wrap .door-more[open] > summary:hover { color: #000; }
.mw .door-wrap .door-more[open] b { color: #3a250f; }
.mw .door-wrap .door-more[open] code { color: #3a250f; background: rgba(90, 60, 20, 0.14); }
.mw .door-wrap .door-more[open] details > summary { color: #2f3f8f; }
@media (prefers-reduced-motion: reduce) {
  .mw *, .mw *::before, .mw *::after { animation-duration: 0.01ms !important; transition: none !important; }
  body.mw::before, body.mw::after, .mw-ash::before, .mw-ash::after { animation: none; }
}
@media (max-width: 560px) {
  .mw { font-size: 16px; }
  .mw h1 { font-size: 28px; }
  .mw .mw-window { padding: 12px; }
  .mw .mw-window-title { margin: -12px -12px 10px; }
}
