/* Dark only — committed, not theme-following. Steps are chosen against the
   #1a1a19 surface rather than inverted from a light set.
   --grid / --axis and --series-* are here for charts to be built against. */
:root {
  color-scheme: dark;

  --page: #0d0d0d;
  --surface-1: #1a1a19;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --hover: rgba(255, 255, 255, 0.06);

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;

  --up: #0ca30c;
  --down: #e66767;

  /* Sidebar rail. Width is driven by the icon size it will hold. */
  --sidebar-width: 48px;

  --accent-credits: #199e70;
  --accent-premium: #c98500;

  --mono: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* --- sidebar -------------------------------------------------------------- */
/* Fixed-width vertical rail pinned to the left edge, full viewport height, and
   sticky so it holds position while the viewport beside it scrolls. */

.sidebar {
  position: sticky;
  top: 0;
  flex: none;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, #21211f, #161615);
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.5);
}

.sidebar-items {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 8px 0;
  list-style: none;
}

.sidebar-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
}

.sidebar-button:hover {
  background: var(--hover);
  color: var(--text-primary);
}

/* Lit while its window is open, with an accent pip on the rail edge. */
.sidebar-button[aria-pressed='true'] {
  border-color: rgba(25, 158, 112, 0.5);
  background: rgba(25, 158, 112, 0.14);
  color: var(--accent-credits);
}

.sidebar-button[aria-pressed='true']::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 50%;
  width: 2px;
  height: 18px;
  border-radius: 1px;
  background: var(--accent-credits);
  transform: translateY(-50%);
}

.sidebar-button:focus-visible {
  outline: 1px solid var(--accent-credits);
  outline-offset: 1px;
}

/* --- viewport ------------------------------------------------------------- */

.viewport {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
}

/* --- windows -------------------------------------------------------------- */
/* The layer starts where the rail ends, so a window can never cover the
   sidebar or be dragged off-screen. It ignores pointer events; the windows
   inside it take them, leaving empty desktop click-through. */

.window-layer {
  position: fixed;
  inset: 0 0 0 var(--sidebar-width);
  pointer-events: none;
}

/* An author `display: flex` beats the UA stylesheet's `[hidden] {display:none}`,
   so without this rule a closed window stays on screen with hidden=true set. */
.window[hidden] {
  display: none;
}

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: var(--surface-1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}

.window-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 7px 8px 7px 12px;
  border-bottom: 1px solid var(--border);
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #24241f, #1b1b19);
  cursor: move;
  user-select: none;
  touch-action: none;
}

.window-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* The pin carries the auto margin, so pin and close travel to the right edge
   as one group instead of being split apart by two auto margins. */
