/* =============================================================================
   The shell rail — styles/rail.css

   ONE stylesheet, loaded by TWO surfaces that agree on nothing else:

     • the site (styles/global.css)  — 7k lines built around a black page, the
       Darker Grotesque display face and a responsive root-font ladder;
     • the chat (styles/chat.css)    — a light/dark chat client with its own
       reset and its own tokens.

   Three consequences, all of them load-bearing:

   1. EVERY class is `rail-*`. global.css already owns `.sidebar` (the listing
      pages' filters sidebar) and keeps growing; a namespace is what stops the
      two from colliding by accident later.

   2. Sizes are in PIXELS, not rem — the one place in this codebase that is
      right. `rem` resolves against the DOCUMENT root, and the two hosts set
      that root differently: global.css steps it 16 → 14 → 13 → 12px down the
      breakpoints and even hands the statistics/company pages a `3.6vw` root.
      The same rail would render at a different size on every page. Pixels make
      it identical everywhere, and `.rail`'s own font-size anchors its text.

   3. It assumes NOTHING from the host sheet and re-states what it needs. In
      particular global.css sets `svg { width: 72rem }`, `a { color: white }`
      and `body { line-height: 1 }`, none of which may reach in here.

   `<html class="has-rail">` marks a SITE page. It decides two things: where the
   rail sits (fixed beside the page, with the page padded to clear it — versus a
   flex child of the chat's app grid), and that the rail is always DARK there,
   because the site has no light theme to follow. Collapsed state is
   `<html class="rail-collapsed">`, set before first paint so the page never
   reflows; `<body>` deliberately carries neither, because the prebuilder's
   detail-page stamping matches a literal `<body>`.
   ============================================================================= */

/* The one measurement the PAGE needs too (it pads itself by exactly this), so
   it lives on the root rather than on the rail element. */
:root { --rail-w: 260px; }

.rail {
  /* Dark is the default: it is the site's only look, and the chat's most
     common one. The light overrides below are opt-in, and only the chat opts
     in — see the `has-rail` note above. */
  /* Black, matching the page background on BOTH surfaces — the site's, and the
     chat's dark theme, which is black for the same reason (chat.css --bg). The
     rail reads as part of the page rather than a panel laid on top of it, so
     the line on its left edge is the ONLY thing separating the two — which is
     why it is the brand orange rather than a white hairline (see below). */
  --rail-bg: #000000;
  --rail-elevated: #2f2f2f;
  /* PURE white, not the #ececec this used to be (2026-08-19). Every label the
     rail draws is a destination, and they were reading as a column of greys —
     the near-white primary, the --muted items one step down from it, and the
     job categories a step below that. --rail-text-2 stays where it is: it is
     the ICONS and the account's second line now, not the words. */
  --rail-text: #ffffff;
  --rail-text-2: #b4b4b4;
  --rail-text-3: #8f8f8f;
  --rail-hover: rgba(255, 255, 255, 0.06);
  --rail-active: rgba(255, 255, 255, 0.1);
  --rail-border: rgba(255, 255, 255, 0.12);
  --rail-border-strong: rgba(255, 255, 255, 0.2);
  --rail-accent: #ffffff;
  --rail-accent-fg: #0d0d0d;
  --rail-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --rail-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  /* Ranked's orange, and the rail's accent as of 2026-08-19: the edge (below),
     the "TOKYO" tag beside the wordmark, the "Browse" / "You" section labels,
     and the account avatar. Same number as global.css --brand-fill and
     chat.css --brand, so the orange the rail puts on the page is the site's
     and not a fourth one. Everything else here stays greyscale — these four
     are the rail's own furniture, and none of them is a destination. */
  --rail-brand: #ff8000;
  /* amber reads as "worth finishing"; red as "something is wrong" */
  --rail-warn: #f5a524;
  --rail-danger: #e5484d;
  --rail-radius: 8px;
  --rail-pill: 999px;

  /* The anchor for everything inside: one fixed type size, so neither host's
     root-font ladder can rescale the rail. */
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
               "Helvetica Neue", Arial, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: normal;
  color: var(--rail-text);
  background: var(--rail-bg);

  display: flex;
  flex-direction: column;
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  /* The rail's edge, on EVERY surface and in every theme — the site, the chat
     light and dark, docked and as a phone drawer. It lives here rather than in
     the has-rail block (where the site's white hairline used to be) for exactly
     that reason: one declaration, no surface without it.
     It costs the page no width: box-sizing is border-box above, so --rail-w is
     the BORDER box — the line comes out of the rail's own inside rather than
     being added to the column the page pads itself to clear. */
  border-left: 1px solid var(--rail-brand);
  /* The rail sits at the RIGHT edge of both surfaces. In the chat it is a flex
     child of .chat-app and comes FIRST in the DOM (pages/Rail.jsx renders it
     before <main>, which is the right reading order for a nav), so `order`
     is what puts it after the thread. On a site page it is position:fixed and
     this is inert — see the has-rail block. */
  order: 1;
  /* Both collapse levers animate — which one is used depends on the surface,
     see the desktop block at the bottom of this file. */
  transition: margin-right 0.2s ease, transform 0.2s ease;
  /* Chat stacking: its dropdown menus sit at 60 and must stay above the rail.
     The site raises this — see the `has-rail` block. */
  z-index: 30;
}

