:root {
  color-scheme: dark;
  --bg: #111313;
  --panel: #191c1d;
  --panel-2: #202525;
  --line: #313838;
  --text: #eef1ef;
  --muted: #9ba6a4;
  --brand: #7c3aed;
  --brand-bright: #a78bfa;
  --on-brand: #ffffff;
  --accent: var(--brand-bright);
  --accent-2: var(--brand-bright);
  --danger: #d66a5f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  min-height: 36px;
  padding: 0 12px;
}

button:hover {
  border-color: #52605e;
}

.start-screen {
  align-items: center;
  background: #06021c;
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 1;
  position: fixed;
  transition: opacity 0.45s ease;
  z-index: 100;
}

.start-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.start-inner {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 32px;
  text-align: center;
}

.start-logo {
  animation: start-rise 0.7s ease 0.1s both;
  height: auto;
  max-width: min(560px, 80vw);
  width: 100%;
}

.start-tagline {
  animation: start-rise 0.7s ease 0.35s both;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin: 0;
}

.start-enter {
  animation: start-rise 0.7s ease 0.55s both;
  background: var(--brand);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--on-brand);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  min-height: 52px;
  padding: 0 48px;
}

.start-enter:hover {
  border-color: transparent;
  filter: brightness(1.08);
}

.start-credit {
  animation: start-fade 0.9s ease 0.9s both;
  bottom: 24px;
  color: var(--muted);
  font-size: 0.82rem;
  left: 0;
  letter-spacing: 0.03em;
  margin: 0;
  opacity: 0.7;
  position: absolute;
  right: 0;
  text-align: center;
}

@keyframes start-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes start-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.7;
  }
}

.app-shell {
  display: grid;
  /* Three columns always: left controls, stage, initiative. The initiative track is 0
     when inactive and the left track is 0 when collapsed, so both panels animate open/shut
     by transitioning the track widths. */
  grid-template-columns: 320px minmax(0, 1fr) 0px;
  height: 100vh;
  height: 100dvh; /* dvh = height visible excluding mobile browser chrome; the vh line is the fallback */
  transition: grid-template-columns 0.28s ease;
  width: 100vw;
}

.app-shell.has-initiative {
  grid-template-columns: 320px minmax(0, 1fr) 300px;
}

.app-shell.panel-collapsed {
  grid-template-columns: 0px minmax(0, 1fr) 0px;
}

.app-shell.panel-collapsed.has-initiative {
  grid-template-columns: 0px minmax(0, 1fr) 300px;
}

.app-shell[data-role="player"] {
  display: block;
  cursor: none;
}

.app-shell[data-role="player"].cursor-active {
  cursor: default;
}

.app-shell[data-role="player"] .gm-panel {
  display: none;
}

.app-shell[data-role="player"] .stage-controls {
  display: none;
}

.app-shell[data-role="player"] .stage-wrap {
  height: 100vh;
  height: 100dvh; /* fit the player stage to the visible area so top/bottom HUD clears the toolbars */
}

.gm-panel {
  background: #06021c;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px;
}

.brand {
  align-items: center;
  display: flex;
  justify-content: center;
}

.brand-logo {
  display: block;
  height: auto;
  max-width: 260px;
  width: 100%;
}

.eyebrow,
.hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 1.65rem;
  font-weight: 700;
}

h2 {
  font-size: 0.95rem;
  font-weight: 650;
}

.status {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 9px;
}

.control-section {
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 18px;
}

/* Sections made collapsible carry their own spacing inside .section-body. */
.control-section:has(.section-body) {
  gap: 0;
}

.section-title {
  align-items: center;
  display: flex;
  gap: 10px;
}

.section-title h2 {
  flex: 1;
  margin: 0;
}

/* Collapsible body: animate grid rows from 1fr to 0fr for a smooth slide. */
.section-toggle {
  align-items: center;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  justify-content: center;
  min-height: 0;
  padding: 0;
  transition: transform 0.25s ease;
  width: 20px;
}

