/* skin-nocturne.css: "Nocturne" — the PS1 skin's full-screen menu (html[data-skin="ps1"] #actionSidebar.ui-menu, not the hand drawer).
   Loaded last and unlayered. The palette / semantic tokens below are set on the whole PS1 skin (:root), so the notebook paper never shows
   (settings, flows, pop-ups, card hand, portrait chassis margins); the layout rules further down stay scoped to the menu.
   Art direction: obsidian ground, hairline ivory linework, Mincho headings, a single warm lantern accent.
   Geometry still comes from tokens.css / layout.css / components.css. The GB skin (html[data-skin="gb"]) is untouched. */

:root[data-skin="ps1"],   /* 2026-10-18: the whole PS1 skin now wears Nocturne; the notebook paper tokens no longer reach any surface */
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]),
:root[data-skin="ps1"] body > :is(#tapInspectPanel, .ui-record-popup) {   /* the inspector and record windows share the menu's tokens (item-card.css) */
  color-scheme: dark;

  /* ---- palette ---- */
  --nx-ground: #0e1015;          /* page / screen ground */
  --nx-ground-2: #14171d;        /* raised ground */
  --nx-glass: rgb(20 23 30 / 0.78);      /* panels laid over the field */
  --nx-glass-2: rgb(28 32 41 / 0.86);    /* cards inside panels */
  --nx-ivory: #ece6da;           /* primary text and strong lines */
  --nx-ivory-2: #b9b3a7;         /* secondary text (7:1 on ground) */
  --nx-ivory-3: #8d887f;         /* captions, idle meta (4.6:1 on ground) */
  --nx-line: rgb(236 230 218 / 0.20);    /* hairline */
  --nx-line-2: rgb(236 230 218 / 0.38);  /* stronger hairline (frames of focus targets) */
  --nx-line-3: rgb(236 230 218 / 0.72);  /* selected frame */
  --nx-lantern: #e9b872;         /* the one warm accent: focus, selection, value fills of note */
  --nx-lantern-soft: rgb(233 184 114 / 0.16);
  --nx-lantern-glow: 0 0 0 1px rgb(233 184 114 / 0.55), 0 0 18px rgb(233 184 114 / 0.22);
  --nx-mp: #8fb3e8;              /* MP / the dream */
  --nx-hp: #ece6da;              /* HP fill is ivory, like the reference bars */
  --nx-danger: #e0796a;
  --nx-ok: #9fcf9a;
  --nx-shadow: 0 24px 60px -24px rgb(0 0 0 / 0.75), 0 2px 8px rgb(0 0 0 / 0.35);
  --nx-blur: blur(14px) saturate(1.1);
  --nx-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  --nx-backdrop: radial-gradient(ellipse 70% 60% at 6% 100%, rgb(233 184 114 / 0.16), transparent 62%),
                 radial-gradient(ellipse 90% 70% at 70% 0%, rgb(120 140 190 / 0.07), transparent 70%),
                 linear-gradient(180deg, #12151b 0%, #0c0e12 100%);
  --nx-radius: 2px;
  --nx-radius-pill: 999px;

  /* ---- type ---- */
  --ff-mincho: "SW Mincho", "SW JP", serif;     /* titles, headings, names */
  --ff-type: "SW Latin", "SW JP", sans-serif;   /* records and keys read as clean UI, not typewriter */
  --ff-latin: "SW Mincho", "SW JP", serif;      /* EN sub-labels in the serif, like the reference */
  --ff-ui: "SW Latin", "SW JP", sans-serif;     /* reading text */
  --ff-num: "SW Latin", "SW JP", sans-serif;
  --ls-caps: 0.18em;

  /* ---- semantic colours (UI_STYLE_GUIDE 4.1 names) ---- */
  --c-ground: var(--nx-ground); --c-surface: var(--nx-glass); --c-surface-2: var(--nx-glass-2); --c-plate: var(--nx-ground-2);
  --c-ink-1: var(--nx-ivory); --c-ink-2: var(--nx-ivory-2); --c-ink-3: var(--nx-ivory-3);
  --c-line: var(--nx-line-2); --c-line-strong: var(--nx-line-3); --c-line-soft: var(--nx-line);
  --c-focus-bg: var(--nx-lantern-soft); --c-focus-fg: var(--nx-ivory); --c-disabled-fg: var(--nx-ivory-3);
  --c-map-matte: #07080b; --c-danger: var(--nx-danger); --c-scrim: rgb(5 6 9 / 0.66);

  /* symbols: one colour per meaning, lifted for a dark ground (all >= 4.5:1 on --nx-ground) */
  --sym-physical: #c9c3b6; --sym-fire: #f08a6c; --sym-cold: #7fd0e6; --sym-lightning: #f0d36a; --sym-water: #7fa9f0;
  --sym-poison: #a6d77a; --sym-arcane: #c6a4f2; --sym-oil: #d9a960; --sym-wet: #7fa9f0; --sym-ice: #7fd0e6;
  --sym-metal: #aab7c4; --sym-steam: #a9bccb; --sym-grass: #9fd08a; --sym-blood: #ef8aa6; --sym-spores: #cfd27a;
  --sym-rooted: #9fd08a; --sym-weakened: #e7c46a; --sym-confused: #ea9be0; --sym-danger: var(--nx-danger);
  --sym-mud: #d9a960; --sym-ash: #b9b3a7; --sym-sand: #e7c46a; --sym-glass: #7fd0e6; --sym-shards: #aab7c4;

  /* lines and surfaces */
  --bw-panel: 1px; --radius: var(--nx-radius); --shadow-panel: var(--nx-shadow);
  --inset-style: solid; --c-inset-line: var(--nx-line);
  --c-title-bg: transparent; --c-title-fg: var(--nx-ivory); --c-title-sep: var(--nx-line-2);
  --bg-deco: var(--nx-grain), var(--nx-backdrop); --bg-deco-size: 180px 180px, 100% 100%;

  /* gauges: thin pill tracks with ivory / blue fills (the reference's bars) */
  --c-gauge-empty: rgb(236 230 218 / 0.08);
  --fill-hp: var(--nx-hp); --fill-mp: var(--nx-mp); --fill-sp: var(--nx-lantern);
  --low-hatch: linear-gradient(90deg, var(--nx-danger), #f2a08f);

  --mark-fill: radial-gradient(circle, rgb(224 121 106 / 0.32), transparent 70%);

  /* minimap: a lit survey on black glass */
  --c-mm-bg: rgb(10 12 16 / 0.82); --c-mm-floor: #3a3e47; --c-mm-wall: #8d887f; --c-mm-hole: #26282d; --c-mm-edge: rgb(236 230 218 / 0.3);
  --c-mm-you: var(--nx-lantern); --c-mm-foe: var(--nx-danger); --c-mm-stair: var(--nx-mp); --c-mm-item: #d9a960;

  /* buttons, tabs, rows */
  --c-btn-bg: rgb(236 230 218 / 0.04); --c-btn-fg: var(--nx-ivory);
  --c-tab-bg: transparent; --c-tab-fg: var(--nx-ivory-3); --c-tab-line: var(--nx-line);
  --c-row-bg: transparent; --c-row-fg: var(--nx-ivory); --c-row-meta: var(--nx-ivory-3);
  --c-row-focus-bg: var(--nx-lantern-soft); --c-row-focus-fg: var(--nx-ivory);
  --c-tag-line: var(--nx-line-2);
  --c-range-off: rgb(236 230 218 / 0.025); --c-range-off-line: rgb(236 230 218 / 0.10);
  --c-range-hit: rgb(233 184 114 / 0.55); --c-range-self: var(--nx-ivory);
  --c-desc-bg: transparent; --c-desc-fg: var(--nx-ivory);

  /* paper material is retired in this skin: every notebook image resolves to nothing */
  --nb-paper: var(--nx-ground); --nb-paper-2: var(--nx-glass-2); --nb-paper-3: var(--nx-ground-2);
  --nb-ink: var(--nx-ivory); --nb-ink-2: var(--nx-ivory-2); --nb-ink-3: var(--nx-ivory-3);
  --nb-pencil-line: var(--nx-line-2); --nb-red: var(--nx-danger); --nb-indigo: var(--nx-mp);
  --nb-marker: var(--nx-lantern-soft); --nb-margin: transparent; --nb-rule: transparent;
  --nb-paper-img: none; --nb-sheet: var(--nx-glass-2); --nb-sheet-size: auto; --vp-ps1-paper: none;
  --nb-tape: none; --nb-tape-2: none; --nb-ring: none; --nb-flower: none;
  --nb-frame-window: none; --nb-frame-inset: none; --nb-btn-idle: none; --nb-btn-selected: none;
  --nb-age: none; --nb-ruled: none; --nb-hl: none; --nb-tick: none;
  --nb-lift: none; --nb-lift-hi: var(--nx-shadow);

  /* motion */
  --nx-ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --nx-dur: 220ms;
}

@media (prefers-reduced-motion: reduce) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) { --nx-dur: 0ms; }
}