/* --------------------------------------------------------- defensive reset */
/* Only ever inside the rail. The hosts reset different things to different
   values; these are the ones the rail's markup actually depends on.

   EVERY selector here is wrapped in :where(), which contributes ZERO
   specificity — and that is the whole point. Written the obvious way,
   `.rail nav { padding: 0 }` is (0,1,1) and beats `.rail-nav { padding: 0 8px 8px }`
   at (0,1,0), so the reset silently strips the padding off its own component:
   the nav, the head, the foot, the section labels, the brand tag, the account
   row. A reset must lose every argument it has with a component rule. */
.rail, .rail *, .rail-scrim { box-sizing: border-box; }

:where(.rail p, .rail span, .rail nav, .rail div, .rail ul, .rail li) {
  margin: 0;
  padding: 0;
}

:where(.rail a) {
  color: inherit;
  text-decoration: none;
}

:where(.rail button) {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

:where(.rail img) { display: block; max-width: 100%; }

/* global.css sets `svg { width: 72rem }` for the About page's circuit artwork.
   Without this the rail's icons render as full-page graphics. */
.rail svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: none;
}

.rail [hidden] { display: none; }

/* React needs a host element to inject the icon SVG strings into. */
.rail-icon { display: flex; flex: none; color: var(--rail-text-2); }

/* --------------------------------------------------------------- light mode */
/* The CHAT follows the visitor's theme; the site never does (it is a black
   page, and a light rail on it would be a bug, not a preference). */
@media (prefers-color-scheme: light) {
  html:not(.has-rail):not([data-theme="dark"]) .rail {
    --rail-bg: #f9f9f9;
    --rail-elevated: #ffffff;
    --rail-text: #0d0d0d;
    --rail-text-2: #5d5d5d;
    --rail-text-3: #8f8f8f;
    --rail-hover: rgba(13, 13, 13, 0.05);
    --rail-active: rgba(13, 13, 13, 0.08);
    --rail-border: rgba(13, 13, 13, 0.1);
    --rail-border-strong: rgba(13, 13, 13, 0.16);
    --rail-accent: #0d0d0d;
    --rail-accent-fg: #ffffff;
    --rail-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
    --rail-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  }
  html:not(.has-rail):not([data-theme="dark"]) .rail-logo {
    filter: invert(1) hue-rotate(180deg);
  }
}
html:not(.has-rail)[data-theme="light"] .rail {
  --rail-bg: #f9f9f9;
  --rail-elevated: #ffffff;
  --rail-text: #0d0d0d;
  --rail-text-2: #5d5d5d;
  --rail-text-3: #8f8f8f;
  --rail-hover: rgba(13, 13, 13, 0.05);
  --rail-active: rgba(13, 13, 13, 0.08);
  --rail-border: rgba(13, 13, 13, 0.1);
  --rail-border-strong: rgba(13, 13, 13, 0.16);
  --rail-accent: #0d0d0d;
  --rail-accent-fg: #ffffff;
  --rail-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
  --rail-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
}
/* The wordmark is white artwork on transparent — right on the dark rail, all
   but invisible on the light one. invert() flips its lightness and hue-rotate
   puts the dot's colour back, so the light theme gets a dark wordmark with its
   accent intact rather than a silhouette (plain invert leaves a cyan dot). */