.section-toggle:hover {
  background: none;
  border: 0;
  color: var(--text);
}

.section-toggle svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

.control-section.collapsed .section-toggle {
  transform: rotate(-90deg);
}

.section-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.3s ease;
}

.control-section.collapsed .section-body {
  grid-template-rows: 0fr;
}

.section-body-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  min-height: 0;
  overflow: hidden;
}

.control-section.collapsed .section-body-inner {
  margin-top: 0;
}

label {
  color: var(--muted);
  display: grid;
  gap: 7px;
  font-size: 0.83rem;
}

input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
}

input[type="color"] {
  background: transparent;
  border: 0;
  height: 34px;
  padding: 0;
  width: 100%;
}

.file-loader input {
  display: none;
}

.file-loader span,
.primary-button,
.library-button {
  align-items: center;
  background: var(--brand);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--on-brand);
  cursor: pointer;
  display: flex;
  font-weight: 750;
  justify-content: center;
  min-height: 42px;
  padding: 0 12px;
}

.library-button.empty {
  background: #3a3f3f;
  border-color: #4a5151;
  color: #9aa3a1;
  cursor: default;
}

/* Top GM actions: four icon buttons in a 2x2 grid. */
.top-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.top-action {
  align-items: center;
  background: var(--brand);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--on-brand);
  cursor: pointer;
  display: flex;
  justify-content: center;
  min-height: 52px;
  padding: 0;
}

.top-action:hover:not(:disabled) {
  filter: brightness(1.08);
}

.top-action svg {
  fill: none;
  height: 24px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  width: 24px;
}

.top-action.empty,
.top-action:disabled {
  background: #3a3f3f;
  border-color: #4a5151;
  color: #9aa3a1;
  cursor: default;
}

.secondary-loader span {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--text);
}

.primary-button,
.library-button {
  width: 100%;
}

.ghost-button {
  min-height: 30px;
  padding: 0 10px;
}

.inline-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: 74px minmax(0, 1fr);
}