/* ==== screen styles below: menu, detail, flows, HUD, touch deck (filled per docs/design/NOCTURNE_UI_SPEC.md) ==== */

/* Nocturne stage 1: menus, details, popups and flows. Field HUD / chassis / deck
   retain their existing rules. Every selector is scoped to the PS1 skin. */
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) {
  --nx-caption: var(--nx-ivory-2); /* captions on raised glass, >= 4.5:1 */
  --vp-ps1-paper: none; /* popup.css's optional raster-paper probe is retired too. */
  --nx-panel-solid: var(--nx-ground-2);
  --nx-menu-art: url("../../../assets/ui/nocturne/bg-landscape.webp");
  --nx-menu-veil: color-mix(in srgb, var(--nx-ground) 45%, var(--nx-glass));
  --nx-menu-wash: linear-gradient(var(--nx-menu-veil), var(--nx-menu-veil));
  --nx-focus-ring: 0 0 0 1px var(--nx-lantern);
}

/* Retire local notebook variables too: the old menu set image variables on itself. */
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) {
  --c-ink-3: var(--nx-caption); --nb-ink-3: var(--nx-caption);
  --nb-hl: none; --nb-tick: none; --nb-ruled: none; --nb-sheet: none;
  --m-ctl-h: 44px; --m-row-h: 48px; --lay-row-h: 48px;
  --nx-range-size: clamp(88px, 15vw, 220px);
  inset: 0; width: auto; height: auto; max-width: 100%; max-height: 100dvh;
  padding: max(16px, var(--safe-t)) max(24px, var(--safe-r)) max(12px, var(--safe-b)) max(24px, var(--safe-l));
  gap: 12px; isolation: isolate; overflow: hidden;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 48px auto minmax(0, 1fr) 44px;
  grid-template-areas: "tabs" "head" "body" "desc";
  color: var(--nx-ivory); background-color: var(--nx-ground);
  background-image: var(--ob-backplate, var(--nx-menu-art)); background-size: cover; background-position: center;   /* skin-observer.css: the cream enamel backplate (the starry bg-*.webp art stays only as the fallback when it is missing) */
  border: 0; border-radius: 0; box-shadow: var(--nx-shadow);
  font-family: var(--ff-ui); font-size: max(13px, var(--fs-body)); text-shadow: none;
  animation: none; transform: none;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]):not([hidden]) { animation: nx-panel-in var(--nx-dur) var(--nx-ease) both; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) > * { animation: none; }