html:not(.has-rail)[data-theme="light"] .rail-logo { filter: invert(1) hue-rotate(180deg); }

/* ------------------------------------------------------------------- head */
.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 10px 12px;
  flex: none;
}

.rail-brand {
  display: flex;
  align-items: flex-end;
  flex: 1;
  gap: 0;
  min-width: 0;
  padding: 0 4px;
  border-radius: var(--rail-radius);
}

.rail-logo { width: 112px; height: auto; flex: none; }

/* The wordmark's qualifier ("Tokyo"). No pill around it: it reads as part of
   the lockup beside the logo, and a bordered chip there looked like a control —
   something to click, next to something that is. The letterspaced caps carry it
   on their own.
   TYPE: the rail's own quiet-label style, the one .rail-section-label ("Browse",
   "You") also uses — 12px/600, and in the brand orange with them since
   2026-08-19 — so this is a member of the type scale rather than the one 10px
   thing in the rail. Uppercase and tracked is the difference, and it is the
   part that keeps it reading as a mark beside the wordmark rather than as
   another nav label.
   Bottom-align the compact text line with the wordmark image so the location
   shares its lower edge instead of floating at its vertical centre. */
.rail-tag {
  flex: 1;
  text-align: center;
  padding: 0;
  transform: translateY(-2px);
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rail-brand);
  white-space: nowrap;
}
/* Employer navigation uses system UI fonts, not the display face for which
   the document's Japanese optical adjustment was calibrated. */
html[lang="ja"] .rail[data-surface="employer"] { font-size-adjust: none; }

.rail-icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--rail-radius);
  color: var(--rail-text-2);
  transition: background 0.12s ease, color 0.12s ease;
}
.rail-icon-btn:hover { background: var(--rail-hover); color: var(--rail-text); }

/* -------------------------------------------------------------------- nav */
.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 8px 8px;
  /* On a short phone (or with the keyboard up) the rail is taller than the
     screen. Without this the nav is squashed by the flex layout and its last
     items are clipped rather than reachable. */
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--rail-radius);
  font-size: 14px;
  color: var(--rail-text);
  text-align: left;
  transition: background 0.12s ease;
}
.rail-item:hover { background: var(--rail-hover); }
.rail-item .rail-icon { flex: none; color: var(--rail-text-2); }
/* There was a `.rail-item--muted` here, dimming every item that sits under a
   section heading — which, since the rail grew its "Browse" and "You" labels,
   is nearly all of them. Removed 2026-08-19 with the switch to pure white: the
   labels themselves carry the grouping now, and the modifier only made the
   rail's actual destinations the quietest text on it. */
.rail-item.is-active { background: var(--rail-active); color: var(--rail-text); }
.rail-item.is-active .rail-icon { color: var(--rail-text); }
.rail-item-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- a nested group: "Jobs" over the six category listings ---------------
   A native <details>, so it opens with JavaScript off and takes the keyboard
   for free. The summary wears .rail-item, so it has to lose the disclosure
   triangle browsers put in front of one — the caret on the right is the
   affordance instead. */