.window-pin {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-inline-start: auto;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.window-pin:hover {
  background: var(--hover);
  color: var(--text-secondary);
}

.window-pin:focus-visible {
  outline: 1px solid var(--accent-credits);
  outline-offset: -1px;
}

/* Unpinned pins lie on their side; pinning stands them up. */
.window[data-pin='none'] .window-pin svg {
  transform: rotate(45deg);
}

.window[data-pin='locked'] .window-pin {
  color: var(--text-primary);
}

.window[data-pin='top'] .window-pin {
  color: var(--series-1);
}

.window[data-pin='background'] .window-pin {
  color: var(--series-4);
}

.window[data-pin='background'] .window-pin svg {
  transform: rotate(180deg);
}

/* Background-pinned windows read as scenery: they keep their contents legible
   but lose the raised edge that says "this is on top of things". */
.window[data-pin='background'] {
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.window-close {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.window-close:hover {
  background: rgba(208, 59, 59, 0.22);
  color: #ff8f8f;
}

.window-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

/* Context menu. Lives on <body>, above every window band including top-pinned
   ones, so it is never clipped or buried by the stacking it exists to change. */
.context-menu {
  position: fixed;
  z-index: 200000;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.context-menu-item::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}

.context-menu-item[aria-checked='true'] {
  color: var(--text-primary);
}

.context-menu-item[aria-checked='true']::before {
  background: var(--accent-credits);
}

.context-menu-item:hover,
.context-menu-item:focus-visible {
  background: var(--hover);
  color: var(--text-primary);
  outline: none;
}

/* Resize handles. Corners sit above edges so they win in the overlap. */

.window-resize {
  position: absolute;
  /* Absolute children anchor to the padding box, which leaves the 1px border
     ungrabbable. Nudge every handle out to cover it. */
  margin: -1px;
  touch-action: none;
}

.window-resize-n,
.window-resize-s {
  left: 0;
  right: 0;
  height: 5px;
  cursor: ns-resize;
}
.window-resize-n {
  top: 0;
}
.window-resize-s {
  bottom: 0;
}

.window-resize-e,
.window-resize-w {
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: ew-resize;
}
.window-resize-e {
  right: 0;
}
.window-resize-w {
  left: 0;
}

.window-resize-ne,
.window-resize-nw,
.window-resize-se,
.window-resize-sw {
  z-index: 1;
  width: 12px;
  height: 12px;
}
.window-resize-ne {
  top: 0;
  right: 0;
  cursor: nesw-resize;
}
.window-resize-nw {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}
.window-resize-se {
  bottom: 0;
  right: 0;
  cursor: nwse-resize;
}

/* Visible grip. Drawn on a pseudo-element and inset from the corner so it sits
   inside the window's rounded edge, while the handle itself keeps the full
   corner as its hit area. */
.window-resize-se::after {
  content: '';
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  opacity: 0.45;
  transition: opacity 0.12s ease;
}

.window-resize-se:hover::after {
  opacity: 0.95;
}
.window-resize-sw {
  bottom: 0;
  left: 0;
  cursor: nesw-resize;
}

/* --- wallet --------------------------------------------------------------- */

.wallet {
  padding: 4px 16px 16px;
}

.wallet-currencies {
  display: grid;
  /* Side by side while the window is wide enough, stacked once it isn't. */
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 16px 0;
}

.currency {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-1);
}

.currency-main {
  border-color: rgba(25, 158, 112, 0.35);
  background: linear-gradient(
    90deg,
    rgba(25, 158, 112, 0.14),
    rgba(25, 158, 112, 0.03)
  );
}

.currency-premium {
  border-color: rgba(201, 133, 0, 0.3);
  background: linear-gradient(
    90deg,
    rgba(201, 133, 0, 0.11),
    rgba(201, 133, 0, 0.02)
  );
}

.currency-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 20px;
}

.currency-main .currency-icon {
  color: var(--accent-credits);
}

.currency-premium .currency-icon {
  color: var(--accent-premium);
}

.currency-body {
  flex: 1;
  min-width: 0;
}

.currency-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.currency-help {
  margin-inline-start: auto;
  color: var(--text-muted);
  cursor: help;
}

.tag {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.currency-value {
  font-family: var(--mono);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.currency-main .currency-value {
  color: var(--accent-credits);
}

.currency-premium .currency-value {
  color: var(--accent-premium);
}

/* Tab strip — active tab is bright with an underline, the rest recede. */

/* Shared by the generic strip (src/ui/tabs.js) and the wallet's own markup. */
.tabs,
.wallet-tabs {
  display: flex;
  gap: 4px;
  /* Scrolls sideways on a narrow window. overflow-y stays hidden — the tabs'
     -1px bottom margin otherwise trips a vertical scrollbar on the strip. */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--border);
}

.tab,
.wallet-tab {
  padding: 8px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--text-muted);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover,
.wallet-tab:hover {
  color: var(--text-secondary);
  background: var(--hover);
}

.tab[aria-selected='true'],
.wallet-tab[aria-selected='true'] {
  border-bottom-color: var(--accent-credits);
  color: var(--text-primary);
  font-weight: 600;
}

.tab:focus-visible,
.wallet-tab:focus-visible {
  outline: 1px solid var(--accent-credits);
  outline-offset: -1px;
}

.tab-panel,
.wallet-panel {
  padding-top: 16px;
}

.empty-state {
  margin: 0;
  color: var(--text-muted);
}

/* --- employment ----------------------------------------------------------- */

.employment {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 16px 16px;
}

.employment-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-top: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.employment-heading {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Pushed to the right edge so the count reads as a status, not a subtitle. */
.employment-count {
  margin-inline-start: auto;
  color: var(--text-muted);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

/* No overflow of its own — .window-body already scrolls, same as the wallet
   and account windows. */
.employment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Create-a-listing button sits in the header, after the count. */
.job-create {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--hover);
  color: var(--text-primary);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.job-create:hover {
  border-color: var(--accent-credits);
}

.job-create:focus-visible {
  outline: 1px solid var(--accent-credits);
  outline-offset: 1px;
}

/* The compose form. Same card surface as a listing — what you are filling in
   is the thing that will appear below. */
/* An author `display: flex` beats the UA stylesheet's `[hidden] {display:none}`
   — the same trap as `.window[hidden]` above. Without this the form ignores
   `hidden` and sits open permanently. */
.job-form[hidden],
.job-list[hidden] {
  display: none;
}

.job-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-1);
}

/* Two columns while there is room, one once there isn't — the window resizes
   down to 340px. */
.job-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}


/* One select per level of the work tree. Wraps rather than scrolls, because the
   tree is expected to get deeper and the window narrows to 340px. */
.work-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.work-picker-level {
  display: flex;
  flex: 1 1 140px;
  min-width: 0;
}

.work-picker-path {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

.job-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.job-post {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--hover);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}

.job-post:hover:not(:disabled) {
  border-color: var(--accent-credits);
}

.job-post:disabled {
  opacity: 0.55;
  cursor: default;
}

.job-cancel {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
}

.job-cancel:hover {
  color: var(--text-primary);
  background: var(--hover);
}

/* A job card, same surface treatment as the wallet's currency cards. */

.job-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.job {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-1);
}