/* The list sits on its own glass card (matching the detail card) so nothing decorative ever shows through the rows;
   the lantern's warmth comes from the backdrop glow, not from an image under the text. */
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__body > .ui-list {
  background: var(--nx-glass); border: 1px solid var(--nx-line); border-radius: var(--nx-radius);
  -webkit-backdrop-filter: var(--nx-blur); backdrop-filter: var(--nx-blur);
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])::before,
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])::after,
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(.ui-tab,.ui-row,.ui-detail,.ui-portrait__img,.ui-menu__head,.ui-desc__text)::before,
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(.ui-tab,.ui-row,.ui-detail,.ui-portrait__img)::after {
  content: none; display: none; background: none; animation: none; box-shadow: none;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__body {
  display: grid; grid-template-areas: "list detail";
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 24px; min-width: 0; min-height: 0;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__body > .ui-portrait { display: none; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tabs {
  align-items: stretch; gap: 8px; padding: 0; min-width: 0;
  border: 0; border-bottom: 1px solid var(--nx-line); background: none; box-shadow: none;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tab {
  flex: 1 1 0; min-width: 44px; min-height: 44px; height: auto;
  margin: 0; padding: 4px 8px; align-self: stretch;
  color: var(--nx-caption); background: transparent; border: 0;
  border-bottom: 2px solid transparent; border-radius: 0;
  box-shadow: none; transform: none; filter: none; font-family: var(--ff-mincho);
  transition: color var(--nx-dur) var(--nx-ease), background-color var(--nx-dur) var(--nx-ease);
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tab:is(:hover,[aria-selected="true"]) {
  color: var(--nx-ivory); margin: 0; padding-bottom: 4px; background: var(--nx-lantern-soft);
  border: 0; border-bottom: 2px solid var(--nx-lantern); box-shadow: none; filter: none;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(.ui-tab__en,.ui-tab__ja) { font-size: 13px; letter-spacing: .08em; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tabs__hint { align-self: center; color: var(--nx-caption); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tabs__hint kbd {
  border: 1px solid var(--nx-line-2); border-radius: var(--nx-radius-pill);
  background: transparent; color: var(--nx-caption); box-shadow: none; padding: 3px 10px;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__head {
  min-height: 44px; padding: 0 0 8px; margin: 0; gap: 8px; align-items: center; background: none; border-bottom: 1px solid var(--nx-line);
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(.ui-title__ja,.ui-detail__name,.ui-row__group) { font-family: var(--ff-mincho); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-title__ja { color: var(--nx-ivory); font-size: clamp(18px, 2vw, 28px); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-title__meta { color: var(--nx-caption); font: 12px var(--ff-ui); white-space: normal; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-list { min-height: 0; min-width: 0; padding: 0; overflow: hidden; background: transparent; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-list__rows {
  min-width: 0; min-height: 0; gap: 0; background: none; padding-bottom: 0;
  overflow: hidden auto; overscroll-behavior: contain; scrollbar-gutter: stable;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-row {
  height: auto; min-height: 48px; padding: 8px; gap: 8px;
  flex-wrap: wrap; align-content: center; background: transparent; color: var(--nx-ivory);
  border: 0; border-bottom: 1px solid var(--nx-line); border-left: 2px solid transparent;
  border-radius: 0; text-shadow: none; box-shadow: none;
  transition: background-color var(--nx-dur) var(--nx-ease); transform: none;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-row:is(:hover,:focus-visible,[aria-selected="true"],.controller-selected) {
  color: var(--nx-ivory); background: var(--nx-lantern-soft); border-left-color: var(--nx-lantern); box-shadow: none;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-row:is(:hover,:focus-visible,[aria-selected="true"],.controller-selected) :is(.ui-row__meta,.ui-row__tag,.ui-row__tag i) { color: var(--nx-ivory); opacity: 1; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-row__name { font: inherit; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(.ui-row__meta,.ui-row__tag) { font: 12px var(--ff-ui); color: var(--nx-caption); white-space: normal; overflow-wrap: anywhere; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-row[aria-disabled="true"] .ui-row__name { color: var(--nx-caption); text-decoration: none; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-row__group {
  min-height: 36px; height: auto; padding: 6px 8px; background: var(--nx-panel-solid);
  color: var(--nx-caption); border-bottom: 1px solid var(--nx-line); letter-spacing: .12em; white-space: normal;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-row__group i { opacity: 1; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-chip {
  width: 30px; height: 30px; padding: 6px; background: transparent;
  border: 1px solid var(--nx-line-2); border-radius: var(--nx-radius); box-shadow: none;
}

/* The detail body scrolls independently; actions have their own allocated row. */
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail {
  display: flex; flex-direction: column; align-self: stretch; min-width: 0; min-height: 0; max-height: none;
  margin: 0; padding: 16px; gap: 12px; overflow: hidden; transform: none;
  background: var(--nx-glass); color: var(--nx-ivory);
  border: 1px solid var(--nx-line); border-radius: var(--nx-radius);
  box-shadow: var(--nx-shadow); backdrop-filter: var(--nx-blur);
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__head {
  display: flex; flex-wrap: wrap; align-items: center; min-width: 0; gap: 8px;
  padding: 0 0 8px; border-bottom: 1px solid var(--nx-line);
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__name {
  min-width: 0; flex: 1 1 0; color: var(--nx-ivory); font-size: clamp(17px, 1.9vw, 26px); overflow-wrap: anywhere;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__en {
  display: block; flex: 1 0 100%; margin: 0; white-space: normal;
  color: var(--nx-caption); font: 12px var(--ff-mincho); letter-spacing: .18em;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__content {
  flex: 1 1 auto; min-height: 0; gap: 12px; padding-bottom: 8px;
  background: none; overflow: hidden auto; scroll-padding-block: 8px; overscroll-behavior: contain;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__cols {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--nx-range-size); gap: 16px; align-items: start;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__cols--single { grid-template-columns: minmax(0, 1fr); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(.ui-detail__main,.ui-detail__extra) { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__text { font: inherit; color: var(--nx-ivory-2); line-height: 1.75; overflow-wrap: anywhere; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(.ui-detail__sub,.ui-stats dt) { color: var(--nx-caption); font: 12px var(--ff-mincho); letter-spacing: .12em; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-stats {
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding: 8px 0;
  border: 0; border-block: 1px solid var(--nx-line); background: none;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-stats > div { min-width: 0; padding: 4px 0; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-stats dd { font: 20px var(--ff-mincho); color: var(--nx-ivory); white-space: normal; overflow-wrap: anywhere; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-stats[data-spell-summary] > [data-spec-fact] { display: none; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-stats[data-spell-summary]:not(:has(> div:not([data-spec-fact]))) { display: none; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-effects { padding: 0; border: 0; background: none; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-effects > li {
  display: grid; grid-template-columns: minmax(0,1fr); gap: 4px; padding: 8px 0;
  border-bottom: 1px solid var(--nx-line); min-width: 0;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-effects > li > span { color: var(--nx-caption); font: 12px var(--ff-ui); white-space: normal; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-effects :is(b,small) { text-align: left; color: var(--nx-ivory); font: inherit; white-space: normal; overflow-wrap: anywhere; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__hint { gap: 8px; color: var(--nx-ivory-2); font: 12px/1.6 var(--ff-ui); border-top: 1px solid var(--nx-line); padding-top: 8px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__actions {
  position: static; flex: none; display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px 0 0; margin: 0; background: transparent; border-top: 1px solid var(--nx-line);
  max-height: min(144px, 25dvh); overflow: hidden auto;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__actions .ui-btn { flex: 1 1 112px; min-height: 44px; padding: 8px; white-space: normal; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-desc {
  padding: 0; gap: 12px; background: none; color: var(--nx-caption); border: 0; border-top: 1px solid var(--nx-line);
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-desc__text { color: var(--nx-ivory-2); font: 12px/1.5 var(--ff-ui); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-guide { gap: 8px; color: var(--nx-caption); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-guide .ui-key { min-width: 44px; min-height: 44px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-guide kbd { background: transparent; color: inherit; border: 1px solid var(--nx-line-2); box-shadow: none; transform: none; border-radius: var(--nx-radius-pill); }

/* Information strips are hidden by the native hidden attribute in GB. */
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-spec[hidden] {
  display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; margin: 0;
  padding: 10px 0; border-block: 1px solid var(--nx-line);
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-spec > div { display: flex; flex-direction: column; min-width: 0; gap: 5px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-spec dt { order: 2; font: 11px/1.4 var(--ff-ui); color: var(--nx-caption); letter-spacing: .08em; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-spec dd { display: flex; flex-wrap: wrap; gap: 4px; font: 20px/1.3 var(--ff-mincho); color: var(--nx-ivory); overflow-wrap: anywhere; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-spec small { width: 100%; font: 11px/1.4 var(--ff-ui); color: var(--nx-caption); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-pips { display: flex; flex-wrap: wrap; gap: 3px; width: 100%; align-content: start; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-pip { width: 8px; height: 4px; border: 1px solid var(--nx-line-2); border-radius: var(--nx-radius-pill); background: var(--c-gauge-empty); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-pip[data-filled="true"] { border-color: var(--nx-lantern); background: var(--nx-lantern); }

/* Hairline range grid: never hidden at a viewport breakpoint. */
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-range[data-range-gb] { display: none; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-range[hidden] { display: flex; flex-direction: column; gap: 8px; width: var(--nx-range-size); min-width: 88px; margin: 0; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-range__grid {
  display: grid; width: 100%; aspect-ratio: 1; grid-template-columns: repeat(11,minmax(0,1fr)); grid-template-rows: repeat(11,minmax(0,1fr)); grid-auto-rows: auto; gap: 0; margin: 0;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-range__cell { outline: 1px solid var(--nx-line); outline-offset: -1px; border-radius: 0; background: var(--c-range-off); transform: none; box-shadow: none; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-range__cell[data-k="hit"] { background: var(--c-range-hit); box-shadow: var(--nx-focus-ring); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-range__cell[data-k="end"] { background: var(--nx-lantern); outline: 1px solid var(--nx-ivory); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-range__cell[data-k="self"] { background: radial-gradient(circle, var(--nx-ivory) 0 28%, transparent 33%); outline: 1px solid var(--nx-line); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-range figcaption { order: 2; font: 11px/1.5 var(--ff-ui); color: var(--nx-caption); letter-spacing: .02em; }

/* Shared buttons, feature rails and popup controls. No new field/deck rules. */
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(button,.ui-key[role="button"],summary) {
  min-width: 44px; min-height: 44px; border-radius: var(--nx-radius);
  color: var(--nx-ivory); background: transparent; border: 1px solid var(--nx-line-2);
  box-shadow: none; text-shadow: none; transform: none; touch-action: manipulation;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(button,summary):is(:hover,[aria-pressed="true"],[data-on="1"],.controller-selected) {
  color: var(--nx-ivory); background: var(--nx-lantern-soft); border-color: var(--nx-lantern); box-shadow: none; text-decoration: none;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(button,summary,[tabindex]):is(:focus-visible,.controller-selected) {
  outline: 1px solid var(--nx-lantern); outline-offset: -2px; box-shadow: var(--nx-lantern-glow); text-decoration: none;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) button:disabled { color: var(--nx-caption); opacity: 1; border-style: dashed; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tab { border: 0; border-bottom: 2px solid transparent; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tab:hover { border-bottom-color: var(--nx-lantern); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tab[aria-selected="true"] { border-bottom-color: var(--nx-lantern); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(.ui-chipbtn,.ui-segbtn,.ui-featuretag,.ui-spell-tools summary) { min-height: 44px; border-radius: var(--nx-radius-pill); padding: 6px 10px; font: 12px/1.4 var(--ff-ui); white-space: nowrap; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(.ui-chips,.ui-features,.ui-spell-states) { flex-wrap: nowrap; gap: 6px; min-width: 0; overflow: auto hidden; scrollbar-width: thin; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-spell-states { overflow: visible; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-spell-tools { font-size: 12px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-spell-tools summary { white-space: normal; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-spell-options { max-height: 35dvh; overflow-y: auto; padding: 8px; background: var(--nx-panel-solid); color: var(--nx-ivory); border: 1px solid var(--nx-line-2); box-shadow: var(--nx-shadow); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-subtabs[data-kind="spell"] { gap: 4px; margin-bottom: 8px; flex: none; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-spell-tags { gap: 6px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tag { border: 1px solid var(--nx-line-2); border-radius: var(--nx-radius-pill); background: transparent; color: var(--nx-ivory); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(.ui-gauge__bar,.ui-gauge__fill) { height: 5px; border-radius: var(--nx-radius-pill); background-image: none; mask: none; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-gauge__bar { background: var(--c-gauge-empty); border: 1px solid var(--nx-line); }

/* All non-title product flows use glass. Inline field information is outside this scope. */

/* The title art/composition keep their authored positioning; only the menu board changes. */

/* Desktop landscape: 1280x720 and up. */
@media (orientation: landscape) and (min-width: 1280px) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) { padding-inline: max(40px,var(--safe-l)) max(40px,var(--safe-r)); gap: 16px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__body { grid-template-columns: minmax(0,2fr) minmax(0,3fr); gap: 32px; }
}
/* Phone landscape: includes 844x390. Two columns, each with independent scrolling. */
@media (orientation: landscape) and (max-height: 520px) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) { --nx-range-size: 88px; padding: 8px max(8px,var(--safe-r)) 6px max(8px,var(--safe-l)); gap: 6px; grid-template-rows: 44px 44px minmax(0,1fr) 44px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])::before { display: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__body { grid-template-columns: minmax(0,2fr) minmax(0,3fr); gap: 12px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail { padding: 8px; gap: 6px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__en { display: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__cols { gap: 8px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-desc__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  
  
}
/* Portrait phones: 390x844, and a compact pass below for 320x568. */
@media (orientation: portrait) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) { --nx-menu-art: url("../../../assets/ui/nocturne/bg-portrait.webp"); }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) {
    --nx-range-size: clamp(88px,24vw,160px);
    padding: max(8px,var(--safe-t)) max(8px,var(--safe-r)) max(6px,var(--safe-b)) max(8px,var(--safe-l)); gap: 8px;
    grid-template-rows: 44px auto minmax(0,1fr) minmax(0,1fr) 44px;
    grid-template-areas: "tabs" "head" "list" "detail" "desc";
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__body { display: contents; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-list { grid-area: list; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail { grid-area: detail; padding: 10px; gap: 8px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-sheet="min"] { grid-template-rows: 44px auto minmax(0,1fr) auto 44px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__head { padding-right: 26px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__head::after { width: 16px; background: var(--nx-line-3); }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__en { display: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tabs { gap: 2px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tabs__hint { display: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tab { padding-inline: 2px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tab__ja { display: block; font-size: 12px; letter-spacing: 0; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tab__en { font-size: 10px; letter-spacing: .06em; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])::before { display: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__cols { gap: 8px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-desc__text { display: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-guide { width: 100%; justify-content: space-between; }
  
  
  
  
}
@media (orientation: portrait) and (max-width: 360px) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) { --nx-range-size: 88px; gap: 6px; font-size: 13px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__head { flex-wrap: wrap; gap: 4px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-title__meta { font-size: 11px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail { padding: 8px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-spec[hidden] { gap: 4px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-spec dd { font-size: 16px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-spell-states :is(button,summary) { padding-inline: 6px; font-size: 11px; }
}
/* Tablet portrait: 768x1024, same list/sheet hierarchy with more breathing room. */
@media (orientation: portrait) and (min-width: 600px) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) { --nx-range-size: 160px; padding: 24px; gap: 16px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail { padding: 20px; gap: 12px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__en { display: block; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__cols { gap: 24px; }
}
@keyframes nx-panel-in { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
:root[data-skin="ps1"][data-reduced-motion="1"] body #actionSidebar.ui-menu:not([data-hand="1"]) { animation: none; }
@media (prefers-reduced-motion: reduce) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) { animation: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) * { transition-duration: 0ms; }
}

/* The quick hand keeps its existing tray/rail interaction. Its cards and detail
   receive the same material; header and actions reserve their 44px hit areas. */

/* Roomy landscape (height > 520px): spells use the same overview row, so the range figure stands beside the four-column
   spec strip instead of being pushed into the scrolled body (at 1280x720 it was clipped by the action bar). Equipment
   keeps its in-body stats and sockets here. */
@media (orientation: landscape) and (min-height: 521px) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) { --nx-ov-range: clamp(104px, 18vh, 168px); }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail > .nx-overview[hidden]:has(> .nx-range) {
    display: grid; grid-template-columns: minmax(0,1fr) var(--nx-ov-range); gap: 16px; align-items: start; flex: none; min-width: 0;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview > .nx-range[hidden] { width: var(--nx-ov-range); min-width: 88px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview .ui-range__grid { width: var(--nx-ov-range); height: var(--nx-ov-range); flex: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview > .nx-range) .ui-detail__content > .nx-spec,
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview > .nx-range) .ui-detail__content .nx-range { display: none; }
}

/* Compact details have a pinned, non-interactive overview. The existing copy
   stays in the reading column on desktop/tablet; GB sees only its existing DOM.
   At 320x568 the reserved detail budget is 294px with six/seven actions:
   name 44 + overview 104 + actions 92 + prose 24 + gaps/padding/borders 30.
   No prose, feature tag or tooltip text can push the overview below scroll 0. */
@media (orientation: portrait) and (max-width: 599px), (orientation: landscape) and (max-height: 520px) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) {
    --nx-overview-height: 104px; --nx-action-budget: 0px; --nx-detail-min: 128px;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]):has(.ui-detail__actions[data-compact-rows="1"]) { --nx-action-budget: 44px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]):has(.ui-detail__actions[data-compact-rows="2"]) { --nx-action-budget: 92px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]):has(.nx-overview) { --nx-detail-min: calc(44px + var(--nx-overview-height) + var(--nx-action-budget) + 54px); }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview) {
    display: grid; grid-template-columns: minmax(0,1fr);
    grid-template-rows: 44px var(--nx-overview-height) minmax(0,1fr) auto;
    gap: 4px; padding: 8px; min-height: 0;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview) > .ui-detail__head {
    grid-row: 1; display: grid; grid-template-columns: 30px minmax(0,1fr);
    grid-template-rows: 22px 14px; column-gap: 6px; row-gap: 0;
    height: 44px; min-height: 44px; padding: 0 20px 6px 0; margin: 0;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview) .ui-detail__head > .ui-chip { grid-column: 1; grid-row: 1 / span 2; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview) .ui-detail__name { grid-column: 2; grid-row: 1 / span 2; font-size: 16px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview) .ui-detail__en { display: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview[hidden] {
    grid-row: 2; display: grid; grid-template-columns: minmax(0,1fr) 88px;
    align-items: start; gap: 8px; width: 100%; min-width: 0; height: var(--nx-overview-height);
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview > .nx-spec[hidden] {
    grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-rows: repeat(2,minmax(0,1fr));
    height: var(--nx-overview-height); gap: 4px 6px; padding: 0; margin: 0; border: 0;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview .nx-spec > div { gap: 1px; min-height: 0; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview .nx-spec dt { font-size: 10px; line-height: 12px; letter-spacing: 0; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview .nx-spec dd { gap: 2px; font-size: 16px; line-height: 18px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview .nx-spec > div:last-child dd { font-size: 11px; line-height: 14px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview .nx-pips { gap: 2px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview .nx-pip { width: 6px; height: 4px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview > .nx-range[hidden] { width: 88px; min-width: 88px; height: var(--nx-overview-height); gap: 2px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview .ui-range__grid { width: 88px; height: 88px; flex: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .nx-overview .nx-range figcaption { display: block; margin: 0; font-size: 10px; line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview) > .ui-detail__content { grid-row: 3; min-height: 0; padding: 0 0 4px; overflow: hidden auto; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview) > .ui-detail__actions { grid-row: 4; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview) .ui-detail__content > .nx-spec,
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview) .ui-detail__content .nx-range { display: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview) .ui-detail__cols { grid-template-columns: minmax(0,1fr); }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__actions {
    display: grid; grid-template-columns: repeat(var(--nx-action-cols),minmax(44px,1fr));
    grid-template-rows: repeat(var(--nx-action-rows),44px); gap: 4px;
    height: var(--nx-action-budget); max-height: 92px; padding: 0; border: 0; overflow: visible;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__actions .ui-btn {
    min-width: 44px; min-height: 44px; height: 44px; max-height: 44px; padding: 4px;
    grid-column: auto; overflow: hidden; white-space: nowrap;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__actions > .ui-btn:last-child:nth-child(odd) { grid-column: auto; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__actions .ui-btn > span { display: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail__actions .ui-btn::after {
    content: attr(data-compact-label); display: block; min-width: 0; max-width: 100%;
    font-size: 11px; line-height: 16px; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) :is(.ui-chipbtn,.ui-segbtn,.ui-featuretag,.ui-spell-tools summary,.ui-subtabs__step,.ui-tabs__hint) { min-width: 44px; min-height: 44px; flex-shrink: 0; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__head { height: 44px; min-height: 44px; padding: 0; flex-wrap: nowrap; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-title__main { min-width: 0; overflow: hidden; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-guide .ui-key { min-width: 44px; flex: 1 1 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (orientation: portrait) and (max-width: 599px) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) {
    --nx-menu-top: max(8px,var(--safe-t)); --nx-menu-bottom: max(6px,var(--safe-b));
    --nx-free-height: calc(100dvh - var(--nx-menu-top) - var(--nx-menu-bottom) - 132px - 24px);
    padding-block: var(--nx-menu-top) var(--nx-menu-bottom); gap: 6px;
    grid-template-rows: 44px 44px minmax(0,max-content) minmax(var(--nx-detail-min),1fr) 44px;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__body > .ui-list {
    display: block; align-self: start; width: 100%;
    max-height: max(0px,min(36dvh,calc(var(--nx-free-height) - var(--nx-detail-min))));
    overflow: hidden auto; overscroll-behavior: contain;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-list__rows { overflow: visible; min-height: 0; flex: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-sheet="min"] { grid-template-rows: 44px 44px minmax(0,1fr) auto 44px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-sheet="min"] .nx-overview[hidden] { display: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-sheet="min"] .ui-detail:has(> .nx-overview) { grid-template-rows: 44px auto; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-sheet="min"] .ui-detail:has(> .nx-overview) > .ui-detail__actions { grid-row: 2; }
}

/* In short landscape the guide shares the left column with the list. A single
   44px top row holds tabs and the menu heading, leaving the full right-hand
   height for name, overview, reading region and the two-row action grid. */
@media (orientation: landscape) and (max-height: 520px) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) {
    grid-template-columns: minmax(0,2fr) minmax(0,3fr);
    grid-template-rows: 44px minmax(0,1fr); grid-template-areas: "tabs head" "list detail";
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__body { display: contents; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__body > .ui-list { grid-area: list; margin-bottom: 50px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__body > .ui-detail { grid-area: detail; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-desc { grid-area: list; align-self: end; height: 44px; min-height: 44px; overflow: hidden; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-desc__text { display: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-desc .ui-guide { width: 100%; min-width: 0; flex: 1 1 0; gap: 4px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tabs { gap: 2px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tabs__hint { display: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-tab { padding-inline: 2px; }
}

/* ---------------------------------------------------------------------------
   Full menu v2: no header bar (the tab strip + the bottom 戻る are the whole chrome);
   spellbook = fixed icon tabs + fixed feature row, only the dense list scrolls;
   the detail sheet scrolls as one piece and, once folded, hands its height to the list.
   Loaded last on purpose: it wins over the earlier sizing blocks by order. */
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) {
  grid-template-rows: 48px minmax(0,1fr) 44px; grid-template-areas: "tabs" "body" "desc";
}
/* icon-only element tabs and a slim feature row */
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-subtabs[data-kind="spell"] { margin-bottom: 4px; gap: 3px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-subtabs[data-kind="spell"] .ui-chipbtn { min-width: 40px; min-height: 40px; padding: 0 8px; justify-content: center; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-subtabs[data-kind="spell"] .ui-chipbtn .ui-sym { width: 20px; height: 20px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-subtabs[data-kind="spell"] :is(.ui-segbtn,.ui-featuretag) { min-height: 34px; padding: 2px 10px; font-size: 12px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-subtabs[data-kind="spell"] > * { flex: none; }
/* dense spell rows: many rows per screen, still a >=32px tap target */
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-tab="SPELL"] .ui-list--dense .ui-row {
  min-height: 34px; height: 34px; padding: 2px 8px; gap: 6px; flex-wrap: nowrap; align-content: center; align-items: center; font-size: 13px; line-height: 1.2;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-tab="SPELL"] .ui-list--dense .ui-row .ui-sym { width: 16px; height: 16px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-tab="SPELL"] .ui-list--dense .ui-row__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-tab="SPELL"] .ui-list--dense .ui-row__meta { flex: 0 1 auto; min-width: 0; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }

@media (orientation: portrait) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]),
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-sheet="min"] {
    grid-template-rows: 44px minmax(0,1fr) auto 44px; grid-template-areas: "tabs" "list" "detail" "desc";
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__body > .ui-list {
    display: flex; flex-direction: column; align-self: stretch; width: 100%; height: auto; max-height: none; min-height: 0; overflow: hidden;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-list > :not(.ui-list__rows) { flex: none; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-list__rows {
    flex: 1 1 auto; min-height: 0; overflow: hidden auto; overscroll-behavior: contain; padding-bottom: 0;
  }
  /* the detail sheet: one scrolling piece; folded (data-sheet="min") it shrinks to its title and the list takes the room */
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-menu__body > .ui-detail,
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview) {
    display: block; grid-template-rows: none; align-self: end; min-height: 30dvh; max-height: 46dvh; overflow: hidden auto; overscroll-behavior: contain;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-sheet="min"] .ui-menu__body > .ui-detail,
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-sheet="min"] .ui-detail:has(> .nx-overview) {
    min-height: 0; max-height: none; overflow: hidden;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail:has(> .nx-overview) > .ui-detail__content,
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail > .ui-detail__content {
    overflow: visible; height: auto; min-height: 0; flex: none;
  }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail > .nx-overview[hidden] { margin-block: 4px; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-detail > .ui-detail__actions {
    position: sticky; bottom: 0; z-index: 1; background: var(--nx-ground); margin-top: 4px;
  }
}
/* Settings category rows have no detail content; give that space to the list. */
@media (orientation: portrait) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-tab="SYSTEM"] .ui-detail[data-row-kind="settingsSection"] {
    display: none;
  }
}
@media (orientation: landscape) and (max-height: 520px) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) { grid-template-rows: 44px minmax(0,1fr); grid-template-areas: "tabs tabs" "list detail"; }
}

/* 2026-10-18: parchment retirement outside the menu. The notebook paper tokens are remapped on :root above; these are the spots that
   painted a literal paper colour or a per-tab tint instead of a token. */
:root[data-skin="ps1"] .ui-detail { background-color: var(--nx-glass-2); background-image: none; }
:root[data-skin="ps1"] .ui-tab { --tabc: var(--nx-glass-2); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"])[data-tab="SPELL"] .ui-list--dense .ui-row[data-info="1"] { height: auto; min-height: 46px; flex-wrap: wrap; align-content: center; padding-block: 3px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu:not([data-hand="1"]) .ui-row__info { color: var(--nx-caption); }

/* Spellbook overview owns the whole screen at every size: one column, tabs / controls+list / footer full width.
   The select-then-detail grids above (2fr 3fr columns, "list detail" areas, display:contents body, list over footer)
   belong to the other tabs and must not leak into it. Loaded last, with the same chain as the base spellbook rule. */
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-tab="SPELL"][data-spellbook="1"]:not([data-hand="1"]) {
  grid-template-columns: minmax(0,1fr); grid-template-rows: 44px auto minmax(0,1fr) auto; grid-template-areas: "tabs" "head" "body" "desc";
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-tab="SPELL"][data-spellbook="1"]:not([data-hand="1"]) .ui-tabs { grid-area: tabs; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-tab="SPELL"][data-spellbook="1"]:not([data-hand="1"]) .ui-menu__head { grid-area: head; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-tab="SPELL"][data-spellbook="1"]:not([data-hand="1"]) .ui-menu__body {
  display: grid; grid-area: body; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr); grid-template-areas: "list"; gap: 0; min-width: 0; min-height: 0;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-tab="SPELL"][data-spellbook="1"]:not([data-hand="1"]) .ui-menu__body > .ui-list {
  grid-area: list; display: flex; flex-direction: column; align-self: stretch; justify-self: stretch; width: 100%; height: auto; max-height: none; min-width: 0; min-height: 0; margin: 0; overflow: hidden;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-tab="SPELL"][data-spellbook="1"]:not([data-hand="1"]) .ui-list > #sidebarSubtabs { flex: none; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-tab="SPELL"][data-spellbook="1"]:not([data-hand="1"]) .ui-list > #sidebarList { flex: 1 1 auto; min-height: 0; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-tab="SPELL"][data-spellbook="1"]:not([data-hand="1"]) .ui-desc {
  grid-area: desc; align-self: stretch; width: auto; height: auto; min-height: 44px; max-height: none; margin: 0; overflow: visible;
}
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-tab="SPELL"][data-spellbook="1"]:not([data-hand="1"]) .ui-desc .ui-guide { width: 100%; flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-start; gap: 4px 8px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-tab="SPELL"][data-spellbook="1"]:not([data-hand="1"]) .ui-desc .ui-guide .ui-key { flex: 0 0 auto; overflow: visible; text-overflow: clip; }

/* ITEM command row (one bar at the bottom, wraps instead of cutting). Every layout hands the last track the height it needs;
   loaded last so it wins over the fixed 44px tracks above. */
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-item-footer="1"]:not([data-hand="1"]) { grid-template-rows: 48px minmax(0,1fr) auto; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-item-footer="1"]:not([data-hand="1"]) .ui-desc { height: auto; min-height: 44px; max-height: none; overflow: visible; flex-wrap: wrap; align-items: stretch; padding-block: 4px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-item-footer="1"]:not([data-hand="1"]) .ui-desc__text { display: none; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-item-footer="1"]:not([data-hand="1"]) .ui-desc .ui-guide { width: 100%; flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-start; align-items: stretch; gap: 6px 8px; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-item-footer="1"]:not([data-hand="1"]) .ui-guide .ui-key--act { flex: 1 1 auto; min-width: 44px; max-width: 100%; white-space: normal; overflow: visible; text-overflow: clip; color: var(--nx-ivory); border-color: var(--nx-line-2); background: transparent; }
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-item-footer="1"]:not([data-hand="1"]) .ui-guide .ui-key--act.controller-selected { border-color: var(--nx-ivory); box-shadow: var(--nx-focus-ring); }
:root[data-skin="ps1"] body #actionSidebar.ui-menu[data-item-footer="1"]:not([data-hand="1"]) .ui-guide__keys .ui-key { flex: 0 0 auto; }
@media (orientation: portrait) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu[data-item-footer="1"]:not([data-hand="1"]),
  :root[data-skin="ps1"] body #actionSidebar.ui-menu[data-item-footer="1"]:not([data-hand="1"])[data-sheet="min"] { grid-template-rows: 44px minmax(0,1fr) auto auto; }
}
@media (orientation: landscape) and (max-height: 520px) {
  :root[data-skin="ps1"] body #actionSidebar.ui-menu[data-item-footer="1"]:not([data-hand="1"]) { grid-template-rows: 44px minmax(0,1fr) auto; grid-template-areas: "tabs tabs" "list detail" "desc desc"; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu[data-item-footer="1"]:not([data-hand="1"]) .ui-desc { grid-area: desc; align-self: stretch; }
  :root[data-skin="ps1"] body #actionSidebar.ui-menu[data-item-footer="1"]:not([data-hand="1"]) .ui-menu__body > .ui-list { margin-bottom: 0; }
}