.rail-group > summary { cursor: pointer; list-style: none; }
.rail-group > summary::-webkit-details-marker { display: none; }
.rail-caret {
  display: flex;
  margin-left: auto;
  color: var(--rail-text-3);
  transition: transform 0.15s ease;
}
.rail-group[open] > summary .rail-caret { transform: rotate(180deg); }

/* ── A ROW THAT IS THERE AND CANNOT BE ENTERED ─────────────────────────────
   The employer rail, signed out: Your company, Your jobs and Applicants keep
   their places and lose their affordances (functions/employer/rail.js
   setRowDisabled). Nothing on the candidate rail sets this class, so
   data/railNav.js and all ~10,700 built pages are untouched.

   Quiet rather than crossed out: --rail-text-3 is the rail's own colour for
   text that is present and not a destination, and it reads as unavailable in
   both the dark rail and its light theme without either needing its own rule.
   No opacity — a dimmed ICON beside dimmed text says it twice. */
.rail-group.is-disabled > summary,
.rail-item.is-disabled {
  color: var(--rail-text-3);
  cursor: default;
  pointer-events: none;
}
.rail-group.is-disabled > summary .rail-icon,
.rail-group.is-disabled > summary .rail-caret,
.rail-item.is-disabled .rail-icon { color: var(--rail-text-3); }
/* The hover is unreachable through the pointer already; this is for the state
   the class can be applied IN — the pointer resting on a row that has just
   become unavailable, which leaves the background behind. */
.rail-group.is-disabled > summary:hover,
.rail-item.is-disabled:hover { background: transparent; }
/* Indented past the parent's icon so the children hang off its LABEL — the
   line they belong to — rather than off the edge of the rail. */