.job-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.job-identity {
  min-width: 0;
}

.job-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

/* Company and type of work share a line under the position name. */
.job-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0 0;
}

.job-company {
  color: var(--text-muted);
  font-size: 11px;
}

/* Pay is the number the player is scanning for, so it gets the mono treatment
   and the right edge, like every other figure in the game. */
.job-pay {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-inline-start: auto;
  white-space: nowrap;
}

.job-pay-value {
  color: var(--accent-credits);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}

.job-pay-unit {
  color: var(--text-muted);
  font-size: 10px;
}

/* The same wage in the other unit, so two listings priced differently can be
   compared without arithmetic. */
.job-pay-alt {
  margin-top: 2px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
}

.job-workers {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 10px;
}

/* The work block: the full breadcrumb, then how often it has to be done. */
.job-work {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  border-left: 2px solid var(--accent-credits);
  background: rgba(0, 0, 0, 0.25);
}

.job-work-name {
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
}

/* How often the work has to be done, beside its name. What the work involves
   is a right-click away in the wiki. */
.job-shift {
  margin-inline-start: auto;
  color: var(--text-muted);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.job-foot {
  display: flex;
  align-items: center;
  gap: 12px;
}

.job-apply {
  margin-inline-start: auto;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--hover);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}

.job-apply:hover:not(:disabled) {
  border-color: var(--accent-credits);
}

.job-apply:disabled {
  opacity: 0.55;
  cursor: default;
}

/* --- wiki ----------------------------------------------------------------- */
/* Index on the left, article on the right. Anything in the game carrying a
   `data-wiki` attribute opens this at that topic on right-click. */

.wiki {
  display: grid;
  grid-template-columns: minmax(120px, 170px) 1fr;
  gap: 16px;
  padding: 12px 16px 16px;
}

.wiki-index {
  border-right: 1px solid var(--border);
  padding-right: 12px;
}