.inline-buttons {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-buttons button,
.inline-loader span {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 36px;
  width: 100%;
}

.inline-loader {
  cursor: pointer;
}

.inline-loader input {
  display: none;
}

.inline-loader span {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
}

.checkbox-row {
  align-items: center;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.checkbox-row input {
  accent-color: var(--accent);
}

.switch input {
  display: none;
}

.switch.with-label {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-size: 0.8rem;
  gap: 8px;
}

.switch span {
  background: #3a4241;
  border-radius: 999px;
  display: block;
  height: 24px;
  position: relative;
  width: 44px;
}

.switch span::after {
  background: white;
  border-radius: 50%;
  content: "";
  height: 18px;
  left: 3px;
  position: absolute;
  top: 3px;
  transition: transform 150ms ease;
  width: 18px;
}

.switch input:checked + span {
  background: var(--accent-2);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.segmented,
.fog-actions {
  display: grid;
  gap: 8px;
}

.segmented {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented:has(#brushMode),
.segmented:has(#roundShape) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented button {
  padding: 0 7px;
}

.segmented .active {
  background: #263635;
  border-color: var(--accent-2);
  color: #c6fff1;
}

/* Segmented rows whose buttons are icons rather than text (e.g. the AoE shapes). */
.icon-segmented button {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 36px;
}

.icon-segmented svg {
  fill: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 20px;
}

/* Controls disabled while players drive their own view. */
button:disabled,
input:disabled {
  cursor: default;
  opacity: 0.45;
}

.switch input:disabled + span {
  opacity: 0.45;
}

.fog-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hidden {
  display: none !important;
}

.stage-wrap {
  background: #080909;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* A tab on the left edge of the stage that collapses/expands the GM control panel. */
.panel-toggle {
  align-items: center;
  background: rgba(25, 28, 29, 0.92);
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  display: flex;
  height: 46px;
  justify-content: center;
  left: 0;
  min-height: 0;
  padding: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  z-index: 7;
}

.panel-toggle:hover {
  background: var(--panel-2);
  color: var(--text);
}

.panel-toggle svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 0.28s ease;
  width: 18px;
}

/* When the panel is collapsed, flip the chevrons to point "open". */
.app-shell.panel-collapsed .panel-toggle svg {
  transform: rotate(180deg);
}

.app-shell[data-role="player"] .panel-toggle {
  display: none;
}

.stage-controls {
  align-items: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
  left: 14px;
  position: absolute;
  top: 14px;
  z-index: 6;
}

.mode-hint-bar {
  background: rgba(25, 28, 29, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  left: 50%;
  line-height: 1.35;
  margin: 0;
  max-width: calc(100% - 240px);
  padding: 7px 14px;
  position: absolute;
  text-align: center;
  top: 14px;
  transform: translateX(-50%);
  z-index: 6;
}

.app-shell[data-role="player"] .mode-hint-bar {
  display: none;
}

.tool-row {
  align-items: flex-start;
  display: flex;
  gap: 8px;
}

.map-tools {
  background: rgba(25, 28, 29, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  padding: 7px;
  width: 96px;
}

/* Fog-of-war tools live in a ribbon that opens to the right of the toolbar. */
.fog-ribbon {
  background: rgba(25, 28, 29, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 6px;
  padding: 7px;
}

.fog-ribbon .tool-button {
  width: 38px;
}

.tool-button:disabled {
  cursor: default;
  opacity: 0.4;
}

.tool-button {
  align-items: center;
  aspect-ratio: 1;
  display: grid;
  justify-items: center;
  min-height: 0;
  padding: 0;
}

.tool-button svg {
  fill: none;
  height: 21px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 21px;
}

.tool-button.active {
  background: #263635;
  border-color: var(--accent-2);
  color: #c6fff1;
}

.player-toggles {
  background: rgba(25, 28, 29, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px;
  width: 96px;
}

.toggle-chip {
  align-items: center;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: 0.82rem;
  gap: 8px;
  padding: 3px 4px;
}

.toggle-chip input {
  accent-color: var(--accent);
}

/* Line-of-sight options block (brightness + reset), shown under the LoS toggle. Matches the
   player-toggles panel so it reads as part of the same control group. */
.los-options {
  background: rgba(25, 28, 29, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding: 7px;
  width: 96px;
}

.los-options label {
  display: flex;
  flex-direction: column;
  font-size: 0.74rem;
  gap: 4px;
  line-height: 1.25;
}

.los-options input[type="range"] {
  accent-color: var(--accent);
  width: 100%;
}

.los-options button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.74rem;
  padding: 5px 6px;
  width: 100%;
}

.los-options button:hover {
  border-color: var(--accent);
}

.tool-popover {
  background: rgba(25, 28, 29, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 12px;
  min-width: 230px;
  max-width: 260px;
  padding: 12px;
}

/* Keep long hint text from stretching the grid-auto-sized popover. */
.tool-popover .hint {
  max-width: 236px;
}

.tool-popover h2 {
  font-size: 0.9rem;
}

.tool-popover input[type="text"],
.tool-popover select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 34px;
  padding: 0 10px;
}

#measureCalibrateRow {
  display: grid;
  gap: 8px;
}

/* A field (label/slider) paired with a small action button to its right. */
.field-with-action {
  align-items: end;
  display: flex;
  gap: 8px;
}

.field-with-action label {
  flex: 1;
}

.field-with-action .calib-label {
  color: var(--muted);
  flex: 1;
  font-size: 0.83rem;
}

.mini-btn {
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  flex: none;
  height: 34px;
  justify-content: center;
  min-height: 0;
  padding: 0;
  width: 34px;
}

.mini-btn:hover {
  border-color: #52605e;
}

.mini-btn svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

.mini-btn.active {
  background: #263635;
  border-color: var(--accent-2);
  color: #c6fff1;
}

.token-image-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.token-image-row .inline-loader {
  flex: 1;
}

.token-image-preview {
  border: 1px solid var(--line);
  border-radius: 50%;
  height: 36px;
  object-fit: cover;
  width: 36px;
}

.player-fullscreen {
  align-items: center;
  background: rgba(25, 28, 29, 0.6);
  border: 1px solid rgba(120, 130, 130, 0.4);
  border-radius: 8px;
  color: var(--text);
  display: none;
  height: 40px;
  justify-content: center;
  opacity: 0.35;
  position: absolute;
  right: 16px;
  top: 16px;
  transition: opacity 150ms ease;
  width: 40px;
  z-index: 7;
}

.player-fullscreen:hover {
  opacity: 1;
}

.player-fullscreen svg {
  fill: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 20px;
}

.app-shell[data-role="player"] .player-fullscreen {
  display: flex;
  opacity: 0;
  pointer-events: none;
}

/* Reveal the fullscreen button alongside the cursor (on mouse movement). */
.app-shell[data-role="player"].cursor-active .player-fullscreen {
  opacity: 0.55;
  pointer-events: auto;
}

.app-shell[data-role="player"].cursor-active .player-fullscreen:hover {
  opacity: 1;
}

/* Follow-party toggle: persistent (not cursor-gated) so it's reachable on touch, where
   there's no mouse movement to reveal a cursor-active control. Bottom-right, clear of the
   top-right fullscreen/roster cluster. */
.player-follow {
  align-items: center;
  background: rgba(25, 28, 29, 0.6);
  border: 1px solid rgba(120, 130, 130, 0.4);
  border-radius: 8px;
  color: var(--text);
  display: none;
  height: 48px;
  justify-content: center;
  position: absolute;
  left: 16px;
  top: 16px;
  transition: opacity 150ms ease, background 150ms ease, border-color 150ms ease;
  width: 48px;
  z-index: 7;
}

.player-follow svg {
  fill: none;
  height: 24px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 24px;
}

.app-shell[data-role="player"] .player-follow {
  display: flex;
  opacity: 0.55;
}

.app-shell[data-role="player"] .player-follow:hover {
  opacity: 1;
}

/* Active = follow-camera engaged. Lit accent so the state is obvious at a glance. */
.player-follow.active {
  background: var(--brand);
  border-color: transparent;
  color: var(--on-brand);
  opacity: 1;
}

/* Touch d-pad: one cell per tap. Bottom-right (clear of follow=top-left, roster/fullscreen=
   top-right, initiative=bottom-left). 3x3 grid placing the arrows in a cross; empty cells fall
   through to the canvas. Shown only on the player view. */
.player-dpad {
  display: none;
  gap: 4px;
  grid-template-columns: repeat(3, 46px);
  grid-template-rows: repeat(3, 46px);
  bottom: 24px;
  position: absolute;
  right: 20px;
  z-index: 7;
}

.app-shell[data-role="player"] .player-dpad {
  display: grid;
}

.dpad-btn {
  align-items: center;
  background: rgba(25, 28, 29, 0.6);
  border: 1px solid rgba(120, 130, 130, 0.4);
  border-radius: 8px;
  color: var(--text);
  display: flex;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 120ms ease, background 120ms ease;
}

.dpad-btn:active {
  background: var(--brand);
  color: var(--on-brand);
  opacity: 1;
}

.dpad-btn svg {
  fill: none;
  height: 22px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 22px;
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

/* ---- Top-right stage widgets (initiative toggle + floor nav) ---- */
.stage-top-right {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 6;
}

.app-shell[data-role="player"] .stage-top-right {
  display: none;
}

.floor-overlay {
  background: rgba(25, 28, 29, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  max-height: 46vh;
  max-width: 200px;
  min-width: 132px;
  overflow-y: auto;
  padding: 8px 10px;
}

.floor-ov-head {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.floor-ov-title {
  color: var(--accent);
  flex: 1;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.floor-ov-btn {
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.7rem;
  height: 22px;
  justify-content: center;
  line-height: 1;
  min-height: 0;
  padding: 0;
  width: 22px;
}

.floor-ov-btn:hover:not(:disabled) {
  border-color: var(--accent-2);
  color: #c6fff1;
}

.floor-ov-btn:disabled {
  cursor: default;
  opacity: 0.3;
}

.floor-ov-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.floor-ov-list li {
  align-items: center;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  font-size: 0.82rem;
  gap: 8px;
  padding: 4px 8px;
}

.floor-ov-list li:hover {
  background: var(--panel-2);
}

.floor-ov-list li.current {
  background: color-mix(in srgb, var(--brand-bright) 18%, transparent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.floor-ov-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floor-ov-reorder {
  display: inline-flex;
  flex-shrink: 0;
  gap: 2px;
}

.floor-ov-move {
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.55rem;
  height: 18px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 18px;
}

.floor-ov-move:hover:not(:disabled) {
  border-color: var(--accent-2);
  color: #c6fff1;
}

.floor-ov-move:disabled {
  cursor: default;
  opacity: 0.25;
}

.floor-ov-count {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  flex: none;
  font-size: 0.74rem;
  font-weight: 700;
  gap: 4px;
}

.floor-ov-dot {
  background: #6fb6f2;
  border-radius: 50%;
  flex: none;
  height: 8px;
  width: 8px;
}

.floor-ov-tv {
  align-items: center;
  color: var(--brand-bright);
  display: inline-flex;
  flex: none;
}

.floor-ov-tv svg {
  fill: none;
  height: 14px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 14px;
}

.floor-ov-list li.on-table {
  box-shadow: inset 2px 0 0 var(--brand-bright);
}

.floor-ov-list li.current.on-table {
  box-shadow: inset 0 0 0 1px var(--accent), inset 2px 0 0 var(--brand-bright);
}

/* ---- Player floor badge ---- */
.player-floor-badge {
  background: rgba(6, 2, 28, 0.82);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.4;
  max-width: 280px;
  padding: 6px 11px;
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 6;
}

.player-floor-badge .pfb-label {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.player-floor-badge em {
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
}

.player-party-roster {
  background: rgba(6, 2, 28, 0.86);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.8rem;
  max-width: 240px;
  min-width: 150px;
  padding: 8px 11px;
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 6;
}
.player-party-roster .ppr-head {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.player-party-roster ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.player-party-roster li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 7px;
}
.player-party-roster .ppr-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-party-roster .ppr-hp {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.player-party-roster .ppr-bar {
  grid-column: 1 / -1;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
}
.player-party-roster .ppr-bar span {
  display: block;
  height: 100%;
}

/* GM fast-switch: accent the control while roaming so it's obvious the table isn't following. */
#mapJump.roaming {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ---- Floor panel controls in sidebar ---- */
.floor-add-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.floor-add-row .ghost-button {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 0 8px;
}

.floor-add-row svg {
  fill: none;
  flex-shrink: 0;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 16px;
}

.floor-table-sync {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 8px;
}

.floor-table-sync .ghost-button {
  align-items: center;
  display: flex;
  gap: 6px;
}

.floor-table-sync .ghost-button svg {
  fill: none;
  flex-shrink: 0;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 16px;
}

.floor-table-sync .ghost-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.pin-toggle {
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: row;
  font-size: 0.82rem;
  gap: 6px;
}

.pin-toggle input {
  margin: 0;
}

.danger-button {
  background: transparent;
  border-color: rgba(214, 106, 95, 0.45);
  color: var(--danger);
}

.danger-button:hover:not(:disabled) {
  background: rgba(214, 106, 95, 0.1);
  border-color: var(--danger);
}

.danger-button:disabled {
  cursor: default;
  opacity: 0.35;
}

.hint-inline {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.name-dialog select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 38px;
  padding: 0 10px;
  width: 100%;
}

#floorName {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 34px;
  padding: 0 10px;
  width: 100%;
}

#battlemap {
  display: block;
  height: 100%;
  width: 100%;
}

.empty-state {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
  inset: 0;
  justify-content: center;
  pointer-events: none;
  position: absolute;
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 1.1rem;
}

.empty-state.hidden {
  display: none;
}

.library-dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  max-width: 820px;
  padding: 0;
  width: min(94vw, 820px);
}

.library-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.name-dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 0;
  width: min(92vw, 360px);
}

.name-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.name-dialog form {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 18px;
}

.name-dialog h2 {
  font-size: 1rem;
}

.name-dialog input[type="text"] {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 40px;
  padding: 0 12px;
  width: 100%;
}

.name-dialog-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.name-dialog-actions .save-btn {
  background: var(--brand);
  border-color: transparent;
  color: var(--on-brand);
  font-weight: 750;
}

.invite-code {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 2.4rem;
  font-weight: 750;
  letter-spacing: 0.18em;
  padding: 16px 12px;
  text-align: center;
}

.invite-url {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: monospace;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  padding: 8px 12px;
  text-align: center;
}

/* The whole form is the bounded scroll region, mirroring .token-palette-flyout. The head
   stays put (sticky) while the grid scrolls under it. */
.library-dialog form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  max-height: 85vh;
  overflow-y: auto;
  padding: 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--brand) transparent;
}

.library-dialog form::-webkit-scrollbar {
  width: 10px;
}

.library-dialog form::-webkit-scrollbar-thumb {
  background: var(--brand);
  border-radius: 5px;
}

.library-dialog form::-webkit-scrollbar-thumb:hover {
  background: var(--brand-bright);
}

.dialog-head {
  align-items: center;
  background: var(--panel);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  position: sticky;
  top: -18px;
  z-index: 1;
}

.library-head-tools {
  align-items: center;
  display: flex;
  gap: 12px;
}

.library-head-tools input[type="range"] {
  width: 120px;
}

/* Cloned from .palette-grid: columns sized by a CSS var the zoom slider drives. */
.saved-map-list {
  --map-thumb: 220px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(var(--map-thumb), 1fr));
}

/* Cloned from .palette-entry — note: NO overflow:hidden on the card, so names never clip. */
.map-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

/* Cloned from .palette-thumb — the rounding/overflow lives HERE, on the image tile only. */
.map-card-thumb {
  aspect-ratio: 4 / 3;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
}

.map-card:hover .map-card-thumb {
  border-color: var(--brand);
}

.map-card-thumb img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.map-card-thumb.empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.8rem;
  justify-content: center;
}

.map-card-name {
  color: var(--text);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.map-card-meta {
  color: var(--muted);
  font-size: 0.72rem;
}

.map-card-delete {
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: 1rem;
  height: 24px;
  justify-content: center;
  line-height: 1;
  opacity: 0;
  position: absolute;
  right: 6px;
  top: 6px;
  transition: opacity 0.12s ease;
  width: 24px;
  z-index: 2;
}

.map-card:hover .map-card-delete {
  opacity: 1;
}

.map-card-delete:hover {
  background: var(--brand);
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 45vh) 1fr;
  }

  .gm-panel {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    order: 2;
    padding: 16px;
  }

  .stage-wrap {
    height: auto;
    min-height: 0;
    order: 1;
  }

  .app-shell.has-initiative {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 45vh) 1fr auto;
  }

  .initiative-panel {
    order: 3;
  }

  /* Stacked layout: hide the initiative panel entirely until it's activated, and the
     left-collapse affordance doesn't apply, so keep the panel visible. */
  .app-shell:not(.has-initiative) .initiative-panel {
    display: none;
  }

  .app-shell.panel-collapsed .gm-panel {
    display: none;
  }

  .panel-toggle {
    display: none;
  }
}

/* ----------------------------- initiative tracker ----------------------------- */
.initiative-panel {
  background: #06021c;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px;
}

/* The player display never shows the GM's docked initiative panel. */
.app-shell[data-role="player"] .initiative-panel {
  display: none;
}

.init-head {
  align-items: center;
  display: flex;
  gap: 10px;
}

.init-head h2 {
  flex: 1;
  font-size: 1rem;
  margin: 0;
}

.init-close {
  align-items: center;
  background: none;
  border: 0;
  color: var(--muted);
  display: flex;
  justify-content: center;
  min-height: 0;
  padding: 0;
  width: 26px;
}

.init-close:hover {
  background: none;
  border: 0;
  color: var(--text);
}

.init-close svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

.init-round {
  align-items: center;
  display: flex;
  gap: 8px;
}

.init-round span {
  color: var(--accent);
  flex: 1;
  font-weight: 700;
  text-align: center;
}

.init-round button {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 34px;
  padding: 0 8px;
}

.init-round button svg {
  fill: none;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 16px;
}

.init-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.init-row {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 8px;
}

.init-row.current {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.init-row-top {
  align-items: center;
  display: flex;
  gap: 8px;
}

.init-dot {
  border-radius: 50%;
  flex: none;
  height: 10px;
  width: 10px;
}

.init-dot.player {
  background: #6fb6f2;
}

.init-dot.npc {
  background: #c7b15a;
}

.init-dot.monster {
  background: #d66a5f;
}

.init-name {
  background: none;
  border: 0;
  color: var(--text);
  cursor: pointer;
  flex: 1;
  font-weight: 600;
  min-height: 0;
  overflow: hidden;
  padding: 2px 0;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.init-name:hover {
  background: none;
  border: 0;
  color: var(--accent);
}

.init-init {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--accent);
  font-weight: 700;
  min-height: 0;
  padding: 3px;
  text-align: center;
  width: 42px;
}

.init-remove {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  min-height: 0;
  padding: 0 4px;
}

.init-remove:hover {
  background: none;
  border: 0;
  color: var(--danger);
}

.init-hp-line {
  align-items: center;
  display: flex;
  gap: 6px;
}

.init-hp-step {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  min-height: 0;
  padding: 2px 7px;
}

.init-hp-bar {
  background: rgba(214, 106, 95, 0.18);
  border-radius: 4px;
  flex: 1;
  height: 8px;
  overflow: hidden;
}

.init-hp-bar span {
  background: var(--brand-bright);
  display: block;
  height: 100%;
}

.init-hp-input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  min-height: 0;
  padding: 3px;
  text-align: center;
  width: 48px;
}

.init-hp-max {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.init-add {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}

.init-add input,
.init-add select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  min-height: 36px;
  padding: 0 10px;
}

.init-add-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr 1.2fr;
}

.init-add button[type="submit"] {
  background: var(--brand);
  border-color: transparent;
  color: var(--on-brand);
  font-weight: 700;
}

/* Floating turn-order overlay on the map (GM always; player when shared). */
.initiative-overlay {
  background: rgba(6, 2, 28, 0.86);
  border: 1px solid var(--line);
  border-radius: 10px;
  bottom: 16px;
  color: var(--text);
  left: 16px;
  max-height: 46vh;
  max-width: 240px;
  min-width: 170px;
  overflow-y: auto;
  padding: 10px 12px;
  position: absolute;
  z-index: 6;
}

.init-ov-round {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

/* Overlay header with round label + turn arrows (GM only). */
.init-ov-head {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.init-ov-head .init-ov-round {
  flex: 1;
  margin: 0;
}

.init-ov-btn {
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: 1rem;
  height: 22px;
  justify-content: center;
  line-height: 1;
  min-height: 0;
  padding: 0;
  width: 22px;
}

.init-ov-btn:hover {
  border-color: var(--accent-2);
  color: #c6fff1;
}

/* GM panel: the two order-overlay visibility switches. */
.init-visibility {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.init-visibility .label {
  color: var(--muted);
  font-size: 0.82rem;
}

.initiative-overlay ol {
  display: flex;
  flex-direction: column;
  gap: 3px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.initiative-overlay li {
  align-items: center;
  border-radius: 6px;
  display: flex;
  gap: 8px;
  padding: 4px 8px;
}

.initiative-overlay li.current {
  background: color-mix(in srgb, var(--brand-bright) 18%, transparent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.initiative-overlay .init-ov-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.initiative-overlay em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

/* ----------------------------- token palette ----------------------------- */
/* A scrollable flyout pinned just right of the token tool popover, inside the stage. Positioned
   against .stage-wrap so it tracks the stage edge through panel-collapse and initiative changes. */
.token-palette-flyout {
  position: absolute;
  top: 14px;
  left: 288px; /* clears the 14px-left tool popover column (max-width 260px) + a small gap */
  width: 248px;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  z-index: 6;
  background: rgba(25, 28, 29, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.palette-head {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  background: rgba(25, 28, 29, 0.94);
  z-index: 1;
}
.palette-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.palette-head-row input[type="range"] {
  width: 84px;
}
.palette-head h3 {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.palette-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.palette-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: inherit;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.74rem;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}
.palette-btn:hover {
  border-color: var(--accent);
}
.palette-btn.danger:hover {
  border-color: #c75c5c;
  color: #e08a8a;
}
.palette-selected {
  display: flex;
  align-items: center;
  gap: 6px;
}
.palette-rename {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.78rem;
}
.palette-grid {
  --palette-thumb: 64px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--palette-thumb), 1fr));
  gap: 8px;
}
.palette-empty {
  grid-column: 1 / -1;
  margin: 0;
}
.palette-entry {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.palette-entry.active .palette-thumb {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.palette-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  overflow: hidden;
  cursor: pointer;
  padding: 0;
}
.palette-thumb:hover {
  border-color: var(--accent-2);
}
.palette-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.palette-name {
  font-size: 0.72rem;
  text-align: center;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent-2);
}

/* Token status conditions — toggle grid in the selected-token panel (5e). */
.condition-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.condition-heading {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.condition-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
  gap: 4px;
}
.condition-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  padding: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.condition-btn svg {
  width: 76%;
  height: 76%;
}
.condition-btn svg path {
  fill: none;
  stroke: var(--cond, var(--muted));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
}
.condition-btn:hover {
  border-color: var(--muted);
}
.condition-btn.active {
  border-color: var(--cond, var(--accent));
  background: color-mix(in srgb, var(--cond, var(--accent)) 20%, var(--panel-2));
}
.condition-btn.active svg path {
  opacity: 1;
}
.maplink-field {
  display: grid;
  gap: 6px;
}
.maplink-field-label {
  font-size: 0.85rem;
  color: var(--muted);
}
.maplink-icon-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.maplink-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  padding: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.maplink-icon-btn svg {
  width: 70%;
  height: 70%;
}
.maplink-icon-btn svg path {
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.maplink-icon-btn:hover {
  border-color: var(--muted);
}
.maplink-icon-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, var(--panel-2));
}
.maplink-icon-btn.active svg path {
  stroke: var(--accent);
}
/* Map-kind capability gates (chunk 3): a world/town map hides floors + initiative chrome.
   display:none !important overrides the live show/hide logic without touching it. */
body.cap-no-floors #floorsSection,
body.cap-no-floors #floorOverlay,
body.cap-no-floors #stairMode {
  display: none !important;
}
body.cap-no-initiative #initiativePanel,
body.cap-no-initiative #initiativeOverlay,
body.cap-no-initiative #initToggle {
  display: none !important;
}
.world-only {
  display: none;
}
body.cap-no-initiative .world-only {
  display: block;
}
.scale-cal {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.scale-cal button {
  width: 100%;
}
.scale-cal-fields {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.scale-cal-fields input#scaleDist {
  width: 64px;
}
.condition-extras {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.exhaustion-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.exhaustion-stepper button {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.exhaustion-stepper button:hover {
  border-color: var(--muted);
}
.exhaustion-stepper #tokenSelExhVal {
  min-width: 12px;
  text-align: center;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.down-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