.rail-sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0 4px 30px;
}
.rail-subitem {
  padding: 6px 10px;
  border-radius: var(--rail-radius);
  font-size: 13px;
  /* White like the items above them: 13px and the 30px indent are what say
     these are nested, not a dimmer grey. */
  color: var(--rail-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.12s ease;
}
/* A personal shortcut is separate from the job-category choices below it. */
.rail-subitem--shortcut {
  display: flex;
  align-items: center;
  gap: 7px;
  position: relative;
  overflow: visible;
  margin-bottom: 9px;
}
.rail-subitem--shortcut > .rail-icon { flex: none; color: var(--rail-text-3); }
.rail-subitem--shortcut::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.rail-subitem:hover { background: var(--rail-hover); }
.rail-subitem.is-active { background: var(--rail-active); }

/* ⚠️ A ROW THAT IS A <button>, not a link — the Your jobs drawer's "New job",
   which has nowhere to lead until the draft it creates exists
   (functions/employer/rail.js newJobRow). A <button> arrives with a UA font, a
   UA background, a border and centred text, none of which .rail-subitem
   overrides because every other row is an <a>. So this states the four things
   that differ and nothing else: the row must be indistinguishable from its
   siblings or it reads as a control that wandered in.
   `width: 100%` + `text-align: left` because a button shrink-wraps and centres
   where a block-level anchor fills and starts at the edge. */
button.rail-subitem {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 13px;
  background: none;
  border: 0;
  cursor: pointer;
}
/* Dimmer than a job, because it is not one — it is the way to make one. */
.rail-subitem--action { color: var(--rail-muted, #9a9a9a); }
.rail-subitem--action:hover { color: var(--rail-text); }
button.rail-subitem[disabled] { cursor: default; opacity: 0.6; }

/* A JOB row carries its state as a dot. Only this modifier becomes a flex line
   — `.rail-subitem` is shared with the site's own rail (the job categories
   under Browse), and turning every one of them into a flex container to serve
   one surface is how a shared sheet starts drifting.
   The ellipsis moves onto the LABEL with it: `text-overflow` acts on the box
   the text is in, and once the row is a flex line that box is the span. */
.rail-subitem--job {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rail-subitem-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ⚠️ NOT `.rail-dot` — THAT NAME IS TAKEN, by the candidate rail's completion
   NUDGE (further down this file): amber, `margin-left: auto`, and it means
   "this page wants your attention". Declared first, mine lost the background to
   it on source order and every job dot came out amber — including the published
   ones, whose own accessible label said "Published" beside it. Two different
   facts cannot share a class in a sheet two surfaces load. */
.rail-job-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  /* PX like everything else in this sheet — see the note at the top: `rem`
     resolves against a document root that is not the same on the two hosts
     this rail is served on. */
}
/* The same two colours the page editor's chip wears (styles/chat.css --ok /
   --warn), stated rather than referenced: this sheet is also loaded on
   ranked.jp, where chat.css is not, and a token that resolves on one host and
   not the other is a dot that is sometimes invisible. */
.rail-job-dot--live { background: #30a46c; }
.rail-job-dot--draft { background: #f5a524; }
/* Expired is neither published nor waiting to be — an outline rather than a
   third colour, so it reads as "no longer" instead of as a status of its own. */
.rail-job-dot--expired {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.45);
}

/* "Browse", "You" — the rail's own quiet labels, in the brand orange since
   2026-08-19. They and the edge (see --rail-brand at the top) are the only
   orange on this surface besides the avatar, and that is deliberate: they name
   the rail's two halves and nothing else in a nav column should compete with a
   real destination for attention. */
.rail-section-label {
  padding: 12px 12px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--rail-brand);
}

/* "Liked jobs (51)" — filled by the runtime, empty in the built HTML. */
.rail-count { color: var(--rail-text-3); font-variant-numeric: tabular-nums; }

/* profile-completion dot: this page has something unfinished on it */
.rail-dot {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: var(--rail-pill);
  background: var(--rail-warn);
  flex: none;
}
/* an unsaved edit is a stronger signal than "you could finish this" */
.rail-dot--urgent { background: var(--rail-danger); }
/* On a DISCLOSURE the caret owns the row end, so a VISIBLE dot takes the auto
   margin that pushes the pair right and the caret gives its own up. A hidden
   dot is still an adjacent DOM sibling, so exclude it or the caret loses its
   normal auto margin and sits beside the label. */
.rail-dot--summary:not([hidden]) + .rail-caret { margin-left: 0; }

/* pushes the account row to the bottom */
.rail-spacer { flex: 1 1 auto; min-height: 8px; }

/* ------------------------------------------------------------------- foot */
.rail-foot {
  flex: none;
  padding: 8px;
  /* viewport-fit=cover puts the home indicator ON the content. */
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rail-border);
}

/* ⚠️ THE RAIL'S WAY OUT — the one link on a rail that leaves the host it is on
   (pages/Rail.jsx, `railExit` in data/railNav.js and data/employerRailNav.js).
   BOTH rails emit it since 2026-09-15 and they point at each other: the site's
   says "For employers", the employer's says "Go to ranked.jp". It was the
   employer rail's alone for a fortnight, which is why these rules were written
   as that surface's — they are shared chrome now, and the only thing that
   differs between the two is the mark and the words.

   QUIETER THAN A NAV ROW on purpose. It is not one of the workspace's pages and
   should not read as one — no icon, no 15px row, no active state. Two lines at
   the foot's own 12px, the first carrying the destination and the second what is
   at it, lifting to the rail's normal text on hover so it still reads as
   pressable. */
/* ⚠️ CHROME, NOT A CALL TO ACTION. It arrived as a padded box with a hover
   fill, then as a two-line card, then as a bold orange line — each of which
   made the one thing in the rail's empty lower half the loudest thing in the
   column, for a link almost nobody presses. It is furniture now: the foot's own
   12px, the muted grey the account row's second line wears, one globe, one
   label. It lifts a step and underlines on hover, which is the whole of what
   says it can be followed.
   ⚠️ NOT ORANGE. --rail-brand is the colour this column uses for its own voice
   — the section labels and the edge — and spending it on a destination made the
   rail's headings and its way out read as the same kind of thing.
   Aligned to the nav's own 12px gutter, and ABOVE .rail-foot so that element's
   border-top is not drawn over it (see pages/Rail.jsx). */
.rail-exit {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  /* ⚠️ THE TOP PADDING IS NOT SYMMETRY, it is the only separation this line
     gets on a FULL rail. `.rail-spacer` above it is `flex: 1 1 auto` with an
     8px floor, so on the employer rail — eight items in a tall column — it
     holds this well clear of the nav on its own. The site rail has seventeen
     rows and the spacer collapses to its floor, which put "For employers"
     one row-gap under "Settings" and made the foot's quietest line read as a
     cramped eighteenth nav item. */
  padding: 10px 12px;
  font-size: 12px;
  /* Semibold rather than plain: quiet is about COLOUR here, and at 12px in the
     rail's muted grey a normal weight disappears into the panel. */
  font-weight: 600;
  line-height: 1.35;
  color: var(--rail-text-3);
  transition: color 0.12s ease;
}
/* The mark takes the line's colour and its own box, so the label is what
   wraps if the rail is narrowed rather than the pair breaking apart. */
.rail-exit .rail-icon { flex: none; color: inherit; }
.rail-exit-title { min-width: 0; }
.rail-exit:hover { color: var(--rail-text-2); }
.rail-exit:hover .rail-exit-title { text-decoration: underline; }

.rail-lang {
  display: flex;
  gap: 2px;
  padding: 3px;
  margin: 0 2px 6px;
  background: var(--rail-hover);
  border-radius: var(--rail-pill);
}
.rail-lang-option {
  flex: 1 1 0;
  padding: 5px 8px;
  border-radius: var(--rail-pill);
  font-size: 12px;
  text-align: center;
  color: var(--rail-text-2);
  transition: background 0.12s ease, color 0.12s ease;
}
.rail-lang-option:hover { color: var(--rail-text); }
.rail-lang-option.is-on {
  background: var(--rail-elevated);
  color: var(--rail-text);
  box-shadow: var(--rail-shadow-sm);
}

/* The footer's three states, driven by <html data-session>.
   The DEFAULT — no attribute at all, which is what a visitor with JavaScript
   disabled or a blocked localStorage gets — is the signed-out pair. It is what
   someone without a session needs, and the only honest answer when the session
   cannot be read. Never leave all three showing at once.

   "pending" is RARE now: the pre-paint bootstrap trusts both stored answers, so
   only a browser that has never resolved a session at all lands here, and the
   account row arrives filled from what was remembered (functions/railSession.js)
   rather than replacing a skeleton a round-trip later. */
.rail-skeleton,
.rail-account { display: none; }

html[data-session="pending"] .rail-auth,
html[data-session="in"] .rail-auth { display: none; }

html[data-session="in"] .rail-account { display: flex; }

html[data-session="pending"] .rail-skeleton {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}
.rail-skeleton-avatar,
.rail-skeleton-line {
  background: var(--rail-hover);
  border-radius: var(--rail-pill);
  animation: rail-skeleton 1.2s ease-in-out infinite;
}
.rail-skeleton-avatar { width: 28px; height: 28px; flex: none; }
.rail-skeleton-lines { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; }
.rail-skeleton-line { height: 8px; }
.rail-skeleton-line--short { width: 45%; }
@keyframes rail-skeleton { 50% { opacity: 0.45; } }

.rail-auth { display: flex; gap: 6px; padding: 0 2px 6px; }
.rail-auth-btn {
  flex: 1 1 0;
  padding: 7px 8px;
  border: 1px solid var(--rail-border);
  border-radius: var(--rail-pill);
  font-size: 13px;
  text-align: center;
  color: var(--rail-text);
  transition: background 0.12s ease, opacity 0.12s ease;
}
.rail-auth-btn:hover { background: var(--rail-hover); }
.rail-auth-btn--primary {
  background: var(--rail-accent);
  color: var(--rail-accent-fg);
  border-color: transparent;
}
.rail-auth-btn--primary:hover { background: var(--rail-accent); opacity: 0.85; }

.rail-account {
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--rail-radius);
  font-size: 14px;
}
.rail-account:hover { background: var(--rail-hover); }
/* An email is routinely wider than the rail. Clamp it to one ellipsised line
   rather than let it push out; the full address is the button's title. A flex
   child only shrinks below its content with min-width:0 at every level. */
.rail-account-text { flex: 1 1 auto; min-width: 0; }
.rail-account-name,
.rail-account-sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-account-sub { font-size: 12px; color: var(--rail-text-3); }

.rail-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--rail-pill);
  background: var(--rail-brand);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}