.wiki-category {
  margin: 12px 0 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wiki-category:first-child {
  margin-top: 0;
}

.wiki-topics {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Each level indents under its parent and carries a rule down the left, so the
   depth of the work tree is readable at a glance. Nests to any depth. */
.wiki-topics-nested {
  margin-left: 7px;
  padding-left: 7px;
  border-left: 1px solid var(--border);
}

/* Deeper topics recede slightly — the kind of work stays the thing you scan
   for, the variants sit under it. */
.wiki-topics-nested .wiki-topic {
  font-size: 11px;
}

.wiki-topic {
  display: block;
  width: 100%;
  padding: 4px 6px;
  border: none;
  border-radius: 3px;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.wiki-topic:hover {
  background: var(--hover);
  color: var(--text-primary);
}

.wiki-topic[aria-current='true'] {
  background: var(--hover);
  color: var(--text-primary);
  font-weight: 600;
}

/* min-width:0 so a long word wraps instead of widening the grid column and
   pushing the index off the window. */
.wiki-article {
  min-width: 0;
}

.wiki-article-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wiki-title {
  margin: 0;
  font-size: 15px;
}

/* An entry that documents something the code does not do yet says so in the
   badge, so the wiki can never read as more finished than the game. */
.wiki-status.is-planned {
  border-color: rgba(201, 133, 0, 0.4);
  color: var(--accent-premium);
}

.wiki-status.is-live {
  border-color: rgba(25, 158, 112, 0.4);
  color: var(--accent-credits);
}

.wiki-category-line {
  margin: 2px 0 12px;
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wiki-body {
  margin: 0 0 10px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* A link to another page. Sits inline in the sentence, so it is a button that
   looks like text rather than a control — and it takes the body's own colour
   rather than a link blue. The underline is what marks it, nothing else. */
.wiki-link {
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.wiki-link:hover {
  color: var(--text-primary);
}

.wiki-link:focus-visible {
  outline: 1px solid var(--accent-credits);
  outline-offset: 2px;
}

/* Right-clickable things get a dotted underline on hover — otherwise the wiki
   is a feature nobody discovers. */
[data-wiki] {
  cursor: context-menu;
}

[data-wiki]:hover {
  text-decoration: underline dotted var(--text-muted) 1px;
  text-underline-offset: 3px;
}

/* --- dropdowns ------------------------------------------------------------ */
/* Built from elements rather than a native <select>, so each option is a real
   thing a player can right-click for its wiki page. The list is on <body> and
   positioned fixed, because .window-body scrolls and would clip it. */

.select {
  display: flex;
  min-width: 0;
}

.select-button {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--page);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.select-button:hover:not(:disabled) {
  border-color: var(--accent-credits);
}

.select-button[aria-expanded='true'] {
  border-color: var(--accent-credits);
}

.select-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.select-button:focus-visible {
  outline: 1px solid var(--accent-credits);
  outline-offset: 1px;
}

/* Above every window band, including top-pinned ones — the same reason the
   window pin's menu lives here. */
.select-list {
  position: fixed;
  z-index: 200000;
  max-height: 260px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  list-style: none;
  overflow-y: auto;
  scrollbar-width: thin;
}

.select-option {
  padding: 6px 10px;
  border-radius: 3px;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.select-option.is-active {
  background: var(--hover);
  color: var(--text-primary);
}

.select-option[aria-selected='true'] {
  color: var(--text-primary);
  font-weight: 600;
}

/* When hiring closes, beside the Apply button. */
.job-hiring {
  color: var(--text-muted);
  font-size: 11px;
}

/* --- account -------------------------------------------------------------- */

.account {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-1);
}

.account-avatar {
  flex: none;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 50%;
  object-fit: cover;
}

.account-identity-body {
  min-width: 0;
}

.account-name {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-email {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta {
  margin: 0;
  display: grid;
  gap: 8px;
}

.account-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.account-row dt {
  flex: none;
  color: var(--text-muted);
}

.account-row dd {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The Google subject is long and opaque — monospace makes it scannable and
   stops it reflowing differently from one render to the next. */
#account-sub,
#player-id {
  font-family: var(--mono);
  font-size: 12px;
}

.account-tabs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* --- account form --------------------------------------------------------- */

.account-form {
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

/* An author `display` beats the UA stylesheet's `[hidden] {display:none}` — the
   same trap as `.window[hidden]`. The hiring-ends field is shown only for a
   listing that closes, and without this it would never hide. */
.field[hidden] {
  display: none;
}

.field {
  display: grid;
  gap: 4px;
}

.field-label {
  color: var(--text-muted);
}

.field-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
}

.field-input:focus-within {
  border-color: var(--accent-credits);
}

.field-prefix {
  padding: 0 2px 0 10px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.field-input input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: none;
  background: none;
  color: var(--text-primary);
  font: inherit;
}

/* The native-<select> colour fix that used to live here went with the last
   native select — see ui/select.js for why they are all gone. */

/* The wrapper already shows focus via :focus-within — a second ring inside it
   just draws a box within a box. */
.field-input input:focus {
  outline: none;
}

.field-input-prefixed input {
  padding-left: 0;
  font-family: var(--mono);
}

.account-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-save {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--hover);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}

.account-save:hover:not(:disabled) {
  border-color: var(--accent-credits);
}

.account-save:disabled {
  opacity: 0.55;
  cursor: default;
}

.account-form-status,
.job-form-status {
  margin: 0;
  min-width: 0;
  color: var(--text-muted);
}

.account-form-status.is-error,
.job-form-status.is-error {
  color: var(--down);
}

.account-form-status.is-ok,
.job-form-status.is-ok {
  color: var(--up);
}

.account-signout {
  align-self: flex-start;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
}

.account-signout:hover {
  background: var(--hover);
  color: var(--text-primary);
}

.account-signout:focus-visible {
  outline: 1px solid var(--accent-credits);
  outline-offset: 1px;
}

/* --- sign-in gate --------------------------------------------------------- */

/* Signing in is required to play. Not "covered" — removed from the layout, so
   nothing behind the gate can be seen, tabbed to or clicked. */
body.signed-out .sidebar,
body.signed-out .window-layer {
  display: none;
}

.gate {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--page);
}

.gate[hidden] {
  display: none;
}

.gate-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(380px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-1);
}

.gate-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.gate-lead {
  margin: 0;
  color: var(--text-secondary);
  font-size: 15px;
}

.gate-note {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Google renders its own button in here and owns everything inside it. This
   only reserves the space — restyling its internals breaks their branding
   terms and re-breaks every time they ship a new build. */
.gate-button {
  min-height: 44px;
  margin-top: 4px;
}

.gate-error {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(230, 103, 103, 0.35);
  border-radius: 4px;
  background: rgba(230, 103, 103, 0.1);
  color: var(--down);
}