/* The person's uploaded picture, over the initial. Sized here in full: global.css
   gives every img a max-width and the rail must not inherit its box. */
.rail-avatar .rail-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  border-radius: inherit;
}

/* ------------------------------------------------------------------ scrim */
.rail-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 25;
}

/* =============================================================== SITE pages */
/* Everything below applies only where <html class="has-rail"> — i.e. on a
   server-rendered page of ranked.jp, never inside the chat shell. */

html.has-rail .rail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  /* Above the page (whose own layers stop at ~100). */
  z-index: 500;
}
html.has-rail .rail-scrim { z-index: 499; }

/* The page clears the rail. Padding on <body> rather than a wrapper element
   because every page type here has a different root element (.Page, .parallax,
   the statistics shell) and none of them may be restructured. */
@media (min-width: 62.0625em) {
  /* Collapsing is the same gesture on both surfaces but NOT the same lever,
     because the rail is a different kind of box on each.
       • The chat's rail is a flex child, so a negative margin pulls it out of
         the row and the thread widens into the space. It is the END of the row
         now, so the margin is on the trailing side.
       • The site's is position:fixed, where a negative margin is swallowed by
         the positioned box's used-value equation and does nothing at all — it
         slides out on a transform instead, the same lever the mobile drawer
         uses. The page reclaims the space through its own padding below. */
  html.rail-collapsed:not(.has-rail) .rail { margin-right: calc(var(--rail-w) * -1); }
  html.has-rail.rail-collapsed .rail { transform: translateX(100%); }
  html.has-rail body { padding-right: var(--rail-w); }
  html.has-rail.rail-collapsed body { padding-right: 0; }
}

/* Every page renders a static burger (pages/Rail.jsx RailToggleButton, styled
   .header-rail-btn in global.css) — in its header where there is one, pinned
   top-right where there is not — so the control is in the same corner on every
   page rather than in a corner of its own. */

/* ============================================================== responsive */
/* Below this width the rail is an overlay drawer on BOTH surfaces: it covers
   the page instead of taking a column from it, and the scrim dismisses it. */
@media (max-width: 62em) {
  .rail {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    margin-right: 0;
    /* Never take the whole screen on a 320px phone — leaving some content
       visible (and tappable, through the scrim) is what shows the drawer is
       temporary. */
    width: min(var(--rail-w), 82vw);
    flex-basis: min(var(--rail-w), 82vw);
    padding-right: env(safe-area-inset-right);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    box-shadow: var(--rail-shadow);
  }
  html:not(.rail-collapsed) .rail { transform: translateX(0); }
  html:not(.rail-collapsed) .rail-scrim { display: block; }

  /* Touch targets: 34px rows are fine for a cursor, not for a thumb. */
  .rail-item { padding: 11px 10px; }
  .rail-subitem { padding: 9px 10px; }
  .rail-icon-btn { width: 44px; height: 44px; }
  .rail-auth-btn { padding: 10px 8px; }
  .rail-lang-option { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .rail, .rail * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Owner-only navigation hint; the tracker API independently authorizes access. */
.rail-tracker-link { display: block; padding: 10px 12px; font: 13px/1.4 Arial, sans-serif; color: #c1d6af; }
.rail-tracker-link[hidden] { display: none !important; }
