:root {
  color-scheme: dark;
  --bg-0: #090b0d;
  --bg-1: #12100d;
  --bg-2: #1d1812;
  --panel: rgba(19, 15, 12, 0.84);
  --panel-strong: rgba(14, 11, 9, 0.92);
  --panel-soft: rgba(24, 19, 15, 0.72);
  --line: rgba(255, 189, 84, 0.12);
  --line-strong: rgba(255, 204, 116, 0.28);
  --text: #e8dcc0;
  --muted: #d2c09a;
  --amber: #ffbe54;
  --amber-soft: #d9a24e;
  --red: #d35f4f;
  --blue: #6da4d9;
  --green: #b7d182;
  --danger: #ff9e86;
  --shadow: 0 14px 42px rgba(0, 0, 0, 0.28);
  --game-font: "Walter Turncoat", Tahoma, Verdana, Geneva, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, #18130f 0%, #090b0d 100%);
  color: var(--text);
  font-family: var(--game-font);
  /* no pull-to-refresh / rubber-band scrolling over the game */
  overscroll-behavior: none;
}

body {
  overflow: hidden;
  /* suppress double-tap zoom on iOS/Android; elements needing full gesture
     ownership (canvas, sticks, buttons) set touch-action: none themselves */
  touch-action: manipulation;
}

body.connection-lost-active {
  cursor: wait;
}

body.connection-lost-active > :not(#connection-lost-modal) {
  filter: grayscale(1);
  pointer-events: none !important;
  user-select: none;
  -webkit-user-select: none;
}

body.mobile-controls-active {
  user-select: none;
  -webkit-user-select: none;
}

body.preview-page {
  overflow: auto;
}

body.test-avatar-page {
  overflow: hidden;
  background: #16181a;
}

body.library-page {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(8, 145, 178, 0.13), transparent 42%),
    #06090a;
}

canvas {
  display: block;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* Gameplay disables selection at the body and HUD layers. A modal is a
   document surface: all of its text must remain selectable without each new
   dialog needing its own exception. */
[role="dialog"][aria-modal="true"],
[role="dialog"][aria-modal="true"] * {
  user-select: text;
  -webkit-user-select: text;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

input,
select,
button,
textarea {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(17, 13, 10, 0.9);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 2px;
}

input[type="range"] {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 189, 84, 0.2);
  background: linear-gradient(90deg, rgba(255, 189, 84, 0.4), rgba(255, 214, 130, 0.82));
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 130, 0.6);
  background: #f3d08a;
  box-shadow: 0 0 12px rgba(255, 214, 130, 0.3);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 189, 84, 0.2);
  background: linear-gradient(90deg, rgba(255, 189, 84, 0.4), rgba(255, 214, 130, 0.82));
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 214, 130, 0.6);
  border-radius: 999px;
  background: #f3d08a;
  box-shadow: 0 0 12px rgba(255, 214, 130, 0.3);
}

select {
  width: 100%;
  padding-right: 34px;
  cursor: pointer;
  background: transparent;
  border: 0;
}

input::placeholder {
  color: rgba(232, 220, 192, 0.44);
}

canvas.choosing-entity {
  cursor: crosshair;
}

.choose-entity-hint {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 190;
  transform: translateX(-50%);
  padding: 9px 14px;
  border: 1px solid rgba(103, 232, 249, 0.5);
  border-radius: 999px;
  background: rgba(5, 15, 18, 0.9);
  color: #a5f3fc;
  font-size: 13px;
  font-weight: 900;
  pointer-events: none;
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.2);
}

input:focus,
select:focus,
button:focus {
  outline: 1px solid var(--line-strong);
  outline-offset: 1px;
}

#ui {
  position: fixed;
  inset: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  width: auto;
  z-index: 50;
  max-height: none;
  overflow: hidden;
  padding: 18px 88px 18px 18px;
  pointer-events: none;
  user-select: text;
  -webkit-user-select: text;
}

#ui.hidden {
  display: none;
}

[hidden] {
  display: none !important;
}

#connection-lost-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.46);
  pointer-events: auto;
  touch-action: none;
}

.connection-lost-panel {
  width: min(360px, 100%);
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
}

#connection-lost-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

#ui.intro-active {
  inset: 0;
  width: auto;
  max-height: none;
  overflow: hidden;
  padding: 0;
}

#ui>.menu-shell {
  width: min(1040px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  pointer-events: auto;
}

#ui.intro-active>.menu-shell {
  width: 100%;
  max-height: none;
  overflow: visible;
}

.menu-shell {
  width: 100%;
}

.intro-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.intro-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 18px;
  padding: 26px;
  border: 1px solid rgba(255, 189, 84, 0.18);
  background: rgba(14, 11, 9, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(7px);
  pointer-events: auto;
}

.intro-logo {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 4px 0 8px;
  text-align: center;
}

.intro-logo-mark {
  width: min(340px, 78vw);
  max-height: 260px;
  display: block;
  object-fit: contain;
}

.intro-logo-name {
  color: var(--text);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.intro-name-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.intro-name-row input {
  width: 100%;
  min-height: 48px;
  font-size: 17px;
}

.intro-start-button {
  white-space: nowrap;
  min-height: 50px;
}

.intro-game-info {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.intro-info-item {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 189, 84, 0.1);
}

.intro-info-item span {
  color: var(--amber);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro-info-item strong {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.menu-window,
.panel-window,
.status-card,
.scoreboard-card,
.preview-nav {
  border: 1px solid var(--line);
  background: rgba(14, 11, 9, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.menu-window {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.lobby-window {
  gap: 12px;
}

.room-loading-window {
  min-width: min(420px, calc(100vw - 32px));
  justify-items: center;
  text-align: center;
}

.room-loading-copy {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.room-full-state {
  display: grid;
  gap: 10px;
}

.room-full-message {
  padding: 10px 12px;
  border: 1px solid rgba(255, 189, 84, 0.34);
  background: rgba(255, 189, 84, 0.1);
  color: var(--amber);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.lobby-tab-stack {
  --lobby-tab-active-bg: #e0b85b22;
  --lobby-tab-active-border: rgba(255, 214, 130, 0.36);
  display: block;
  width: 100%;
}

.lobby-tabs {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 0;
  position: relative;
  z-index: 1;
}

.lobby-tab {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 14px;
  background: rgba(24, 18, 13, 0.88);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-transform: uppercase;
  user-select: none;
}

.lobby-tab:hover {
  background: rgba(36, 26, 18, 0.96);
}

.lobby-tab[aria-selected="true"] {
  background: var(--lobby-tab-active-bg);
}

.lobby-tab-panel {
  width: 100%;
  min-width: 0;
  padding: 14px;
  background: var(--lobby-tab-active-bg);
}

.menu-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 1px solid rgba(255, 189, 84, 0.08);
  padding-bottom: 12px;
}

.menu-header.compact {
  gap: 12px;
  padding-bottom: 10px;
}

.menu-header.dismissible {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.menu-header.dismissible .controls-copy,
.menu-header.dismissible .lobby-summary {
  grid-column: 1 / -1;
  justify-self: stretch;
}

.menu-header-actions,
.leaderboard-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.room-state-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border-bottom: 1px solid rgba(255, 189, 84, 0.08);
  padding-bottom: 12px;
}

.room-state-title-group {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.room-state-user {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-state-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.menu-close-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 8px;
  color: var(--text);
  background: rgba(20, 16, 13, 0.94);
  font-weight: 800;
  line-height: 1;
}

.compact-action {
  min-height: 36px;
  padding: 0 12px;
  font-size: 11px;
}

.menu-title-group {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.section-kicker,
.scoreboard-kicker,
.field-label,
.score-label,
.browser-head,
.vote-lock,
.score-self {
  color: var(--amber);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-title-main,
.status-card-title,
.panel-title,
.scoreboard-title,
.vote-panel-title {
  margin: 0;
  font-weight: 700;
}

.menu-title-main {
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.controls-copy {
  max-width: 360px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: right;
}

.controls-copy.compact {
  max-width: 300px;
}

.lobby-summary {
  max-width: 560px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
  text-align: right;
}

.lobby-summary.compact {
  max-width: 520px;
}

.lobby-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
}

.lobby-sidebar {
  display: grid;
  align-content: start;
  gap: 12px;
  padding-right: 14px;
  border-right: 1px solid rgba(255, 189, 84, 0.08);
}

.lobby-main {
  display: grid;
  gap: 10px;
  align-content: start;
}

.lobby-create-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.lobby-create-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

.room-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

.room-settings-panel {
  align-content: start;
}

.numeric-slider-field {
  min-width: 0;
}

.numeric-slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.numeric-slider-row input[type="range"] {
  width: 100%;
}

.numeric-slider-field.team-red {
  --slider-track-start: rgba(211, 95, 79, 0.42);
  --slider-track-end: rgba(255, 158, 134, 0.86);
  --slider-thumb: #ff9e86;
  --slider-thumb-border: rgba(255, 202, 190, 0.72);
  --slider-glow: rgba(211, 95, 79, 0.32);
}

.numeric-slider-field.team-blue {
  --slider-track-start: rgba(109, 164, 217, 0.42);
  --slider-track-end: rgba(158, 207, 255, 0.86);
  --slider-thumb: #9ecfff;
  --slider-thumb-border: rgba(209, 235, 255, 0.72);
  --slider-glow: rgba(109, 164, 217, 0.32);
}

.numeric-slider-field.team-red input[type="range"]::-webkit-slider-runnable-track,
.numeric-slider-field.team-blue input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, var(--slider-track-start), var(--slider-track-end));
}

.numeric-slider-field.team-red input[type="range"]::-moz-range-track,
.numeric-slider-field.team-blue input[type="range"]::-moz-range-track {
  background: linear-gradient(90deg, var(--slider-track-start), var(--slider-track-end));
}

.numeric-slider-field.team-red input[type="range"]::-webkit-slider-thumb,
.numeric-slider-field.team-blue input[type="range"]::-webkit-slider-thumb {
  border-color: var(--slider-thumb-border);
  background: var(--slider-thumb);
  box-shadow: 0 0 12px var(--slider-glow);
}

.numeric-slider-field.team-red input[type="range"]::-moz-range-thumb,
.numeric-slider-field.team-blue input[type="range"]::-moz-range-thumb {
  border-color: var(--slider-thumb-border);
  background: var(--slider-thumb);
  box-shadow: 0 0 12px var(--slider-glow);
}

.team-bot-fields {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
}

.slider-value-input {
  width: 100%;
  min-width: 0;
  padding: 10px 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 2px;
}

.list-head-copy {
  color: var(--muted);
  font-size: 11px;
}

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

.panel-window,
.status-card {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.panel-window.compact {
  padding: 12px;
  gap: 10px;
}

.room-actions-panel {
  display: flex;
  flex-direction: column;
}

.panel-head,
.status-card-head,
.vote-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.panel-title {
  font-size: 17px;
  color: var(--text);
}

.field-stack {
  display: grid;
  gap: 8px;
}

.check-field {
  display: grid;
  align-content: center;
  gap: 6px;
  color: var(--text);
  line-height: 1.35;
}

.check-field.panel {
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 189, 84, 0.18);
  background: rgba(22, 16, 12, 0.68);
}

.check-field.compact {
  min-height: 22px;
  font-size: 13px;
}

.check-main {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.check-field input[type="checkbox"] {
  position: relative;
  width: 22px;
  height: 22px;
  padding: 0;
  border-color: rgba(255, 214, 130, 0.4);
  background: rgba(9, 7, 5, 0.92);
}

.check-field input[type="checkbox"]:checked {
  border-color: rgba(255, 214, 130, 0.82);
  background: var(--amber);
}

.check-field input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 12px;
  border: solid #17100a;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.check-field input[type="checkbox"]:disabled {
  cursor: default;
  opacity: 0.58;
}

.check-label {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.room-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.room-name-field {
  min-width: 0;
}

.select-shell {
  position: relative;
  display: grid;
  align-items: center;
  border: 1px solid rgba(255, 189, 84, 0.24);
  background: linear-gradient(180deg, rgba(29, 22, 16, 0.96), rgba(15, 11, 8, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 189, 84, 0.06);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.select-shell:hover {
  border-color: rgba(255, 189, 84, 0.34);
}

.select-shell:focus-within {
  border-color: rgba(255, 214, 130, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 214, 130, 0.14);
  background: linear-gradient(180deg, rgba(34, 25, 19, 0.98), rgba(17, 13, 10, 0.98));
}

.select-shell select {
  padding-right: 52px;
  font-weight: 600;
}

.select-arrow {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 38px;
  display: grid;
  place-items: center;
  border-left: 1px solid rgba(255, 189, 84, 0.18);
  background: rgba(255, 189, 84, 0.06);
  color: var(--amber);
  font-size: 12px;
  pointer-events: none;
}

.field-note,
.scoreboard-subtitle,
.status-stat span,
.score-team-meta,
.vote-status-copy,
.vote-footnote,
.summary-map {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.field-note.compact {
  font-size: 11px;
  line-height: 1.35;
}

.menu-button {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(20, 16, 13, 0.94);
}

.menu-button:hover:not(:disabled),
.vote-option:hover:not(:disabled) {
  filter: brightness(1.1);
}

.menu-button:disabled,
.vote-option:disabled {
  cursor: default;
  opacity: 0.62;
}

.menu-button.amber {
  color: #1f1206;
  background: #e0b85b;
  border-color: rgba(255, 214, 130, 0.3);
}

.menu-button.steel {
  background: rgba(29, 23, 19, 0.94);
  color: var(--text);
}

.menu-button.danger {
  background: rgba(122, 53, 43, 0.95);
  color: #ffe7de;
  border-color: rgba(211, 95, 79, 0.32);
}

.menu-button.team-button.red {
  background: rgba(122, 53, 43, 0.95);
  color: #ffe7de;
}

.menu-button.team-button.blue {
  background: rgba(59, 88, 122, 0.95);
  color: #e6f2ff;
}

.menu-button.recommended {
  border-color: rgba(255, 224, 164, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 224, 164, 0.2);
}

.create-room-button {
  display: grid;
  gap: 4px;
  justify-items: center;
  line-height: 1.15;
}

.menu-button-note {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
  text-transform: none;
}

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

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

.room-team-actions .menu-button {
  min-height: 68px;
}

.server-browser {
  display: grid;
  gap: 0;
  border-block: 1px solid rgba(255, 189, 84, 0.08);
  background: transparent;
}

.browser-row {
  display: grid;
  grid-template-columns: minmax(0, 180px) minmax(120px, 1fr) minmax(118px, max-content) 80px 104px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  text-align: left;
}

.browser-head {
  border-bottom: 1px solid rgba(255, 189, 84, 0.08);
  background: rgba(255, 189, 84, 0.02);
}

.browser-entry {
  width: 100%;
  border-top: 1px solid rgba(255, 189, 84, 0.08);
  background: rgba(45, 32, 22, 0.96);
  border-inline: 0;
  border-bottom: 0;
  border-radius: 0;
  color: inherit;
  cursor: pointer;
  transition: none;
}

.browser-entry:hover:not(:disabled) {
  background: rgba(45, 32, 22, 0.8);
  outline: 1px solid rgba(255, 214, 130, 1);
  position: relative;
  z-index: 5;
}

.browser-entry:active:not(:disabled) {
  background: black;
}

.browser-entry:disabled {
  cursor: default;
  opacity: 0.62;
}

.browser-room-name {
  min-width: 0;
  color: white;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-data {
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browser-player-count {
  overflow: visible;
  text-overflow: clip;
}

.browser-room-score {
  color: var(--muted);
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.browser-team-score {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.browser-team-score-side.red {
  color: #ffb3a6;
}

.browser-team-score-side.blue {
  color: #cae6ff;
}

.browser-team-score-separator {
  color: var(--muted);
}

.status-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}

.room-summary-strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px 12px;
  padding: 4px 0 10px;
  border-bottom: 1px solid rgba(255, 189, 84, 0.08);
}

.room-summary-item {
  display: grid;
  gap: 4px;
}

.room-summary-item span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.room-summary-item strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.status-stat {
  display: grid;
  gap: 4px;
}

.status-stat strong {
  color: var(--text);
  font-size: 14px;
}

.result-badge {
  align-self: flex-start;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: rgba(13, 11, 8, 0.48);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--amber);
}

.result-badge.red {
  border-color: rgba(211, 95, 79, 0.38);
  color: #ffc2b7;
}

.result-badge.blue {
  border-color: rgba(109, 164, 217, 0.38);
  color: #d6ecff;
}

.result-badge.neutral {
  color: #f0dcaf;
}

#summary,
#score-strip,
#hud,
#pickup-prompt,
#settings-panel,
#settings-toggle,
#mechanics-toggle,
#mechanics-panel,
.killfeed-entry {
  border: 1px solid var(--line);
  background: rgba(14, 11, 9, 0.72);
  color: var(--text);
  backdrop-filter: blur(5px);
  box-shadow: var(--shadow);
}

#summary {
  position: fixed;
  inset: 18px auto auto 18px;
  z-index: 20;
  display: grid;
  gap: 3px;
  min-width: 190px;
  max-width: min(280px, calc(100vw - 36px));
  padding: 11px 34px 12px 12px;
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

#summary>* {
  pointer-events: none;
}

.summary-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-map,
.summary-total {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
}

.summary-expand {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--amber);
  border-bottom: 2px solid var(--amber);
  opacity: 0.82;
  transform: rotate(-45deg);
}

.summary-name.red,
.killfeed-entry .red,
.score-team.red .score-team-title,
.score-team.red .score-team-total {
  color: #ffb3a6;
}

.summary-name.blue,
.killfeed-entry .blue,
.score-team.blue .score-team-title,
.score-team.blue .score-team-total {
  color: #cae6ff;
}

.score-team.red .score-team-badge {
  background: rgba(217, 92, 79, 0.08);
}

.score-team.blue .score-team-badge {
  background: rgba(79, 126, 217, 0.08);
}

.score-team.red .score-player-name,
.score-team.red .score-value {
  color: #ffb3a6;
}

.score-team.blue .score-player-name,
.score-team.blue .score-value {
  color: #cae6ff;
}

#score-strip {
  position: fixed;
  inset: 18px auto auto 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 18px;
  align-items: center;
  padding: 10px 16px;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

#score-strip .score-side {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

#score-strip .score-center {
  color: var(--amber);
  min-width: 52px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#score-strip .red {
  color: #ffb3a6;
}

#score-strip .blue {
  color: #cae6ff;
}

#mechanics-ui {
  position: fixed;
  inset: 18px 18px auto auto;
  z-index: 90;
  display: none;
  justify-items: end;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.top-right-actions {
  display: grid;
  justify-content: flex-end;
  justify-items: end;
  gap: 8px;
  pointer-events: auto;
}

#mechanics-toggle,
#mechanics-panel {
  pointer-events: auto;
}

#mechanics-toggle {
  width: auto;
  min-width: 132px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 214, 130, 0.18), transparent 52%),
    rgba(14, 11, 9, 0.84);
  color: var(--amber);
  line-height: 1;
}

.mechanics-toggle-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

#mechanics-toggle {
  position: fixed;
  right: 18px;
  bottom: 50px;
}

#mechanics-toggle:hover,
#mechanics-toggle[aria-expanded="true"] {
  border-color: rgba(255, 214, 130, 0.5);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 214, 130, 0.24), transparent 52%),
    rgba(23, 18, 13, 0.92);
}

#mechanics-panel {
  position: fixed;
  top: 60px;
  left: 50%;
  z-index: 120;
  width: min(856px, calc(100vw - 120px));
  max-height: calc(100vh - 120px);
  transform: translateX(-50%);
  display: none;
  align-content: start;
  justify-items: center;
  gap: 20px;
  overflow: auto;
  padding: 34px 28px;
  backdrop-filter: blur(25px);
}

#mechanics-panel.visible {
  display: grid;
}

#top-controls {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: calc(14px + env(safe-area-inset-left));
  z-index: 80;
  display: grid;
  justify-items: start;
  gap: 6px;
  width: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

#settings-ui,
#actions-ui {
  position: relative;
  pointer-events: none;
  display: grid;
  justify-items: start;
  gap: 6px;
}

.actions-shell {
  position: relative;
  pointer-events: auto;
}

.actions-shell.open {
  z-index: 1;
}

.actions-toggle {
  width: auto;
  min-width: 126px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 214, 130, 0.16), transparent 52%),
    rgba(14, 11, 9, 0.84);
  color: var(--amber);
  pointer-events: auto;
}

.actions-toggle:hover,
.actions-toggle[aria-expanded="true"] {
  border-color: rgba(255, 214, 130, 0.5);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 214, 130, 0.24), transparent 52%),
    rgba(23, 18, 13, 0.92);
}

.actions-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: auto;
  left: 0;
  --game-action-align: left;
  --game-action-justify: flex-start;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.game-actions-surface,
.overhead-panel.expanded.explicit {
  box-sizing: border-box;
  min-width: 220px;
  padding: 10px;
  border: 0;
  border-radius: 7px;
  background: rgba(45, 37, 31, 0.76);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.game-action {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: var(--game-action-justify, center);
  gap: 6px;
  padding: 6px 10px;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: 16px/1.15 var(--game-font);
  text-align: var(--game-action-align, center);
  white-space: nowrap;
  cursor: pointer;
  text-shadow: 0 0 7px #000;
}

.game-action:hover:not(:disabled),
.game-action:focus-visible:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

.game-action:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.game-action.follow { color: #90ee90; }
.game-action.ask { color: #87ceeb; }
.game-action.force { color: #ffb6c1; }
.game-action.trade { color: #ffd58a; }

.keyboard-shortcut {
  flex: 0 0 auto;
  display: inline-flex;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-bottom-color: rgba(255, 255, 255, 0.34);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.13);
  color: inherit;
  font: 10px/1 var(--game-font);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.42);
  vertical-align: 1px;
}

.online-players-menu {
  min-width: 260px;
}

.online-players-scroll {
  max-height: min(360px, calc(100vh - 120px));
  overflow-y: auto;
}

.online-player + .online-player {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.actions-menu .online-player-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #fff;
  font: 15px/1.2 var(--game-font);
  text-align: left;
  cursor: pointer;
  text-shadow: 0 0 7px #000;
}

.actions-menu .online-player-name:hover:not(:disabled),
.actions-menu .online-player-name:focus-visible:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

.actions-menu .online-player-name:disabled {
  cursor: default;
}

.online-player-actions {
  --game-action-align: left;
  --game-action-justify: flex-start;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 3px 5px 8px 14px;
}

.actions-menu .online-player-actions .game-action {
  font-size: 15px;
}

.location-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 4, 3, 0.56);
  backdrop-filter: blur(8px);
}

.location-modal-card {
  width: min(360px, calc(100vw - 40px));
  padding: 16px;
  border: 1px solid rgba(255, 214, 130, 0.3);
  border-radius: 14px;
  background: rgba(13, 10, 7, 0.96);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.48);
}

.location-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.location-modal-head h2 {
  margin: 0;
  color: var(--amber);
  font-size: 17px;
}

.location-modal-head button {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 22px;
}

.location-details {
  display: grid;
  gap: 7px;
  margin: 16px 0 0;
}

.location-details > div {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
}

.location-details dt {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.location-copy-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 14px 0 0 auto;
  padding: 7px;
  border: 1px solid rgba(255, 214, 130, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--amber);
}

.location-copy-button:hover,
.location-copy-button:focus-visible {
  border-color: rgba(255, 214, 130, 0.55);
  background: rgba(255, 214, 130, 0.12);
}

.location-copy-button svg {
  width: 100%;
  height: 100%;
}

.coordinate-jump-note {
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.coordinate-jump-fields {
  display: grid;
  margin-bottom: 12px;
}

.coordinate-jump-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.coordinate-jump-fields input {
  width: 100%;
  min-width: 0;
}

.coordinate-jump-error {
  margin: -4px 0 10px;
  color: #ff9a87;
  font-size: 12px;
}

.entity-editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 4, 5, 0.7);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

/* The canvas needs to receive placement gestures while the modal stays open. */
.entity-editor-placement-active .entity-editor-backdrop {
  visibility: hidden;
  pointer-events: none;
}

.entity-editor {
  width: min(780px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(103, 232, 249, 0.28);
  border-radius: 16px;
  background: rgba(9, 13, 14, 0.98);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.65), 0 0 60px rgba(34, 211, 238, 0.08);
  user-select: text;
  -webkit-user-select: text;
}

.entity-editor-head,
.entity-editor-actions,
.entity-editor-section {
  padding: 16px 20px;
}

.entity-editor-head,
.entity-editor-section-head,
.entity-editor-actions,
.entity-editor-actions > div,
.entity-component-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.entity-editor-head {
  border-bottom: 1px solid rgba(103, 232, 249, 0.14);
}

.entity-editor-head h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.entity-editor-kicker {
  color: #67e8f9;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.entity-editor-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 24px;
}

.entity-editor-section {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.entity-editor-section.components {
  flex: 1;
  min-height: 150px;
  overflow: auto;
}

.entity-editor-section h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.entity-editor-section-head h3 {
  margin: 0;
}

.entity-editor-section-head select {
  width: auto;
  min-width: 170px;
  border: 1px solid var(--line);
  background: rgba(17, 13, 10, 0.9);
}

.entity-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.entity-editor-grid label {
  display: grid;
  gap: 5px;
}

.entity-editor-grid label.wide {
  grid-column: span 2;
}

.entity-editor-world-readout {
  display: grid;
  gap: 5px;
  grid-column: span 2;
  padding: 9px 10px;
  border: 1px solid rgba(103, 232, 249, 0.14);
  border-radius: 4px;
}

.entity-editor-world-readout span { color: var(--muted); font-size: 11px; font-weight: 800; }
.entity-editor-world-readout strong { color: #cffafe; font-family: ui-monospace, monospace; }

.entity-editor-transform-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.entity-editor-transform-actions button { padding: 7px 10px; }
.entity-editor-transform-actions .subtle { margin-left: auto; color: var(--muted); }

.entity-editor-grid label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.entity-editor-grid input,
.entity-editor-grid select {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
}

.entity-component-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(103, 232, 249, 0.14);
  border-radius: 10px;
  background: rgba(103, 232, 249, 0.035);
}

.entity-component-card strong {
  color: #a5f3fc;
  font-size: 13px;
}

.entity-component-card button {
  padding: 5px 8px;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 11px;
}

.entity-component-card textarea,
.entity-editor-section.components > textarea {
  width: 100%;
  min-height: 110px;
  margin-top: 8px;
  resize: vertical;
  color: #d9f8fb;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.entity-component-card:not(.expanded) { display: inline-flex; width: calc(50% - 7px); margin-right: 10px; vertical-align: top; }
.entity-component-card:not(.expanded) > div { width: 100%; }
.entity-component-toggle { margin-top: 8px; color: #a5f3fc; background: transparent; border: 0; font-size: 11px; }
.entity-component-card.expanded { width: 100%; }

.entity-editor-empty {
  padding: 32px 0 18px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.entity-editor-error,
.entity-editor-submit-error {
  color: var(--danger);
  font-size: 12px;
}

/* ---- entity editor: AI helper ---- */

.entity-assistant {
  border-bottom: 1px solid rgba(103, 232, 249, 0.14);
}

/* A prompt preview or a long diff is taller than the modal, and the component
   list below it is `flex: 1` with a zero basis — so without this the helper
   would absorb every pixel of shrink and its own Apply button would end up
   clipped outside the editor. While it is open it takes the flexible space and
   scrolls itself; the component list falls back to its minimum. */
.entity-assistant:not(.collapsed) {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.entity-assistant:not(.collapsed) ~ .entity-editor-section.components {
  flex: 0 1 auto;
  max-height: 150px;
}

/* Reading a full prompt or a diff is its own mode: hand the modal over to it
   rather than leaving 130 unusable pixels between the request box and Save. */
.entity-editor:has(.entity-assistant-prompt) .entity-editor-section:not(.entity-assistant),
.entity-editor:has(.entity-assistant-proposal) .entity-editor-section:not(.entity-assistant) {
  display: none;
}

.entity-assistant.collapsed {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.entity-assistant-open {
  padding: 8px 13px;
  border: 1px solid rgba(103, 232, 249, 0.3);
  border-radius: 8px;
  background: rgba(103, 232, 249, 0.06);
  color: #a5f3fc;
  font-size: 12px;
  font-weight: 700;
}

.entity-assistant-request {
  width: 100%;
  margin-top: 4px;
  padding: 9px 10px;
  resize: vertical;
  color: #d9f8fb;
  font-size: 13px;
  line-height: 1.45;
}

.entity-assistant-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.entity-assistant-actions button {
  padding: 8px 13px;
}

.entity-assistant-actions .primary {
  border-color: rgba(103, 232, 249, 0.45);
  background: rgba(8, 145, 178, 0.24);
  color: #cffafe;
}

.entity-assistant-applied {
  display: block;
  margin-top: 10px;
  color: #6ee7b7;
  font-size: 12px;
}

.entity-assistant.collapsed .entity-assistant-applied {
  margin-top: 0;
}

.entity-assistant-prompt,
.entity-assistant-proposal {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(103, 232, 249, 0.14);
  border-radius: 10px;
  background: rgba(103, 232, 249, 0.035);
}

.entity-assistant-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.entity-assistant-prompt-head button {
  padding: 4px 8px;
  font-size: 11px;
}

.entity-assistant-prompt h4 {
  margin: 12px 0 6px;
  color: #a5f3fc;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.entity-assistant-prompt pre,
.entity-assistant-diff pre {
  max-height: 320px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border-radius: 8px;
  background: rgba(2, 6, 8, 0.6);
  color: #d9f8fb;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.entity-assistant-summary {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
}

.entity-assistant-change {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(103, 232, 249, 0.12);
}

.entity-assistant-change > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.entity-assistant-change strong {
  color: #a5f3fc;
  font-size: 13px;
}

.entity-assistant-change > div:first-child span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.entity-assistant-change p {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.entity-assistant-diff {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.entity-assistant-diff span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.entity-assistant-diff pre.removed {
  border-left: 2px solid rgba(255, 99, 99, 0.55);
}

.entity-assistant-diff pre.added {
  border-left: 2px solid rgba(110, 231, 183, 0.55);
}

.entity-editor-submit-error {
  padding: 10px 20px 0;
}

.entity-editor-actions {
  flex: none;
}

.entity-editor-actions button {
  padding: 9px 13px;
}

.entity-editor-actions .primary {
  border-color: rgba(103, 232, 249, 0.45);
  background: rgba(8, 145, 178, 0.24);
  color: #cffafe;
}

.entity-editor-actions .danger {
  border-color: rgba(255, 99, 99, 0.35);
  color: var(--danger);
}

.blueprint-library-backdrop {
  position: fixed;
  inset: 0;
  z-index: 310;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 4, 5, 0.74);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.blueprint-library {
  width: min(1040px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(103, 232, 249, 0.28);
  border-radius: 16px;
  background: rgba(9, 13, 14, 0.98);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.65), 0 0 60px rgba(34, 211, 238, 0.08);
  user-select: text;
  -webkit-user-select: text;
}

.blueprint-library-page {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.blueprint-library.standalone {
  width: min(1240px, 100%);
  height: 100%;
  max-height: none;
}

.blueprint-library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(103, 232, 249, 0.14);
}

.blueprint-library-head h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.blueprint-library-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.blueprint-library-head-actions button {
  padding: 7px 10px;
}

.blueprint-library-head-actions a {
  padding: 7px 10px;
  border: 1px solid rgba(103, 232, 249, 0.28);
  border-radius: 7px;
  color: #cffafe;
  font-size: 12px;
}

.blueprint-library-head-actions a:hover {
  background: rgba(103, 232, 249, 0.1);
}

.blueprint-library-head-actions button[aria-label] {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 24px;
}

.blueprint-library-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.blueprint-library-filters label {
  display: grid;
  gap: 5px;
}

.blueprint-library-filters label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.blueprint-library-filters input,
.blueprint-library-filters select {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
}

.blueprint-library-tabs,
.blueprint-library-subtabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.blueprint-library-tabs button,
.blueprint-library-subtabs button {
  flex: none;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.blueprint-library-tabs button {
  padding: 8px 12px;
  border-bottom: 2px solid transparent;
  border-radius: 7px 7px 0 0;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.blueprint-library-tabs button.active {
  border-bottom-color: #67e8f9;
  background: rgba(103, 232, 249, 0.08);
  color: #cffafe;
}

.blueprint-library-subtabs {
  padding-top: 8px;
  padding-bottom: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.blueprint-library-search-scope {
  padding: 8px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #a5f3fc;
  font-size: 11px;
}

.blueprint-library-subtabs button {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
}

.blueprint-library-subtabs button.active {
  border-color: rgba(103, 232, 249, 0.38);
  background: rgba(8, 145, 178, 0.22);
  color: #cffafe;
}

.blueprint-library-status {
  margin: 16px 20px 0;
  padding: 12px 14px;
  border: 1px solid rgba(103, 232, 249, 0.14);
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
}

.blueprint-library-status.error {
  border-color: rgba(255, 99, 99, 0.25);
  color: var(--danger);
}

.blueprint-library-avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  padding: 16px 20px 4px;
}

.blueprint-library-avatar {
  display: block;
  overflow: hidden;
  padding: 14px 16px 16px;
  border: 1px solid rgba(103, 232, 249, 0.2);
  border-radius: 10px;
  background: rgba(103, 232, 249, 0.035);
  color: inherit;
  text-decoration: none;
}

.blueprint-library-avatar:hover,
.blueprint-library-avatar:focus-visible {
  border-color: rgba(103, 232, 249, 0.55);
  background: rgba(103, 232, 249, 0.08);
}

.blueprint-library-avatar-open {
  display: block;
  margin-top: 10px;
  color: var(--accent, #67e8f9);
  font-size: 12px;
}

.blueprint-library-avatar h3,
.blueprint-library-avatar p {
  margin: 4px 0 0;
}

.blueprint-library-avatar p {
  color: var(--muted);
  font-size: 12px;
}

.blueprint-library-table {
  flex: 1;
  min-height: 180px;
  padding: 12px 20px 20px;
  overflow-y: auto;
}

.blueprint-library-table-head,
.blueprint-table-row {
  display: grid;
  grid-template-columns:
    86px minmax(120px, 0.55fr) minmax(150px, 0.8fr) minmax(220px, 1.2fr) 24px;
  align-items: center;
  gap: 14px;
}

.blueprint-library-table-head {
  position: sticky;
  z-index: 2;
  top: -12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(103, 232, 249, 0.16);
  background: rgba(9, 13, 14, 0.98);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.blueprint-table-item {
  border-bottom: 1px solid rgba(103, 232, 249, 0.1);
}

.blueprint-table-item.expanded {
  margin: 0 -1px;
  border: 1px solid rgba(103, 232, 249, 0.25);
  border-radius: 10px;
  background: rgba(103, 232, 249, 0.035);
}

.blueprint-table-row {
  width: 100%;
  padding: 8px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.blueprint-table-row:hover {
  background: rgba(103, 232, 249, 0.055);
}

.blueprint-table-type {
  color: #67e8f9;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.blueprint-table-name {
  min-width: 0;
  display: block;
}

.blueprint-table-name strong {
  overflow: hidden;
  color: #e6fbff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blueprint-table-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.blueprint-table-categories > span {
  padding: 2px 6px;
  border: 1px solid rgba(255, 190, 84, 0.14);
  border-radius: 999px;
  background: rgba(255, 190, 84, 0.07);
  color: #e8c98e;
  font-size: 9px;
  white-space: nowrap;
}

.blueprint-table-components {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.blueprint-table-components > span {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(103, 232, 249, 0.1);
  color: #a5f3fc;
  font-size: 9px;
}

.blueprint-table-chevron {
  color: var(--muted);
  font-size: 18px;
  transform: rotate(0);
  transition: transform 140ms ease;
}

.blueprint-table-item.expanded .blueprint-table-chevron {
  transform: rotate(180deg);
}

.blueprint-table-details {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 6px 14px 16px;
}

.blueprint-item-preview {
  height: 150px;
  overflow: hidden;
  border: 1px solid rgba(103, 232, 249, 0.18);
  border-radius: 9px;
  background:
    radial-gradient(circle at 50% 45%, rgba(103, 232, 249, 0.1), transparent 65%),
    rgba(0, 0, 0, 0.22);
}

.blueprint-item-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.blueprint-animation-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.blueprint-animation-controls > div {
  display: flex;
  gap: 4px;
}

.blueprint-animation-controls button,
.blueprint-animation-controls select,
.blueprint-animation-controls input {
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 10px;
  text-transform: capitalize;
}

.blueprint-animation-controls input {
  width: 76px;
}

.blueprint-animation-controls button.active {
  border-color: rgba(103, 232, 249, 0.6);
  background: rgba(8, 145, 178, 0.32);
  color: #cffafe;
}

.blueprint-animation-controls label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.blueprint-table-details-copy {
  min-width: 0;
}

.blueprint-table-details-copy h3 {
  margin: 2px 0 0;
  color: #e6fbff;
  font-size: 17px;
}

.blueprint-table-details-copy p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.blueprint-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.blueprint-card-title > span {
  flex: none;
  color: #67e8f9;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.blueprint-card p {
  display: -webkit-box;
  margin: 6px 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.blueprint-card-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0;
}

.blueprint-card-capabilities span {
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(103, 232, 249, 0.1);
  color: #a5f3fc;
  font-size: 9px;
}

.blueprint-card-meta {
  justify-content: flex-start;
  color: rgba(255, 255, 255, 0.42);
  font-size: 10px;
}

.blueprint-card-place {
  padding: 8px 10px;
  border-color: rgba(103, 232, 249, 0.35);
  color: #cffafe;
  white-space: nowrap;
}

.blueprint-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (max-width: 640px) {
  .entity-editor-backdrop {
    padding: 8px;
  }

  .entity-editor {
    max-height: calc(100vh - 16px);
  }

  .entity-editor-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .entity-editor-grid label.wide {
    grid-column: span 2;
  }

  .blueprint-library-backdrop {
    padding: 8px;
  }

  .blueprint-library-page {
    padding: 8px;
  }

  .blueprint-library {
    max-height: calc(100vh - 16px);
  }

  .blueprint-library.standalone {
    max-height: none;
  }

  .blueprint-library-filters,
  .blueprint-library-table {
    grid-template-columns: 1fr;
  }

  .blueprint-library-filters {
    max-height: 190px;
    overflow-y: auto;
  }

  .blueprint-library-table {
    padding-right: 10px;
    padding-left: 10px;
  }

  .blueprint-library-table-head,
  .blueprint-table-row {
    grid-template-columns:
      62px minmax(110px, 0.6fr) minmax(120px, 0.8fr) minmax(140px, 1.2fr) 20px;
    gap: 8px;
  }

  .blueprint-library-table {
    overflow-x: auto;
  }

  .blueprint-library-table-head,
  .blueprint-table-item {
    min-width: 680px;
  }

  .blueprint-table-details {
    grid-template-columns: 180px minmax(180px, 1fr);
  }

  .blueprint-table-details .blueprint-card-place {
    grid-column: 1 / -1;
  }
}

.location-details dd {
  margin: 0;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

.settings-shell {
  width: 100%;
  position: relative;
  display: grid;
  justify-items: start;
  gap: 8px;
  pointer-events: none;
}

.settings-toggle {
  width: auto;
  min-width: 126px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 214, 130, 0.16), transparent 52%),
    rgba(14, 11, 9, 0.84);
  color: var(--amber);
  pointer-events: auto;
}

.settings-toggle:hover,
.settings-toggle[aria-expanded="true"] {
  border-color: rgba(255, 214, 130, 0.5);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 214, 130, 0.24), transparent 52%),
    rgba(23, 18, 13, 0.92);
}

.settings-toggle-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.top-control-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.top-control-label {
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.settings-toggle-label,
.mechanics-toggle-label {
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.settings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 121;
  width: min(420px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  padding: 12px 14px 14px;
  background: rgba(13, 10, 7, 0.88);
  pointer-events: auto;
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(3, 3, 2, 0.48);
  backdrop-filter: blur(2px);
  pointer-events: auto;
}

.settings-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.settings-panel-kicker {
  color: var(--amber);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-panel-title {
  color: var(--text);
  font-size: 16px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-group {
  display: grid;
  gap: 10px;
}

.settings-group-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.settings-group-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.settings-group-value {
  color: var(--amber);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.settings-slider-field {
  display: grid;
  gap: 8px;
}

.settings-slider-field input[type="range"] {
  width: 100%;
}

.settings-action-button {
  justify-self: stretch;
  min-height: 38px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
  background: rgba(11, 8, 6, 0.7);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-group-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.settings-color-input {
  width: 42px;
  height: 30px;
  padding: 2px;
  border-radius: 6px;
  background: rgba(11, 8, 6, 0.7);
}

.settings-avatar-details {
  color: var(--muted);
  font-size: 12px;
}

.settings-avatar-details summary {
  cursor: pointer;
  color: var(--amber);
}

.settings-avatar-json {
  width: 100%;
  box-sizing: border-box;
  margin: 10px 0;
  padding: 8px;
  resize: vertical;
  border-radius: 6px;
  color: var(--text);
  background: rgba(5, 4, 3, 0.8);
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.settings-avatar-error {
  margin: 0 0 8px;
  color: #ff8c7a;
}

.mechanics-panel-head {
  width: min(800px, 100%);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding-right: 48px;
}

.mechanics-panel-kicker {
  color: var(--amber);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mechanics-panel-title {
  color: var(--text);
  font-size: 26px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mechanics-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 999px;
  background: rgba(14, 11, 9, 0.72);
  color: var(--text);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  pointer-events: auto;
}

.mechanics-close:hover {
  border-color: rgba(255, 214, 130, 0.5);
  background: rgba(23, 18, 13, 0.92);
}

.mechanics-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 9px;
  color: rgba(239, 228, 202, 0.9);
  font-size: 15px;
  line-height: 1.55;
}

.mechanics-section {
  width: min(800px, 100%);
  display: grid;
  gap: 8px;
}

.mechanics-section-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.mechanics-list a {
  color: var(--amber);
}

.mechanics-readable-section {
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 5, 5, 0.68);
}

.mechanics-readable-section .mechanics-section-title,
.mechanics-readable-section .mechanics-list {
  font-family: Tahoma, Verdana, Geneva, sans-serif;
  color: #fff;
}

.mechanics-readable-section .mechanics-section-title {
  letter-spacing: 0.04em;
}

.mechanics-readable-section .mechanics-list {
  font-size: 16px;
  line-height: 1.5;
}

.mechanics-readable-section .mechanics-list a {
  color: #ffd27a;
}

.mechanics-list kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  border: 1px solid rgba(255, 214, 130, 0.28);
  background: rgba(8, 6, 5, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.key-list {
  gap: 6px;
}

#debug-controls {
  position: fixed;
  inset: auto 18px 18px auto;
  z-index: 20;
  display: grid;
  gap: 8px;
  justify-items: end;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

#hud {
  min-width: 250px;
  padding: 12px 14px;
  white-space: pre-line;
  font-size: 12px;
  color: var(--muted);
}

#minimap-root {
  position: fixed;
  top: calc(6px + env(safe-area-inset-top));
  right: auto;
  bottom: auto;
  left: calc(148px + env(safe-area-inset-left));
  z-index: 24;
  pointer-events: none;
}

#minimap-root.modal-open {
  /* The map modal is nested inside this stacking context, so lift the root
     while expanded to keep gameplay HUD surfaces below the modal backdrop. */
  z-index: 9000;
}

.minimap-world-title {
  position: absolute;
  z-index: 3;
  top: 1px;
  left: 58px;
  max-width: 180px;
  margin: 0;
  padding: 4px 2px;
  overflow: hidden;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff3d5;
  box-shadow: none;
  text-shadow:
    0 1px 2px #000,
    0 2px 5px #000,
    1px 0 2px #000,
    -1px 0 2px #000;
  font: 600 11px/1.15 var(--game-font);
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: auto;
}

.minimap-world-title:hover {
  color: #fff;
  background: transparent;
}

.minimap {
  position: relative;
  display: block;
  width: 116px;
  height: 116px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 214, 130, 0.42);
  border-radius: 50%;
  background: #0a0e14;
  box-shadow:
    0 13px 8px -7px rgba(0, 0, 0, 0.58),
    0 19px 28px -13px rgba(0, 0, 0, 0.62),
    inset 0 -8px 8px rgba(0, 0, 0, 0.42),
    inset 0 3px 3px rgba(255, 235, 190, 0.16),
    inset 0 0 0 5px rgba(14, 11, 9, 0.42);
  pointer-events: auto;
  transform: perspective(360px) rotateX(31deg);
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
}

.minimap:hover { border-color: rgba(255, 214, 130, 0.75); }
.minimap-follow-status {
  width: max-content;
  max-width: min(320px, calc(100vw - 24px));
  margin: 3px 0 0;
  padding: 4px 8px;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(10, 14, 20, 0.62);
  color: rgba(245, 245, 245, 0.94);
  font: 12px/1.2 var(--game-font);
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 3px #000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.minimap-follow-status kbd {
  display: inline-flex;
  min-width: 25px;
  height: 17px;
  padding: 0 4px;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: 9px/1 var(--game-font);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}
.minimap-viewport { position: absolute; inset: 5px; overflow: hidden; border-radius: 50%; }
.minimap iframe {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 166px;
  height: 166px;
  border: 0;
  pointer-events: none;
  transform-origin: center;
}

.minimap-cardinals {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform: rotate(var(--minimap-yaw, 0rad));
  pointer-events: none;
}
.minimap-cardinal {
  position: absolute;
  color: rgba(255, 239, 204, 0.72);
  font: 700 9px/1 var(--game-font);
  text-shadow: 0 1px 3px #000;
  pointer-events: none;
}
.minimap-cardinal i {
  display: block;
  font-style: normal;
  transform: rotate(calc(-1 * var(--minimap-yaw, 0rad)));
}
.minimap-n { top: 7px; left: 50%; transform: translateX(-50%); color: rgba(255, 190, 84, 0.9); }
.minimap-e { right: 7px; top: 50%; transform: translateY(-50%); }
.minimap-s { bottom: 7px; left: 50%; transform: translateX(-50%); }
.minimap-w { left: 7px; top: 50%; transform: translateY(-50%); }
.minimap-player {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 17px solid #ffcf72;
  filter: drop-shadow(0 1px 2px #000);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.map-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: clamp(14px, 4vw, 48px);
  background: rgba(4, 5, 7, 0.76);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}
.map-modal-panel { position: relative; width: min(94vw, 1400px); height: min(90vh, 900px); }
.map-modal iframe { width: 100%; height: 100%; border: 1px solid var(--line-strong); border-radius: 8px; background: #0a0e14; box-shadow: 0 24px 80px #000; }
.map-modal-coordinates {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 4;
  padding: 8px 12px;
  border: 1px solid rgba(255, 214, 130, 0.38);
  border-radius: 6px;
  background: rgba(10, 12, 15, 0.9);
  color: rgba(255, 239, 204, 0.94);
  font: 12px/1 var(--game-font);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
  cursor: text;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}
.map-modal-close { position: absolute; top: 12px; right: 12px; z-index: 4; width: 40px; height: 40px; padding: 0; border-radius: 50%; background: rgba(10, 12, 15, 0.88); font: 24px/1 sans-serif; }
.map-modal-teleport {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 4;
  min-width: 132px;
  transform: translateX(-50%);
  border-color: rgba(255, 214, 130, 0.52);
  border-radius: 999px;
  background: rgba(10, 12, 15, 0.9);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
}
.map-modal-teleport.armed {
  border-color: var(--amber);
  background: rgba(84, 53, 12, 0.94);
  color: #fff3d5;
}

.world-invite-modal {
  position: fixed;
  inset: 0;
  z-index: 9001;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 5, 7, 0.76);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}
.world-invite-panel {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid rgba(255, 214, 130, 0.38);
  border-radius: 12px;
  background: rgba(12, 15, 20, 0.98);
  box-shadow: 0 24px 80px #000;
}
.world-invite-eyebrow {
  margin: 0 0 7px;
  color: var(--amber);
  font: 600 11px/1 var(--game-font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.world-invite-panel h2 {
  margin: 0;
  color: #fff3d5;
  font: 600 24px/1.2 var(--game-font);
}
.world-invite-description {
  margin: 10px 0 20px;
  color: var(--muted);
  font: 13px/1.5 var(--game-font);
}
.world-invite-link { display: flex; gap: 8px; }
.world-invite-link input {
  min-width: 0;
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #080b0f;
  color: rgba(255, 239, 204, 0.94);
  font: 12px/1.2 var(--game-font);
}
.world-invite-copy {
  min-width: 104px;
  border-color: rgba(255, 214, 130, 0.52);
}
.world-invite-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: rgba(10, 12, 15, 0.88);
  font: 22px/1 sans-serif;
}

/* Climate readout chips under the minimap. */
.weather-hud {
  position: absolute;
  left: -2px;
  top: 132px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 170px;
  pointer-events: none;
}

.weather-hud-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(10, 14, 20, 0.72);
  border: 1px solid rgba(255, 214, 130, 0.28);
  color: #fff3d5;
  font-size: 11px;
  line-height: 16px;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.weather-hud-wind-arrow {
  display: inline-block;
  font-style: normal;
  font-size: 10px;
  transform-origin: 50% 50%;
}

/* ---- survival vitals bars (top-center) ---------------------------------- */

#vitals-hud {
  position: fixed;
  left: 50%;
  top: calc(8px + env(safe-area-inset-top));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: min(176px, 48vw);
  z-index: 22;
  pointer-events: none;
}

.vital-row {
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.4s ease;
}

.vital-row.vital-idle {
  opacity: 0.14;
}

.vital-row.vital-low .vital-fill {
  animation: vital-low-pulse 1.1s ease-in-out infinite;
}

.vital-label {
  width: 28px;
  text-align: right;
  font-size: 8px;
  line-height: 1;
  letter-spacing: 0.04em;
  color: #fff3d5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.vital-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(10, 14, 20, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.vital-fill {
  height: 100%;
  border-radius: 1px;
  width: 100%;
  transition: width 0.2s linear;
}

.vital-health .vital-fill { background: #e2554d; }
.vital-energy .vital-fill { background: #e8c05a; }
.vital-breath .vital-fill { background: #55c8e8; }
.vital-hunger .vital-fill { background: #e8945a; }
.vital-thirst .vital-fill { background: #5a8ee8; }
.vital-warmth .vital-fill { background: #ff8a4c; }

@keyframes vital-low-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.7); }
}

@media (max-width: 700px) {
  #vitals-hud { width: min(156px, 44vw); }
  .vital-label { font-size: 7px; width: 25px; }
  .vital-track { height: 3px; }
}

@media (max-width: 700px) {
  .minimap { width: 96px; height: 96px; transform: perspective(320px) rotateX(29deg); }
  .minimap-world-title { left: 48px; max-width: 150px; }
  .minimap iframe { width: 138px; height: 138px; }
  .map-modal { padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
  .map-modal-panel { width: 100%; height: 100%; }
  .world-invite-panel { padding: 24px 18px 18px; }
  .world-invite-link { flex-direction: column; }
  .world-invite-copy { min-height: 42px; }
  .weather-hud { top: 110px; }
  .weather-hud-chip { font-size: 10px; padding: 1px 6px; }
}

#base-compass {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 21;
  width: 124px;
  height: 124px;
  pointer-events: none;
  transition: bottom 120ms ease-out;
}

#base-compass.chat-open {
  bottom: 118px;
}

.base-compass-dial {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 214, 130, 0.16);
}

.base-compass-dial::before,
.base-compass-dial::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(255, 240, 215, 0.12);
  transform: translate(-50%, -50%);
}

.base-compass-dial::before {
  width: 1px;
  height: 82px;
}

.base-compass-dial::after {
  width: 82px;
  height: 1px;
}

.base-compass-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 16px rgba(255, 214, 130, 0.35);
}

.base-compass-arrow {
  --arrow-angle: 0deg;
  --arrow-length: 22px;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%) rotate(var(--arrow-angle));
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.4));
}

.base-compass-arrow.red {
  color: #e77767;
}

.base-compass-arrow.blue {
  color: #5f9fe5;
}

.base-compass-arrow-line {
  position: absolute;
  left: 0;
  top: -1px;
  width: var(--arrow-length);
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.95;
}

.base-compass-arrow-head {
  position: absolute;
  left: calc(var(--arrow-length) - 2px);
  top: -6px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 11px solid currentColor;
}

#pickup-prompt {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 22;
  max-width: calc(100vw - 36px);
  padding: 8px 12px;
  white-space: pre-line;
  text-align: center;
  pointer-events: none;
  color: var(--amber);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#mobile-controls {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: none;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#mobile-controls.look-drag-mode #mobile-look-joystick {
  display: none;
}

.mobile-control-cluster {
  position: absolute;
  bottom: calc(100px + env(safe-area-inset-bottom));
  display: grid;
  gap: 12px;
  pointer-events: none;
}

.mobile-control-cluster-left {
  left: calc(18px + env(safe-area-inset-left));
  justify-items: start;
}

.mobile-control-cluster-right {
  right: calc(18px + env(safe-area-inset-right));
  justify-items: end;
}

.mobile-button-row {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.mobile-action-button {
  width: 52px;
  height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 214, 130, 0.28);
  border-radius: 8px;
  background: rgba(14, 11, 9, 0.72);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(5px);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  pointer-events: auto;
  touch-action: none;
}

.mobile-shoot-button {
  position: relative;
  width: 72px;
  height: 46px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font: 16px/1.15 var(--game-font);
  font-weight: 400;
  text-align: center;
  text-shadow: 0 0 7px #000;
  white-space: nowrap;
}

.mobile-action-button.active {
  background: rgba(255, 214, 130, 0.95);
  color: #1f1206;
  box-shadow:
    0 0 0 2px rgba(255, 232, 176, 0.18),
    0 10px 28px rgba(0, 0, 0, 0.34);
}

.mobile-shoot-button.active {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.24);
}

.mobile-joystick {
  position: relative;
  width: 112px;
  height: 112px;
  border: 1px solid rgba(255, 214, 130, 0.2);
  border-radius: 999px;
  background: rgba(14, 11, 9, 0.48);
  box-shadow:
    inset 0 0 0 1px rgba(255, 214, 130, 0.08),
    var(--shadow);
  backdrop-filter: blur(5px);
  overflow: hidden;
  pointer-events: auto;
  touch-action: none;
}

.mobile-joystick::before,
.mobile-joystick::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(255, 240, 215, 0.12);
  transform: translate(-50%, -50%);
}

.mobile-joystick::before {
  width: 1px;
  height: 72px;
}

.mobile-joystick::after {
  width: 72px;
  height: 1px;
}

.mobile-joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 1px solid rgba(255, 232, 176, 0.44);
  border-radius: 999px;
  background: rgba(232, 220, 192, 0.82);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
  transition: transform 90ms ease-out;
}

.mobile-joystick.active {
  border-color: rgba(255, 232, 176, 0.42);
  background: rgba(14, 11, 9, 0.62);
}

.mobile-joystick.active .mobile-joystick-knob {
  transition: none;
}

/* Recess-style dynamic movement pad. nipplejs draws the stick at touch-down. */
.mobile-move-joystick-zone {
  position: relative;
  width: 100px;
  height: 100px;
  border: 1px solid #fff5;
  border-radius: 5%;
  background-color: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1000;
  overflow: visible;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#killfeed {
  position: fixed;
  inset: 76px 18px auto auto;
  z-index: 20;
  display: grid;
  gap: 6px;
  justify-items: end;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.killfeed-entry {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  font-size: 12px;
}

/* ---- chat log (ported from recess ChatLog) ---- */

.chatlog {
  position: fixed;
  bottom: 0;
  left: 250px;
  right: 250px;
  z-index: 22;
  max-height: 160px;
  overflow-y: auto;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0));
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: #fff;
  font-size: 14px;
  padding: 10px;
  box-sizing: border-box;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  cursor: pointer;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0));
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0));
}

.chatlog:hover {
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.chatlog.expanded {
  max-height: calc(100vh - 100px);
  background: rgba(0, 0, 0, 0.4);
  mask-image: none;
  -webkit-mask-image: none;
}

.chatlog.expanded,
.chatlog.focused {
  z-index: 100;
}

.chatlog::-webkit-scrollbar {
  width: 8px;
}

.chatlog::-webkit-scrollbar-track {
  background: transparent;
}

.chatlog::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.chatlog-lines {
  margin-bottom: 10px;
}

.chatlog-line {
  margin-bottom: 5px;
  word-wrap: break-word;
  color: #fff;
}

.chatlog-line a {
  color: #fff;
  text-decoration: underline;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.7);
}

.chatlog-line a:hover {
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

.chatlog-timeago {
  color: #fff;
  opacity: 0.5;
  font-size: 0.9em;
}

.chatlog-room-tag {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85em;
  margin-right: 3px;
}

.chatlog-sender {
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 255, 255, 0.5);
  font-weight: bold;
}

.chatlog-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.3);
  border: none;
  color: #fff;
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  border-radius: 4px;
}

.chatlog-input::placeholder {
  opacity: 0.3;
  color: #fff;
}

.chatlog-input:focus {
  outline: none;
  background: rgba(0, 0, 0, 0.5);
}

.chatlog-tabs-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 10px;
}

.chatlog-tabs {
  display: flex;
  gap: 10px;
}

.chatlog-tab {
  background: rgba(0, 0, 0, 0.1);
  color: #fff;
  padding: 5px 10px;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.chatlog-tab:hover {
  background: rgba(0, 0, 0, 0.2);
}

.chatlog-tab.active {
  background: rgba(0, 0, 0, 0.3);
}

.chatlog-tab.disabled {
  background: rgba(0, 0, 0, 0.05);
  color: #666;
  cursor: not-allowed;
  opacity: 0.5;
}

.chatlog-minimize {
  color: #fff;
  padding: 5px 8px;
  font-size: 12px;
  opacity: 0.7;
}

.chatlog-minimize:hover {
  opacity: 1;
}

/* ---- overhead player labels & chat bubbles (recess avatar_label / makeEntitySay) ---- */

.overhead {
  position: relative;
  width: 0;
  height: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.overhead.menu-open {
  z-index: 2;
}

.overhead-column {
  position: absolute;
  bottom: 0;
  left: -150px;
  width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.world-label {
  color: #fff;
  font-family: var(--game-font);
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
  text-shadow: 0 0 10px #000, 0 0 3px #000;
}

.world-object-title {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.overhead-name {
  appearance: none;
  border: 0;
  padding: 3px 8px;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
}

.overhead-name:hover,
.overhead-name:focus-visible {
  color: #fff6cc;
  outline: none;
}

.overhead-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.overhead-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 7px;
}

.overhead-panel.expanded {
  box-sizing: border-box;
}

.overhead-panel.expanded.auto {
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.overhead-panel.expanded.explicit {
  min-width: 220px;
  padding: 10px;
  background: rgba(45, 37, 31, 0.76);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.overhead-menu {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: auto;
}

.overhead-panel.explicit .overhead-menu {
  margin-bottom: 8px;
}

.overhead-menu[hidden] {
  display: none;
}

.overhead-menu-close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.75);
  font: 18px/24px sans-serif;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.overhead-menu-action {
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: 16px/1.15 var(--game-font);
  white-space: nowrap;
  cursor: pointer;
  text-shadow: 0 0 7px #000;
}

.overhead-panel.auto .overhead-menu-action.trade {
  width: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: rgb(232, 232, 232);
  font-size: 12px;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

.overhead-panel.auto .keyboard-shortcut {
  border-color: rgba(232, 232, 232, 0.55);
  background: rgba(232, 232, 232, 0.09);
}

.overhead-menu-action:hover:not(:disabled),
.overhead-menu-action:focus-visible:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

.overhead-panel.auto .overhead-menu-action.trade:hover:not(:disabled),
.overhead-panel.auto .overhead-menu-action.trade:focus-visible:not(:disabled) {
  background: transparent;
  color: rgba(255, 255, 255, 0.98);
}

.overhead-menu-action.follow { color: #90ee90; }
.overhead-menu-action.ask { color: #87ceeb; }
.overhead-menu-action.force { color: #ffb6c1; }
.overhead-menu-action.trade { color: #ffd58a; }

.overhead-menu-action:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.overhead-typing {
  font-size: 14px;
  line-height: 1;
  transition: opacity 280ms ease;
}

/* Decided to speak — prominent pulse. */
.overhead-typing.typing {
  font-size: 15px;
  animation: overhead-typing-pulse 1.1s ease-in-out infinite;
}

/* Reasoning / deliberating — quieter, lower opacity. */
.overhead-typing.thinking {
  font-size: 13px;
  opacity: 0.38;
  animation: overhead-thinking-pulse 1.8s ease-in-out infinite;
}

@keyframes overhead-typing-pulse {

  0%,
  100% {
    opacity: 0.55;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes overhead-thinking-pulse {

  0%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }

  50% {
    opacity: 0.48;
    transform: translateY(-1px);
  }
}

.overhead-bubbles {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.overhead-bubble-row {
  margin-top: 10px;
}

.overhead-bubble {
  display: inline-block;
  max-width: 300px;
  background-color: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  padding: 5px 10px;
  border-radius: 5px;
  color: #ffa;
  font-size: 13.5px;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 3px #000;
  word-wrap: break-word;
}

.overhead-activities {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 2px;
}

.overhead-activity {
  max-width: 280px;
  color: #fff2a8;
  font-family: var(--game-font);
  font-size: 12.5px;
  line-height: 1.2;
  text-shadow: 0 0 8px #000, 0 1px 3px #000;
  overflow-wrap: anywhere;
  animation: overhead-activity-arrive 160ms ease-out;
}

.animal-overhead-activity {
  color: #fff0a0;
  white-space: nowrap;
  pointer-events: none;
}

.overhead-activity.leaving {
  opacity: 0;
  transform: translateY(-5px);
}

@keyframes overhead-activity-arrive {

  from {
    opacity: 0;
    transform: translateY(3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#follow-notices {
  position: fixed;
  top: 76px;
  left: 50%;
  z-index: 95;
  width: min(420px, calc(100vw - 24px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

.follow-notice {
  padding: 10px 12px;
  border: 1px solid rgba(135, 206, 235, 0.45);
  border-radius: 7px;
  background: rgba(24, 31, 37, 0.9);
  color: #e9f8ff;
  font: 13px/1.35 var(--game-font);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: auto;
}

.follow-notice.forced {
  border-color: rgba(255, 182, 193, 0.5);
  color: #ffe6eb;
}

.follow-notice button {
  padding: 6px 10px;
  border: 0;
  border-radius: 5px;
  background: rgba(135, 206, 235, 0.22);
  color: #dff6ff;
  font: inherit;
  cursor: pointer;
}

/* ---- voice call panel (ported from recess client/av) ---- */

#av-ui {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
}

.av-wrapper {
  position: fixed;
  z-index: 90;
  top: 0;
  right: 0;
  bottom: 110px;
  width: 250px;
  overflow: auto;
  pointer-events: none;
}

.av-wrapper * {
  pointer-events: auto;
}

.av-wrapper.dragging {
  user-select: none;
  -webkit-user-select: none;
}

/* Meeting mode: panel takes over the whole screen on black (recess). */
.av-wrapper.meeting {
  left: 0;
  bottom: 0;
  width: 100vw;
  background: #000;
}

.av-drag-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  background: rgba(255, 255, 255, 0.1);
}

.av-drag-handle:hover {
  background: rgba(255, 255, 255, 0.3);
}

.av-drag-handle:active {
  background: rgba(255, 255, 255, 0.5);
}

.av-wrapper.meeting .av-drag-handle {
  display: none;
}

.av-enable-button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid transparent;
  color: #fff;
  border-top: none;
  border-radius: 5px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  padding: 5px 10px;
  cursor: pointer;
  position: absolute;
  top: 0;
  right: 0;
  font-size: 14px;
  white-space: nowrap;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.av-enable-button:hover {
  border-color: rgba(255, 255, 255, 0.6);
}

.av-enable-button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.av-enable-count {
  font-size: 12px;
  color: rgba(255, 255, 255, 1);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  margin-left: 5px;
  background: rgba(81, 115, 170, 0.9);
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
}

.av-container {
  position: relative;
  margin: 10px;
}

.av-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
  gap: 5px;
}

.av-button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid transparent;
  border-radius: 5px;
  line-height: 22px;
  height: 22px;
  font-size: 13px;
  color: #fff;
  padding: 0 5px;
  display: inline-block;
  cursor: pointer;
}

.av-button:hover {
  background: #000;
}

.av-button.toggled-off {
  background: rgba(200, 40, 40, 0.55);
}

.av-button.active {
  background: #fff;
  color: #000;
}

.av-settings {
  margin-bottom: 8px;
  background: #222;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.av-settings label {
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.av-settings select {
  box-sizing: border-box;
  width: 100%;
  background: #333;
  color: #fff;
  border-radius: 5px;
  font-size: 13px;
  padding: 4px 8px;
}

.av-notice {
  color: #ffd0c0;
  font-size: 12px;
  margin-bottom: 8px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.av-notice.floating {
  position: absolute;
  top: 36px;
  right: 10px;
  max-width: 220px;
  text-align: right;
}

.av-room {
  margin: 5px 0;
  background-color: rgba(255, 255, 255, 0.2);
  padding: 5px;
  border-radius: 5px;
  color: #fff;
  font-size: 13px;
}

.av-room.available:hover {
  cursor: pointer;
  filter: brightness(1.6);
}

.av-room.current {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.65);
}

.av-room-name {
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  font-weight: bold;
}

.av-room-joining {
  font-weight: normal;
  opacity: 0.7;
  font-size: 12px;
}

.av-room-live {
  color: #ff6b5e;
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.av-room-users {
  margin-top: 4px;
}

.av-room-empty {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  padding: 2px 4px;
}

/* ---- video tiles (recess User/Users/elements) ---- */

.av-tiles {
  display: block;
  margin-top: 4px;
}

.av-tiles::after {
  content: "";
  display: table;
  clear: both;
}

.av-tile {
  position: relative;
  overflow: hidden;
  border-radius: 5px;
  width: 100px;
  height: 100px;
  cursor: pointer;
  display: inline-block;
  margin: 3px;
  vertical-align: top;
  background: #111;
}

.av-tile.maximized {
  float: left;
}

.av-video-surface {
  position: absolute;
  inset: 0;
}

.av-video-surface video {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.av-tile-novideo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  background: #1c1c1c;
}

.av-tile-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    rgba(0, 0, 0, 0.1) 60%,
    rgba(0, 0, 0, 0.3) 80%,
    rgba(0, 0, 0, 0.8) 100%
  );
}

.av-tile-label {
  position: absolute;
  z-index: 2;
  left: 4px;
  bottom: 2px;
  right: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #fff;
  pointer-events: none;
}

.av-tile-toggles {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  z-index: 2;
}

.av-mute-button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  margin: 2px 2px 0 0;
  display: block;
  line-height: 24px;
  height: 24px;
  width: 24px;
  text-align: center;
  position: relative;
  color: #fff;
}

.av-mute-button:hover {
  background: rgba(255, 255, 255, 0.8);
}

.av-mute-button.on {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.8);
}

.av-mute-button .indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  line-height: 5px;
  width: 5px;
  height: 5px;
  font-size: 5px;
  display: block;
}

.av-tile-mute-indicator {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 3;
}

.av-volume-control {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.2s;
  width: 90%;
}

.av-tile:hover .av-volume-control {
  opacity: 1;
}

.av-volume-icon {
  font-size: 14px;
}

.av-volume-control input[type="range"] {
  width: 80%;
}

.av-volume-tooltip {
  position: absolute;
  z-index: 10;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  padding: 8px;
  border-radius: 5px;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.av-volume-tooltip .buttons {
  display: flex;
  gap: 10px;
  margin-top: 5px;
  justify-content: center;
}

.av-volume-tooltip button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
}

.av-volume-tooltip button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.av-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  font-size: 12px;
  padding: 2px 4px;
  color: #fff;
  margin: 0 0 2px 0;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 5px;
}

.av-user.offline {
  opacity: 0.55;
}

.av-user-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.av-user-meta {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
  white-space: nowrap;
  margin-left: auto;
}

.av-leave {
  text-decoration: underline;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  cursor: pointer;
  margin-top: 6px;
  text-align: right;
}

.av-leave:hover {
  color: rgba(255, 255, 255, 1);
}

#scoreboard {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  background: rgba(4, 3, 2, 0.42);
  backdrop-filter: blur(4px);
}

#scoreboard.visible {
  display: block;
}

#scoreboard-body {
  height: 100%;
}

.scoreboard-shell {
  height: 100%;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 28px);
}

.scoreboard-card {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 14px;
  display: grid;
  gap: 12px;
  background: rgba(13, 10, 7, 0.88);
}

.scoreboard-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 189, 84, 0.08);
}

.scoreboard-title {
  font-size: clamp(24px, 4vw, 30px);
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.scoreboard-layout {
  display: grid;
  gap: 14px;
}

.scoreboard-layout.with-vote {
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.95fr);
  align-items: start;
}

.scoreboard-columns {
  display: grid;
  gap: 10px;
}

.score-table-head {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 84px 84px 84px 84px;
  gap: 0;
  align-items: center;
  padding: 0 14px 6px 0;
}

.score-table-spacer {
  min-height: 1px;
}

.score-table-player {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.score-team {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  border: 1px solid rgba(255, 189, 84, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.score-team-badge {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 14px 12px;
  border-right: 1px solid rgba(255, 189, 84, 0.08);
  background: rgba(255, 189, 84, 0.03);
}

.score-team-total {
  font-size: clamp(38px, 5vw, 54px);
  line-height: 0.9;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
}

.score-team-badge-foot {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
}

.score-team-meta {
  display: grid;
  gap: 2px;
  justify-items: center;
  line-height: 1.2;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.score-team-rows {
  display: grid;
  align-content: start;
}

.score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 84px 84px 84px;
  gap: 0;
  align-items: center;
  min-height: 58px;
  padding: 0 14px;
}

.score-row.self {
  background: rgba(255, 189, 84, 0.035);
}

.score-name {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.score-player-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-row+.score-row {
  border-top: 1px solid rgba(255, 189, 84, 0.08);
}

.score-value,
.score-label {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.score-label {
  line-height: 1.05;
  white-space: normal;
}

.leaderboard-shell {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 28px);
  background: rgba(0, 0, 0, 0.42);
}

.leaderboard-card {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(13, 10, 7, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.leaderboard-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 189, 84, 0.08);
}

.leaderboard-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.leaderboard-error {
  padding: 10px 12px;
  border: 1px solid rgba(255, 120, 90, 0.35);
  color: #ffd0c7;
  background: rgba(160, 43, 28, 0.18);
  font-size: 13px;
}

.leaderboard-table {
  display: grid;
  min-width: 620px;
  border: 1px solid rgba(255, 189, 84, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.leaderboard-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(4, minmax(92px, 0.45fr));
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  color: var(--text);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.leaderboard-row+.leaderboard-row {
  border-top: 1px solid rgba(255, 189, 84, 0.08);
}

.leaderboard-row-head {
  min-height: 42px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.leaderboard-row>div:not(.leaderboard-player),
.leaderboard-sort {
  text-align: right;
}

.leaderboard-sort {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.leaderboard-sort:hover {
  color: var(--text);
}

.leaderboard-sort-indicator {
  width: 10px;
  color: var(--text);
  text-align: center;
}

.leaderboard-player {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.leaderboard-rank {
  width: 30px;
  flex: 0 0 auto;
  color: var(--muted);
  text-align: right;
}

.leaderboard-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-empty {
  padding: 18px 12px;
  color: var(--muted);
  font-size: 13px;
}

.score-muted-stat {
  opacity: 0.5;
}

.score-value {
  color: var(--text);
  font-size: 18px;
}

.score-empty {
  padding: 18px 14px;
  color: var(--muted);
  min-height: 58px;
  display: grid;
  align-items: center;
}

.score-name span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vote-panel {
  padding: 12px;
  border: 1px solid rgba(255, 189, 84, 0.08);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 10px;
}

.vote-lock {
  padding: 7px 10px;
  border: 1px solid rgba(183, 209, 130, 0.34);
  color: var(--green);
  background: rgba(183, 209, 130, 0.08);
}

.vote-options {
  display: grid;
  gap: 10px;
}

.vote-option {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  background: rgba(11, 8, 6, 0.68);
}

.vote-option.selected {
  border-color: rgba(255, 214, 130, 0.58);
}

.vote-option-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(255, 189, 84, 0.12);
  pointer-events: none;
}

.vote-option-main,
.vote-option-tag {
  position: relative;
  z-index: 1;
}

.vote-option-main {
  display: grid;
  gap: 2px;
}

.vote-option-name {
  color: var(--text);
  font-weight: 700;
}

.vote-option-meta {
  color: var(--muted);
  font-size: 12px;
}

.vote-option-tag {
  color: var(--amber);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#error {
  min-height: 1.35em;
  color: var(--danger);
  font-size: 12px;
}

.preview-shell {
  min-height: 100vh;
  display: grid;
  gap: 10px;
  padding: 16px;
  overflow: auto;
}

.preview-nav {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  justify-self: flex-start;
}

.preview-nav a {
  padding: 10px 12px;
  border: 1px solid rgba(255, 189, 84, 0.12);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.preview-nav a:hover {
  color: var(--text);
  border-color: rgba(255, 189, 84, 0.32);
}

.preview-stage {
  position: relative;
  min-height: calc(100vh - 88px);
  border: 1px solid rgba(255, 189, 84, 0.08);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
}

.preview-world {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(68, 56, 39, 0.42) 0 34%, rgba(13, 10, 7, 0.88) 34% 100%);
}

.preview-stage>.menu-shell,
.preview-stage>.scoreboard-shell {
  position: relative;
  z-index: 1;
}

#test-avatar-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #16181a;
}

#test-avatar-root canvas {
  width: 100%;
  height: 100%;
}

#avatar-preview-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #16181a;
}

#avatar-preview-root canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.avatar-lab-toolbar {
  position: fixed;
  z-index: 3;
  inset: 14px 14px auto;
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  color: #f7f1e4;
  background: rgba(20, 23, 22, 0.84);
  border: 1px solid rgba(255, 239, 208, 0.16);
  border-radius: 12px;
  backdrop-filter: blur(12px);
}

.avatar-lab-heading,
.avatar-lab-controls,
.avatar-lab-control {
  display: flex;
  align-items: center;
}

.avatar-lab-heading {
  gap: 14px;
}

.avatar-lab-library-link {
  padding: 5px 8px;
  border: 1px solid rgba(255, 239, 208, 0.2);
  border-radius: 7px;
  background: #303934;
  color: #f7f1e4;
  font-size: 0.72rem;
}

.avatar-lab-library-link:hover {
  background: #b56b45;
}

.avatar-lab-controls {
  flex-wrap: wrap;
  gap: 8px 14px;
}

.avatar-lab-control {
  gap: 5px;
}

.avatar-lab-control>span,
.avatar-lab-control label {
  color: #aaa396;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.avatar-lab-control button,
.avatar-lab-control select {
  color: #f7f1e4;
  background: #303934;
  border: 1px solid rgba(255, 239, 208, 0.2);
  border-radius: 7px;
  padding: 6px 9px;
  cursor: pointer;
  text-transform: capitalize;
}

.avatar-lab-control label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 2px;
}

.avatar-lab-control button.active,
.avatar-lab-control button:hover {
  background: #b56b45;
}

.avatar-lab-control button[data-mode="procedural"],
.avatar-lab-control button[data-mode="fallback"] {
  border-style: dashed;
}

.avatar-lab-control button[data-mode="missing"],
.avatar-lab-control button[data-mode="error"] {
  border-color: #df6f61;
}

.avatar-lab-report {
  position: fixed;
  z-index: 3;
  right: 14px;
  bottom: 14px;
  display: flex;
  gap: 12px;
  padding: 8px 10px;
  color: #aaa396;
  background: rgba(20, 23, 22, 0.78);
  border: 1px solid rgba(255, 239, 208, 0.14);
  border-radius: 9px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.avatar-lab-report output {
  color: #f7f1e4;
}

.avatar-lab-report output[data-mode="error"],
.avatar-lab-report output[data-mode="missing"] {
  color: #ff9385;
}

.avatar-preview-toolbar {
  position: fixed;
  z-index: 2;
  inset: 18px 18px auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  color: #f7f1e4;
  background: rgba(20, 23, 22, 0.78);
  border: 1px solid rgba(255, 239, 208, 0.16);
  border-radius: 12px;
  backdrop-filter: blur(12px);
}

.avatar-preview-status {
  color: #c7c0b2;
  font-size: 0.85rem;
  flex: 1;
}

.avatar-preview-actions {
  display: flex;
  gap: 6px;
}

.avatar-preview-actions button {
  color: #f7f1e4;
  background: #303934;
  border: 1px solid rgba(255, 239, 208, 0.2);
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
  text-transform: capitalize;
}

.avatar-preview-actions button.active,
.avatar-preview-actions button:not(:disabled):hover {
  background: #b56b45;
}

.avatar-preview-actions button[data-mode="procedural"],
.avatar-preview-actions button[data-mode="fallback"] {
  border-style: dashed;
}

.avatar-preview-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.test-avatar-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.test-avatar-label {
  position: absolute;
  top: 14px;
  z-index: 2;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 11, 12, 0.58);
  color: rgba(255, 248, 232, 0.86);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  pointer-events: none;
}

.test-avatar-label-left {
  left: 14px;
}

.test-avatar-label-right {
  left: calc(50% + 14px);
}

@media (pointer: coarse) {
  #mobile-controls.gameplay-visible {
    display: block;
  }

  body.mobile-controls-active #base-compass {
    bottom: calc(156px + env(safe-area-inset-bottom));
  }

  body.mobile-controls-active #pickup-prompt {
    bottom: calc(148px + env(safe-area-inset-bottom));
  }

  body.mobile-controls-active #debug-controls {
    bottom: calc(190px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 980px) {
  .avatar-lab-toolbar {
    max-height: 46vh;
    overflow: auto;
  }

  .avatar-lab-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .avatar-lab-report {
    left: 14px;
    right: auto;
    flex-wrap: wrap;
  }

  #ui {
    inset: 0;
    width: auto;
    padding: 12px 76px 12px 12px;
  }

  #ui>.menu-shell {
    width: min(720px, 100%);
    max-height: calc(100vh - 24px);
  }

  .menu-grid,
  .lobby-layout,
  .room-layout,
  .scoreboard-layout.with-vote {
    grid-template-columns: 1fr;
  }

  .lobby-create-fields,
  .room-settings-grid {
    grid-template-columns: 1fr;
  }

  .lobby-sidebar {
    padding-right: 0;
    padding-bottom: 12px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 189, 84, 0.08);
  }

  #score-strip {
    gap: 12px;
    padding: 8px 10px;
  }

  #score-strip .score-side {
    gap: 5px;
    font-size: 14px;
  }

  #score-strip .score-center {
    min-width: 42px;
    font-size: 12px;
  }

  #mechanics-ui {
    right: 12px;
  }

  #settings-ui {
    right: auto;
  }

  #debug-controls,
  #killfeed {
    right: 12px;
  }

  #killfeed {
    top: 76px;
  }

  .browser-row {
    grid-template-columns: minmax(0, 150px) minmax(90px, 1fr) minmax(104px, max-content) 64px 88px;
  }
}

@media (max-width: 720px) {
  #summary {
    inset: 12px auto auto 12px;
    max-width: calc(100vw - 24px);
  }

  #score-strip {
    top: 86px;
    max-width: calc(100vw - 24px);
    white-space: nowrap;
  }

  #mechanics-ui {
    inset: 12px 12px auto auto;
    width: min(320px, calc(100vw - 24px));
  }

  #mechanics-toggle {
    right: 12px;
    bottom: 46px;
    width: 40px;
    min-width: 40px;
    padding: 0;
  }

  #mechanics-panel {
    inset: 0;
    width: auto;
    max-height: none;
    transform: none;
    padding: 24px 18px;
  }

  .mechanics-toggle-label,
  .settings-toggle-label {
    display: none;
  }

  #top-controls {
    top: calc(8px + env(safe-area-inset-top));
    left: calc(8px + env(safe-area-inset-left));
  }

  #minimap-root {
    top: calc(2px + env(safe-area-inset-top));
    left: calc(56px + env(safe-area-inset-left));
  }

  .settings-toggle,
  .actions-toggle {
    width: 40px;
    min-width: 40px;
    padding: 0;
  }

  .top-control-label {
    display: none;
  }

  #debug-controls {
    right: 12px;
    bottom: 12px;
  }

  .controls-copy,
  .lobby-summary {
    text-align: left;
    max-width: none;
  }

  .menu-header,
  .status-card-head,
  .panel-head,
  .scoreboard-head,
  .vote-panel-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .menu-header.dismissible {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .leaderboard-head,
  .menu-header-actions {
    align-items: flex-start;
  }

  .leaderboard-card {
    width: calc(100vw - 24px);
  }

  .leaderboard-table {
    overflow-x: auto;
  }

  .score-table-head {
    grid-template-columns: 92px minmax(0, 1fr) 58px 58px 58px 58px;
    padding: 0 12px 6px 0;
  }

  .score-team {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .score-team-badge {
    padding: 12px 8px;
  }

  .score-team-total {
    font-size: 34px;
  }

  .browser-row {
    grid-template-columns: minmax(0, 132px) minmax(78px, 1fr) minmax(86px, max-content) 54px 74px;
  }

  .score-row {
    grid-template-columns: minmax(0, 1fr) 58px 58px 58px 58px;
  }

  .score-row,
  .score-empty {
    padding: 0 12px;
  }

  .room-top-row,
  .team-buttons {
    grid-template-columns: 1fr;
  }

  .room-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intro-name-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .chatlog {
    left: 10px;
    right: 10px;
    max-height: 150px;
  }

  .chatlog.expanded {
    max-height: calc(100vh - 150px);
  }

  .av-wrapper {
    width: 190px;
  }

  #base-compass {
    left: 12px;
    bottom: 12px;
    width: 112px;
    height: 112px;
  }

  #base-compass.chat-open {
    bottom: 134px;
  }

  #pickup-prompt {
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }

  .mobile-control-cluster {
    bottom: calc(100px + env(safe-area-inset-bottom));
  }

  .mobile-control-cluster-left {
    left: calc(12px + env(safe-area-inset-left));
  }

  .mobile-control-cluster-right {
    right: calc(12px + env(safe-area-inset-right));
  }

  #killfeed {
    inset: 60px 12px auto auto;
    width: min(320px, calc(100vw - 24px));
  }

  .status-card-grid {
    grid-template-columns: 1fr;
  }

  .preview-shell {
    padding: 12px;
  }
}

@media (max-width: 720px) and (pointer: coarse) {
  body.mobile-controls-active #base-compass {
    bottom: calc(150px + env(safe-area-inset-bottom));
  }

  body.mobile-controls-active #pickup-prompt {
    bottom: calc(142px + env(safe-area-inset-bottom));
  }
}

.game-crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 140ms ease-out;
}

/* ---- inventory / trade panel ---- */

.inv-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 60;
  pointer-events: none;
}

.inv-panel {
  position: relative;
  width: 100%;
  height: min(294px, 42vh);
  box-sizing: border-box;
  pointer-events: auto;
  background:
    linear-gradient(180deg, rgba(35, 43, 56, 0.97), rgba(13, 17, 24, 0.985) 42%),
    rgba(13, 17, 24, 0.98);
  border: 1px solid rgba(168, 205, 236, 0.22);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  color: #e8ecf2;
  font-family: inherit;
  box-shadow:
    0 -18px 56px rgba(0, 0, 0, 0.42),
    inset 0 1px rgba(255, 255, 255, 0.06);
  user-select: none;
  touch-action: none;
  overflow: hidden;
}

.inv-organize {
  width: 100%;
  border-color: rgba(126, 202, 255, 0.42);
  background: linear-gradient(180deg, rgba(98, 173, 228, 0.2), rgba(49, 104, 147, 0.16));
  color: #dcefff;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.inv-organize:disabled {
  opacity: 0.36;
  cursor: default;
}

.inv-body {
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) 164px;
  gap: 8px;
  align-items: stretch;
  overflow: hidden;
}

.inv-left,
.inv-workspace,
.inv-utility-rail,
.inv-activity {
  min-height: 0;
}

.inv-left {
  padding: 5px;
  border: 1px solid rgba(145, 196, 234, 0.13);
  border-radius: 11px;
  background: rgba(3, 7, 12, 0.24);
  box-shadow: inset 0 0 25px rgba(45, 109, 157, 0.05);
}

.inv-workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.inv-activity {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 184, 226, 0.48) rgba(0, 0, 0, 0.18);
}

.inv-panel.has-trade .inv-activity,
.inv-panel.has-box .inv-activity {
  flex: 1;
  align-items: center;
  justify-content: center;
}

.inv-canvas {
  position: relative;
  background:
    linear-gradient(rgba(158, 205, 239, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(158, 205, 239, 0.075) 1px, transparent 1px),
    radial-gradient(circle at 50% 20%, rgba(49, 80, 107, 0.22), rgba(4, 8, 13, 0.88) 68%);
  background-size: 46px 46px, 46px 46px, auto;
  border: 1px solid rgba(145, 196, 234, 0.2);
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    inset 0 0 32px rgba(0, 0, 0, 0.32),
    0 1px rgba(255, 255, 255, 0.035);
}

.inv-backpack .inv-canvas {
  background-image:
    linear-gradient(rgba(255, 226, 183, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 226, 183, 0.13) 1px, transparent 1px),
    linear-gradient(rgba(75, 38, 18, 0.08), rgba(75, 38, 18, 0.08)),
    url("/assets/ui/backpack-leather.webp");
  background-size: 46px 46px, 46px 46px, auto, cover;
  background-position: 0 0, 0 0, 0 0, center;
  border-color: rgba(231, 174, 112, 0.48);
  box-shadow:
    inset 0 0 28px rgba(59, 27, 10, 0.24),
    0 1px rgba(255, 240, 214, 0.12);
}

.inv-trade-canvas {
  border-color: rgba(255, 200, 90, 0.45);
}

.inv-item {
  width: 46px;
  height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 8px;
  cursor: grab;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
}

.inv-item.selected {
  border-color: rgba(140, 200, 255, 0.8);
  background: rgba(140, 200, 255, 0.12);
}

.inv-item.dragging {
  opacity: 0.85;
  cursor: grabbing;
}

.inv-item-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.inv-item-label {
  font-size: 8.5px;
  line-height: 1.05;
  text-align: center;
  max-width: 44px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0.9;
}

.inv-item-qty {
  position: absolute;
  right: 3px;
  top: 2px;
  font-size: 9px;
  font-weight: 700;
  color: #ffd66b;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.inv-utility-rail {
  width: 164px;
  min-width: 164px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px;
  box-sizing: border-box;
  border: 1px solid rgba(145, 196, 234, 0.13);
  border-radius: 11px;
  background: rgba(6, 10, 16, 0.42);
}

.inv-utility-summary {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  color: rgba(207, 226, 241, 0.62);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.inv-utility-summary strong {
  color: #f2f7fb;
  font-size: 15px;
}

.inv-avatar-selector {
  padding: 6px 0;
  border-top: 1px solid rgba(140, 200, 255, 0.1);
  border-bottom: 1px solid rgba(140, 200, 255, 0.1);
}

.inv-utility-rail .inv-avatar-selector .inv-section-heading {
  display: none;
}

.inv-avatar-selector label {
  display: grid;
  gap: 3px;
  margin-top: 4px;
  color: rgba(237, 245, 255, 0.7);
  font-size: 10px;
}

.inv-utility-rail .inv-avatar-selector label > span {
  color: rgba(220, 235, 246, 0.56);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inv-avatar-selector select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(140, 200, 255, 0.24);
  border-radius: 6px;
  background: rgba(8, 14, 21, 0.92);
  color: #edf5ff;
}

.inv-close {
  width: 100%;
  margin-top: auto;
}

.inv-avatar-error {
  margin-top: 5px;
  color: #ff9c9c;
  font-size: 10px;
}

.inv-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.inv-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.65;
  margin-top: 6px;
}

.inv-section-hint {
  font-size: 10px;
  opacity: 0.45;
}

.inv-equipment-dock {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 1px solid rgba(145, 196, 234, 0.13);
  border-radius: 9px;
  background:
    radial-gradient(circle at 50% 50%, rgba(64, 115, 151, 0.1), transparent 42%),
    rgba(5, 9, 14, 0.44);
}

.inv-panel.has-trade .inv-equipment-dock,
.inv-panel.has-box .inv-equipment-dock {
  display: none;
}

.inv-equipment-heading {
  position: absolute;
  top: 7px;
  left: 9px;
  right: 9px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px 4px;
  color: rgba(217, 233, 245, 0.5);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inv-equipment-heading strong {
  color: rgba(232, 242, 250, 0.76);
  font-size: 10px;
}

.inv-equipment-body {
  position: relative;
  width: min(100%, 440px);
  display: grid;
  grid-template-columns: minmax(96px, 1fr) minmax(118px, 1.15fr) minmax(96px, 1fr);
  grid-template-rows: 58px 70px 58px;
  grid-template-areas:
    ". head ."
    "left torso right"
    ". legs .";
  gap: 6px 10px;
  margin-top: 18px;
}

.inv-equipment-body::before,
.inv-equipment-body::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  background: rgba(135, 198, 241, 0.11);
  box-shadow: 0 0 14px rgba(91, 176, 234, 0.06);
}

.inv-equipment-body::before {
  top: 20px;
  bottom: 18px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
}

.inv-equipment-body::after {
  top: 92px;
  left: 12%;
  right: 12%;
  height: 2px;
}

.inv-equip-slot {
  appearance: none;
  position: relative;
  width: 100%;
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 3px 5px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font-family: inherit;
  font-size: 10.5px;
  text-align: center;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease,
    transform 120ms ease;
}

.inv-equip-slot.slot-head {
  grid-area: head;
  border-radius: 22px 22px 10px 10px;
}

.inv-equip-slot.slot-torso {
  grid-area: torso;
}

.inv-equip-slot.slot-legs {
  grid-area: legs;
  border-radius: 8px 8px 18px 18px;
}

.inv-equip-slot.slot-leftHand {
  grid-area: left;
  height: 58px;
  align-self: center;
}

.inv-equip-slot.slot-rightHand {
  grid-area: right;
  height: 58px;
  align-self: center;
}

.inv-equip-slot.filled {
  background: rgba(140, 200, 255, 0.1);
  border-color: rgba(140, 200, 255, 0.2);
  cursor: pointer;
  animation: inv-equip-change 240ms ease-out;
}

.inv-equip-slot.filled:hover,
.inv-equip-slot.filled:focus-visible {
  outline: none;
  background: rgba(140, 200, 255, 0.18);
  border-color: rgba(140, 200, 255, 0.42);
}

.inv-equip-slot.drag-compatible {
  border-color: rgba(126, 219, 170, 0.72);
  background: rgba(55, 159, 112, 0.18);
  box-shadow: inset 0 0 18px rgba(83, 220, 147, 0.1);
}

.inv-equip-slot.drag-incompatible {
  opacity: 0.36;
}

.inv-equip-slot.drag-compatible.drag-over {
  z-index: 3;
  transform: scale(1.08);
  border-color: rgba(171, 255, 209, 0.98);
  background: rgba(58, 190, 123, 0.34);
  box-shadow:
    0 0 0 3px rgba(95, 226, 159, 0.16),
    0 8px 24px rgba(0, 0, 0, 0.38),
    inset 0 0 20px rgba(163, 255, 205, 0.15);
}

.inv-equip-label {
  width: 100%;
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.6;
}

.inv-equip-item {
  width: 100%;
  flex: 0 1 auto;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.inv-equip-action {
  flex: 0 0 auto;
  color: #a9d7ff;
  font-size: 8.5px;
  opacity: 0.78;
}

@keyframes inv-equip-change {
  0% {
    transform: translateX(-7px);
    background: rgba(140, 200, 255, 0.34);
  }
  55% { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

.inv-ground-drop {
  width: 100%;
  box-sizing: border-box;
  margin-top: 0;
  padding: 6px 7px;
  border: 1px dashed rgba(242, 116, 116, 0.56);
  border-radius: 8px;
  background: rgba(126, 39, 45, 0.18);
  text-align: center;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease,
    transform 120ms ease;
}

.inv-ground-drop-title {
  color: #ffd1d1;
  font-size: 10.5px;
  font-weight: 700;
}

.inv-ground-drop-hint {
  display: none;
}

.inv-ground-drop.drag-compatible {
  border-color: rgba(255, 145, 145, 0.86);
  background: rgba(169, 54, 59, 0.3);
}

.inv-ground-drop.drag-incompatible {
  opacity: 0.38;
}

.inv-ground-drop.drag-compatible.drag-over {
  transform: scale(1.035);
  border-style: solid;
  border-color: #ffb0b0;
  background: rgba(195, 60, 66, 0.48);
  box-shadow:
    0 0 0 3px rgba(255, 105, 105, 0.12),
    0 9px 25px rgba(0, 0, 0, 0.32);
}

.inv-selected-name {
  width: 100%;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-selected-location {
  width: 100%;
  margin-top: 2px;
  overflow: hidden;
  font-size: 10px;
  opacity: 0.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-quantity {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: rgba(227, 235, 244, 0.78);
  font-size: 10px;
}

.inv-quantity-label {
  margin-right: auto;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.65;
}

.inv-quantity-input {
  width: 56px;
  height: 27px;
  box-sizing: border-box;
  padding: 3px 4px 3px 7px;
  border: 1px solid rgba(141, 204, 255, 0.48);
  border-radius: 5px;
  outline: none;
  background: rgba(7, 11, 17, 0.72);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  color-scheme: dark;
}

.inv-quantity-input:focus {
  border-color: rgba(168, 220, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(110, 188, 244, 0.16);
}

.inv-quantity-total {
  min-width: 32px;
  color: rgba(230, 238, 246, 0.65);
  font-size: 11px;
  font-weight: 700;
}

.inv-quantity-hint {
  color: rgba(181, 213, 238, 0.62);
  font-size: 9px;
  line-height: 1.3;
}

.inv-action-note {
  overflow: hidden;
  color: rgba(214, 229, 242, 0.7);
  font-size: 10.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-note {
  font-size: 11px;
  opacity: 0.55;
}

.inv-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  border-radius: 6px;
  min-height: 32px;
  padding: 6px 11px;
  font-size: 12px;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.inv-btn:hover:not(:disabled),
.inv-btn:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(185, 222, 249, 0.44);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.inv-btn.small {
  min-height: 0;
  padding: 5px 9px;
  font-size: 11px;
}

.inv-btn.primary {
  width: 100%;
  min-height: 38px;
  background: rgba(112, 181, 242, 0.25);
  border-color: rgba(140, 200, 255, 0.62);
  color: #f1f8ff;
  font-weight: 650;
}

.inv-btn.primary:hover,
.inv-btn.primary:focus-visible {
  outline: none;
  background: rgba(112, 181, 242, 0.38);
}

.inv-btn.checked {
  background: rgba(90, 200, 120, 0.35);
  border-color: rgba(90, 200, 120, 0.7);
}

.inv-btn.danger {
  border-color: rgba(255, 110, 110, 0.5);
}

.inv-trade {
  margin: 0;
  padding: 9px;
  border: 1px solid rgba(255, 200, 90, 0.42);
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(88, 66, 24, 0.18), rgba(8, 10, 14, 0.66)),
    rgba(8, 10, 14, 0.7);
  box-shadow:
    inset 0 1px rgba(255, 226, 160, 0.06),
    0 10px 28px rgba(0, 0, 0, 0.2);
}

.inv-trade-panes {
  display: flex;
  align-items: center;
  gap: 7px;
}

.inv-trade-pane {
  padding: 5px;
  border: 2px solid rgba(255, 255, 255, 0.13);
  border-radius: 9px;
  background: rgba(14, 18, 25, 0.86);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.inv-trade-pane-title {
  min-height: 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 0 2px 4px;
  font-size: 10.5px;
}

.inv-trade-pane-title strong {
  color: #ffe19a;
  font-size: 12px;
  text-transform: uppercase;
}

.inv-trade-pane-title span {
  overflow: hidden;
  opacity: 0.72;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-trade-arrows {
  color: #ffd26b;
  font-size: 30px;
  font-weight: 900;
  text-shadow: 0 0 14px rgba(255, 191, 65, 0.38);
}

.inv-trade.mine-approved .inv-trade-pane.mine,
.inv-trade.theirs-approved .inv-trade-pane.theirs {
  border-color: #5ee49a;
  background: rgba(24, 91, 59, 0.34);
  box-shadow: inset 0 0 24px rgba(64, 224, 137, 0.12), 0 0 0 2px rgba(71, 225, 142, 0.12);
}

.inv-trade-approved {
  padding: 3px 6px;
  border-radius: 999px;
  background: #36bd74;
  color: #061c10;
  font-size: 9px;
  letter-spacing: 0.04em;
}

.inv-trade-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
}

.inv-trade-partner-check {
  flex: 1;
  font-size: 11.5px;
  opacity: 0.85;
}

.item-drag-label {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 201;
  max-width: 140px;
  overflow: hidden;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(12, 17, 24, 0.94);
  color: #edf5ff;
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
}

.item-drag-label.selected {
  outline: 2px solid #72cbff;
  box-shadow: 0 0 0 3px rgba(83, 185, 246, 0.22), 0 4px 14px rgba(0, 0, 0, 0.46);
}

@media (max-width: 900px) {
  .inv-root {
    align-items: stretch;
  }

  .inv-panel {
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
    padding-inline: 10px;
  }

  .inv-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow: auto;
  }

  .inv-workspace,
  .inv-utility-rail {
    width: 460px;
    max-width: 100%;
    min-width: 0;
  }

  .inv-workspace {
    overflow: visible;
  }

  .inv-activity {
    flex-direction: column;
    min-width: 0;
    overflow: visible;
  }

  .inv-trade-panes {
    flex-direction: column;
  }

  .inv-trade-arrows {
    transform: rotate(90deg);
  }
}

#item-hint {
  position: fixed;
  left: 50%;
  bottom: 8vh;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: min(300px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 7px;
  background: rgba(45, 37, 31, 0.76);
  color: #fff;
  text-shadow: 0 0 10px #000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
  /* Contextual actions belong to the gameplay HUD, below every modal/panel
     layer (the lowest of which starts at 50). */
  z-index: 40;
  pointer-events: auto;
}

.item-hint-action {
  --game-action-align: left;
  --game-action-justify: flex-start;
  pointer-events: auto;
  touch-action: manipulation;
}

.item-hint-action:hover,
.item-hint-action:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.2);
}

@media (pointer: coarse) {
  .item-hint-action {
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 5px;
  }

  .item-hint-action:active {
    background: rgba(255, 214, 130, 0.2);
  }
}

/* ---- land entry/exit ---- */

#land-banner {
  position: fixed;
  left: 50%;
  top: 22vh;
  transform: translateX(-50%);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #f5f0dc;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.75);
  opacity: 0;
  transition: opacity 0.7s ease;
  pointer-events: none;
  z-index: 25;
  white-space: nowrap;
}

#land-banner.visible {
  opacity: 1;
}

#action-feedback {
  position: fixed;
  left: 50%;
  bottom: 18vh;
  transform: translateX(-50%) translateY(8px);
  z-index: 26;
  padding: 9px 16px;
  border: 1px solid rgba(149, 221, 190, 0.65);
  border-radius: 999px;
  background: rgba(8, 18, 16, 0.86);
  color: #d8ffe9;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  opacity: 0;
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
  white-space: nowrap;
}

#action-feedback.error {
  border-color: rgba(255, 142, 119, 0.7);
  background: rgba(34, 12, 10, 0.88);
  color: #ffd8cc;
}

#action-feedback.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#land-chip {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 14, 20, 0.62);
  border: 1px solid rgba(245, 240, 220, 0.28);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  color: #f5f0dc;
  z-index: 24;
  pointer-events: none;
  white-space: nowrap;
}

/* ---- 3D item regions + unified drag ---- */

.inv-region {
  position: relative;
  overflow: visible;
  cursor: grab;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.inv-region:hover {
  border-color: rgba(166, 218, 255, 0.42);
  box-shadow:
    inset 0 0 34px rgba(35, 107, 158, 0.16),
    0 0 0 1px rgba(94, 176, 235, 0.08);
}

.inv-region canvas {
  display: block;
}

.inv-region-label {
  position: absolute;
  transform: translateX(-50%);
  max-width: 68px;
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(3, 7, 12, 0.48);
  color: #f1f6fb;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0.94;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.inv-region-label.dragging,
.inv-region-qty.dragging,
.inv-region-equipped.dragging {
  opacity: 0;
}

.inv-region-qty {
  position: absolute;
  padding: 1px 4px;
  border: 1px solid rgba(255, 214, 107, 0.26);
  border-radius: 999px;
  background: rgba(9, 12, 17, 0.86);
  font-size: 11px;
  font-weight: 800;
  color: #ffd66b;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.inv-region-equipped {
  position: absolute;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(157, 224, 188, 0.78);
  border-radius: 50%;
  background: rgba(20, 86, 61, 0.9);
  color: #d9ffeb;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
}

.inv-item-menu {
  position: absolute;
  z-index: 20;
  width: 224px;
  box-sizing: border-box;
  border: 1px solid rgba(153, 211, 255, 0.58);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(35, 46, 61, 0.98), rgba(14, 19, 27, 0.985)),
    rgba(17, 22, 31, 0.98);
  box-shadow:
    0 14px 38px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(0, 0, 0, 0.35);
  cursor: default;
  animation: inv-item-menu-in 120ms ease-out;
}

.inv-item-menu-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
}

.inv-item-menu-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.inv-item-menu-close {
  appearance: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: rgba(226, 235, 244, 0.68);
  font: inherit;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.inv-item-menu-close:hover,
.inv-item-menu-close:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.inv-item-menu-primary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 7px;
}

.inv-item-menu-danger {
  display: flex;
  gap: 6px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.inv-item-menu-danger .inv-btn {
  flex: 1;
  min-width: 0;
}

@keyframes inv-item-menu-in {
  from {
    opacity: 0;
    transform: translateY(3px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.item-drag-canvas {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.inv-confirm {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 14, 0.55);
  border-radius: 12px;
  z-index: 10;
}

.inv-confirm-body {
  background: rgba(24, 28, 38, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.inv-confirm-text {
  font-size: 13px;
}

.inv-confirm-actions {
  display: flex;
  gap: 10px;
}

.inv-box-section {
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(183, 150, 99, 0.35);
  border-radius: 11px;
  background:
    linear-gradient(180deg, rgba(96, 66, 31, 0.18), rgba(7, 10, 14, 0.6)),
    rgba(7, 10, 14, 0.56);
}

.inv-box-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 2px 6px;
  color: #f3d7a8;
  opacity: 1;
}

.model-generator {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 8, 14, 0.68);
  backdrop-filter: blur(7px);
}

.model-generator[hidden] {
  display: none;
}

.model-generator-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 20px;
  border: 1px solid rgba(116, 213, 255, 0.42);
  border-radius: 15px;
  background: rgba(15, 21, 31, 0.98);
  color: #eef6ff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.55);
}

.model-generator-head,
.model-generator-actions,
.model-generator-options {
  display: flex;
  align-items: center;
  gap: 12px;
}

.model-generator-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

.model-generator-head h2 {
  margin: 0;
  font-size: 20px;
}

.model-generator-close {
  border: 0;
  background: transparent;
  color: #d9eaff;
  font-size: 28px;
  cursor: pointer;
}

.model-generator-card > label {
  display: grid;
  gap: 7px;
  margin: 13px 0;
  font-size: 13px;
}

.model-generator-card textarea,
.model-generator-card input[type="text"],
.model-generator-card input[type="number"],
.model-generator-card select {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 10px;
  background: rgba(3, 7, 12, 0.75);
  color: inherit;
  font: inherit;
}

.model-generator-options {
  flex-wrap: wrap;
}

.model-generator input[type="checkbox"] {
  position: relative;
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  padding: 0;
  border: 2px solid rgba(155, 222, 255, 0.75);
  border-radius: 5px;
  background: rgba(3, 7, 12, 0.9);
  cursor: pointer;
}

.model-generator input[type="checkbox"]:checked {
  border-color: #68dcff;
  background: #38bde8;
}

.model-generator input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 12px;
  border: solid #07131b;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.model-generator-options label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 7px;
}

.model-generator-options label:first-child {
  width: 180px;
}

.model-generator-code-model-label {
  flex: 1 1 300px;
}

.model-generator-advanced {
  margin: 14px 0;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
}

.model-generator-advanced summary {
  cursor: pointer;
  color: #cfe9ff;
}

.model-generator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 13px 0;
}

.model-generator-grid label,
.model-generator-advanced > label {
  display: grid;
  gap: 5px;
  font-size: 12px;
}

.model-generator-grid label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
}

.model-generator-endpoint-note {
  display: block;
  margin-top: 10px;
  color: #91acc2;
}

.model-generator-reference {
  margin: 14px 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

.model-generator-reference-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  background: rgba(3, 7, 12, 0.58);
}

.model-generator-reference-tab {
  padding: 9px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #91acc2;
  cursor: pointer;
  font: inherit;
}

.model-generator-reference-tab.active {
  background: rgba(56, 189, 232, 0.2);
  color: #eef9ff;
  box-shadow: inset 0 0 0 1px rgba(104, 220, 255, 0.35);
}

.model-generator-reference-panel[hidden],
.model-generator-drawing-renderer label[hidden] {
  display: none;
}

.model-generator-reference-panel {
  padding: 12px;
}

.model-generator-drop {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px dashed rgba(104, 213, 255, 0.7);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
}

.model-generator-file {
  display: none;
}

.model-generator-draw-panel {
  background: rgba(3, 7, 12, 0.26);
}

.model-generator-drawing {
  display: block;
  width: min(100%, 512px);
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
  border: 1px solid rgba(104, 213, 255, 0.42);
  border-radius: 8px;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}

.model-generator-drawing-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 10px;
}

.model-generator-drawing-toolbar label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #cfe0ed;
  font-size: 12px;
}

.model-generator-drawing-color {
  width: 36px;
  height: 30px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(3, 7, 12, 0.75);
  cursor: pointer;
}

.model-generator-brush-size {
  flex: 1 1 175px;
}

.model-generator-drawing-size {
  min-width: 90px;
  flex: 1;
  accent-color: #38bde8;
}

.model-generator-drawing-size-value {
  min-width: 38px;
  color: #91acc2;
}

.model-generator-drawing-toolbar button {
  padding: 7px 10px;
  border: 1px solid rgba(104, 213, 255, 0.35);
  border-radius: 7px;
  background: rgba(36, 113, 151, 0.28);
  color: #e7f7ff;
  cursor: pointer;
  font: inherit;
}

.model-generator-drawing-renderer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.model-generator-drawing-renderer label {
  display: grid;
  gap: 5px;
  color: #cfe0ed;
  font-size: 12px;
}

.model-generator-openrouter-drawing-model-label {
  grid-column: 2;
}

.model-generator-drawing-note {
  display: block;
  margin-top: 10px;
  color: #91acc2;
  line-height: 1.45;
}

.model-generator-image-label,
.model-generator-placement,
.model-generator-status {
  color: #a9bdd0;
}

.model-generator-status {
  min-height: 1.4em;
}

.model-generator-actions {
  justify-content: flex-end;
}

.model-generator-actions button {
  padding: 9px 14px;
  border: 1px solid rgba(100, 211, 255, 0.55);
  border-radius: 8px;
  background: rgba(36, 113, 151, 0.55);
  color: #f3fbff;
  cursor: pointer;
}

.model-generator-actions button:disabled {
  cursor: default;
  opacity: 0.42;
}

@media (max-width: 560px) {
  .model-generator-grid,
  .model-generator-drawing-renderer {
    grid-template-columns: 1fr;
  }

  .model-generator-openrouter-drawing-model-label {
    grid-column: 1;
  }
}

/* ---- weather panel (local-only experimentation) ---- */

.weather-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 290;
  display: flex;
  flex-direction: column;
  width: min(320px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid rgba(103, 232, 249, 0.28);
  border-radius: 14px;
  background: rgba(9, 13, 14, 0.92);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}

.weather-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(103, 232, 249, 0.14);
}

.weather-panel-head h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

.weather-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: grid;
  gap: 10px;
}

.weather-section {
  border: 1px solid rgba(103, 232, 249, 0.14);
  border-radius: 10px;
  background: rgba(103, 232, 249, 0.035);
}

.weather-section summary {
  padding: 9px 12px;
  color: #a5f3fc;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.weather-section-body {
  display: grid;
  gap: 8px;
  padding: 4px 12px 12px;
}

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

.weather-field > span {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.weather-field > span em {
  font-style: normal;
  color: #d9f8fb;
  font-variant-numeric: tabular-nums;
}

.weather-field input[type="range"] {
  width: 100%;
  accent-color: #22d3ee;
}

.weather-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(17, 13, 10, 0.9);
}

.weather-field.color,
.weather-field.toggle {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.weather-field.toggle input[type="checkbox"] {
  appearance: none;
  position: relative;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(103, 232, 249, 0.42);
  border-radius: 5px;
  background: rgba(4, 18, 21, 0.9);
  cursor: pointer;
}

.weather-field.toggle input[type="checkbox"]:hover {
  border-color: rgba(103, 232, 249, 0.8);
}

.weather-field.toggle input[type="checkbox"]:checked {
  border-color: #67e8f9;
  background: #22d3ee;
}

.weather-field.toggle input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #06343b;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}

.weather-field.toggle input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(165, 243, 252, 0.85);
  outline-offset: 2px;
}

.weather-field.color input[type="color"] {
  width: 44px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
}

.weather-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.weather-panel-actions button {
  padding: 8px 12px;
}

/* ---- requested actions ("?" improvise box, D29) ------------------------- */

.requested-action-backdrop {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: grid;
  place-items: start center;
  padding: max(12vh, 48px) 24px 24px;
  background: rgba(2, 4, 5, 0.58);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.requested-action {
  width: min(560px, 100%);
  border: 1px solid rgba(103, 232, 249, 0.28);
  border-radius: 16px;
  background: rgba(9, 13, 14, 0.98);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.65), 0 0 60px rgba(34, 211, 238, 0.08);
  user-select: text;
  -webkit-user-select: text;
}

.requested-action-head {
  padding: 16px 20px 0;
}

.requested-action-head h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.requested-action-form {
  display: flex;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.requested-action-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font: inherit;
}

.requested-action-form input:disabled {
  opacity: 0.6;
}

.requested-action-form button {
  padding: 8px 16px;
}

/*
 * The thread scrolls; the panel does not resize as it grows. A dialog that
 * changes height under the cursor while a model thinks reads as a glitch, and
 * one that grows past the viewport during a long negotiation is worse.
 */
.requested-action-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 76px;
  max-height: min(56vh, 460px);
  overflow-y: auto;
  padding: 4px 20px 4px;
  font-size: 13px;
  line-height: 1.5;
  overscroll-behavior: contain;
}

/* What the player said, set apart from the world's replies. */
.requested-action-said {
  align-self: flex-end;
  max-width: 82%;
  margin: 0;
  padding: 7px 11px;
  border-radius: 10px 10px 2px 10px;
  background: rgba(103, 232, 249, 0.12);
  color: rgba(224, 247, 250, 0.95);
}

.requested-action-replied {
  margin: 0;
}

/*
 * Provenance, stated rather than implied. Deliberately quiet — it is a fact
 * about the reply, not a warning about it.
 */
.requested-action-source {
  display: inline-block;
  margin-bottom: 5px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.requested-action-source.fresh {
  border: 1px solid rgba(103, 232, 249, 0.28);
  color: rgba(165, 233, 245, 0.9);
}

.requested-action-source.cached {
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--muted, rgba(255, 255, 255, 0.5));
}

.requested-action-hint {
  margin: 0;
  color: var(--muted, rgba(255, 255, 255, 0.55));
}

.requested-action-example {
  padding: 0;
  border: 0;
  background: none;
  color: rgba(103, 232, 249, 0.9);
  font: inherit;
  text-decoration: underline dotted;
  cursor: pointer;
}

.requested-action-thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--muted, rgba(255, 255, 255, 0.62));
}

.requested-action-spinner {
  width: 13px;
  height: 13px;
  flex: none;
  border: 2px solid rgba(103, 232, 249, 0.25);
  border-top-color: rgba(103, 232, 249, 0.9);
  border-radius: 50%;
  animation: requested-action-spin 0.9s linear infinite;
}

@keyframes requested-action-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .requested-action-spinner {
    animation-duration: 2.4s;
  }
}

.requested-action-refused {
  margin: 0;
  color: rgba(252, 165, 165, 0.92);
}

.requested-action-reason {
  margin: 0 0 10px;
  color: var(--muted, rgba(255, 255, 255, 0.62));
}

.requested-action-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(103, 232, 249, 0.18);
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.06);
}

.requested-action-label {
  font-size: 15px;
  font-weight: 600;
}

.requested-action-cost {
  color: rgba(163, 230, 53, 0.92);
  font-variant-numeric: tabular-nums;
}

.requested-action-minted,
.requested-action-note {
  margin: 8px 0 0;
  color: var(--muted, rgba(255, 255, 255, 0.55));
  font-size: 12px;
}

.requested-action-confirm {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.requested-action-confirm button.primary {
  padding: 8px 18px;
  border-color: rgba(103, 232, 249, 0.5);
  background: rgba(34, 211, 238, 0.16);
}

.requested-action-expiry {
  color: var(--muted, rgba(255, 255, 255, 0.45));
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .requested-action-backdrop {
    padding: 10vh 10px 10px;
  }
}

/* Outcome of a completed improvised action. A losing roll has to look
   deliberately unremarkable rather than like an error — nothing went wrong,
   there was simply nothing there. */
.requested-action-gained,
.requested-action-nothing {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
}

.requested-action-gained {
  border: 1px solid rgba(163, 230, 53, 0.28);
  background: rgba(163, 230, 53, 0.08);
  color: rgba(217, 249, 157, 0.96);
}

.requested-action-nothing {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted, rgba(255, 255, 255, 0.6));
}

/* ---- claiming land (D32) ----
   Anchored to a corner rather than centred: the player is looking at the
   ground while they draw, so the readout must never sit over the plot. */
.land-claim {
  position: fixed;
  top: 92px;
  left: 20px;
  z-index: 320;
  /* #actions-ui is click-through; every panel inside it has to opt back in or
     its own buttons never receive the click. */
  pointer-events: auto;
  width: min(340px, calc(100vw - 40px));
  padding: 14px 16px 16px;
  border: 1px solid rgba(90, 210, 160, 0.34);
  border-radius: 14px;
  background: rgba(9, 14, 12, 0.94);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
  font-size: 14px;
  user-select: text;
  -webkit-user-select: text;
}

.land-claim-head h2 {
  margin: 2px 0 10px;
  font-size: 18px;
}

.land-claim-readout {
  display: flex;
  gap: 14px;
  margin: 0 0 10px;
}

.land-claim-readout dt {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, rgba(255, 255, 255, 0.55));
}

.land-claim-readout dd {
  margin: 2px 0 0;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}

.land-claim-readout dd.over {
  color: #fca5a5;
}

.land-claim-ok {
  margin: 0 0 10px;
  color: rgba(167, 243, 208, 0.95);
}

.land-claim-problem {
  margin: 0 0 10px;
  color: var(--muted, rgba(255, 255, 255, 0.6));
}

.land-claim-problem.blocking {
  color: #fca5a5;
}

.land-claim-hint {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted, rgba(255, 255, 255, 0.6));
}

.land-claim-hint kbd {
  padding: 1px 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
}

.land-claim-form label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted, rgba(255, 255, 255, 0.55));
}

.land-claim-form input,
.land-claim-form select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font: inherit;
  text-transform: none;
  letter-spacing: normal;
}

.land-claim-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.land-claim-actions button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.land-claim-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}

.land-claim-actions .primary {
  border-color: rgba(90, 210, 160, 0.5);
  background: rgba(16, 145, 105, 0.28);
  color: #d1fae5;
}

/* ---- /tech-tree page ---------------------------------------------------- */

body.tech-tree-page {
  margin: 0;
  background: radial-gradient(1200px 700px at 30% -10%, #17202e, #0a0e14 60%);
  color: var(--text, #dbe4ef);
  font-family: var(--game-font, Inter, ui-sans-serif, system-ui, sans-serif);
}

.tech-page {
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.tech-header {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  padding: 16px 24px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tech-header h1 {
  margin: 0;
  font-size: 20px;
  color: #ffe9c2;
}

.tech-header p {
  margin: 0;
  color: #93a1b4;
  font-size: 13px;
  max-width: 520px;
}

.tech-header input[type="search"] {
  margin-left: auto;
  min-width: 240px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 14, 20, 0.7);
  color: inherit;
  font: inherit;
}

.tech-error { color: #ff9c8a; font-size: 13px; }

.tech-scroll {
  overflow: auto;
  min-height: 0;
}

.tech-canvas {
  position: relative;
}

.tech-edges {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tech-edge {
  fill: none;
  stroke: rgba(150, 170, 200, 0.22);
  stroke-width: 1.4;
}

.tech-edge.station {
  stroke: rgba(220, 170, 90, 0.16);
  stroke-dasharray: 5 5;
}

.tech-edge.active {
  stroke: rgba(255, 214, 130, 0.9);
  stroke-width: 2.2;
}

.tech-edge.station.active {
  stroke: rgba(240, 180, 90, 0.85);
}

.tech-edge.dimmed { stroke-opacity: 0.25; }

.tech-tier-header {
  position: absolute;
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(20, 26, 36, 0.9);
  border: 1px solid rgba(255, 214, 130, 0.25);
}

.tech-tier-header strong { color: #ffe9c2; font-size: 14px; }
.tech-tier-header span { color: #7f8b9d; font-size: 11px; }

.tech-node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(17, 22, 31, 0.92);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: opacity 0.2s ease, border-color 0.15s ease, transform 0.15s ease;
}

.tech-node:hover { border-color: rgba(255, 214, 130, 0.55); transform: translateY(-1px); }
.tech-node.selected { border-color: #ffd682; box-shadow: 0 0 0 2px rgba(255, 214, 130, 0.35); }
.tech-node.dimmed { opacity: 0.28; }

.tech-node-thumb {
  flex: 0 0 66px;
  width: 66px;
  height: 66px;
  border-radius: 9px;
  background: rgba(8, 11, 16, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.tech-node-thumb img { width: 100%; height: 100%; object-fit: contain; }
.tech-node-thumb-empty { width: 22px; height: 22px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, 0.2); }

.tech-node-text { display: grid; gap: 3px; min-width: 0; }
.tech-node-text strong { font-size: 13px; color: #eef3fa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tech-node-text em { font-style: normal; font-size: 11px; color: #8b98ab; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tech-node.cat-station { border-color: rgba(220, 170, 90, 0.4); }
.tech-node.cat-luxury { border-color: rgba(210, 160, 220, 0.35); }
.tech-node.cat-animal { border-color: rgba(160, 210, 150, 0.3); }

.tech-detail {
  position: fixed;
  top: 74px;
  right: 14px;
  bottom: 14px;
  width: min(340px, calc(100vw - 28px));
  overflow-y: auto;
  padding: 16px;
  border-radius: 14px;
  background: rgba(13, 17, 24, 0.97);
  border: 1px solid rgba(255, 214, 130, 0.3);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.tech-detail-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  color: #93a1b4;
  font-size: 20px;
  cursor: pointer;
}

.tech-detail-preview {
  height: 190px;
  border-radius: 10px;
  background: rgba(8, 11, 16, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.tech-detail h2 { margin: 12px 0 6px; font-size: 18px; color: #ffe9c2; }
.tech-detail-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

.tech-chip {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
  color: #aab6c6;
}

.tech-chip.skill { border-color: rgba(150, 200, 255, 0.4); color: #b8d4f2; }

.tech-detail-blurb { color: #c3ccd8; font-size: 13px; line-height: 1.5; }
.tech-detail-source { color: #93a1b4; font-size: 12.5px; }
.tech-detail-note { color: #93a1b4; font-size: 12px; font-style: italic; }

.tech-detail-section { margin-top: 14px; }
.tech-detail-section h3 { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: #8b98ab; }
.tech-detail-section ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.tech-detail-section li button,
.tech-link {
  border: 0;
  background: transparent;
  padding: 3px 0;
  color: #9abcf5;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.tech-detail-section li button:hover, .tech-link:hover { color: #c3d9ff; text-decoration: underline; }
.tech-detail-section p { color: #aab6c6; font-size: 12.5px; margin: 8px 0 0; }

.widget-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: auto;
  background:
    radial-gradient(circle at 50% 45%, rgba(90, 56, 37, 0.2), transparent 55%),
    rgba(2, 5, 4, 0.72);
  backdrop-filter: blur(8px);
}

.drawing-widget {
  width: min(1100px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid rgba(218, 180, 111, 0.48);
  border-radius: 16px;
  background: linear-gradient(155deg, rgba(32, 23, 17, 0.98), rgba(11, 19, 15, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
  color: #f8f1dd;
}

.drawing-widget-head,
.drawing-widget-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.drawing-widget-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.drawing-widget-head h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.drawing-widget-kicker {
  color: #c89d5b;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.drawing-widget-close {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 28px;
  cursor: pointer;
}

.drawing-widget-toolbar {
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.drawing-widget-toolbar label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
  text-transform: uppercase;
}

.drawing-widget-toolbar button {
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: #f8f1dd;
  cursor: pointer;
}

.drawing-widget-toolbar button:disabled {
  cursor: default;
  opacity: 0.35;
}

.drawing-widget-colors {
  display: flex;
  gap: 6px;
}

.drawing-widget-colors button {
  width: 25px;
  height: 25px;
  padding: 0;
  border: 2px solid rgba(0, 0, 0, 0.45);
  border-radius: 50%;
}

.drawing-widget-colors button.selected {
  outline: 2px solid #d6b475;
  outline-offset: 2px;
}

.drawing-widget-status {
  margin-left: auto;
  color: #d4b06c;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.drawing-widget-status.ready {
  color: #80e9a8;
}

.drawing-widget-canvas-stack {
  position: relative;
  width: 100%;
  aspect-ratio: 8 / 3;
  border: 10px solid #6b4328;
  border-radius: 4px;
  background:
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.025), transparent 25%),
    #244b3b;
  box-shadow:
    inset 0 0 30px rgba(0, 0, 0, 0.4),
    0 8px 24px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.drawing-widget-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.drawing-widget-canvas.drawing {
  pointer-events: none;
}

.drawing-widget-canvas.draft {
  cursor: crosshair;
  touch-action: none;
}

.drawing-widget-error {
  margin: 10px 0 0;
  color: #ff9b9b;
  font-size: 12px;
}

@media (max-width: 640px) {
  .widget-backdrop {
    padding: 8px;
  }

  .drawing-widget {
    width: calc(100vw - 16px);
    padding: 10px;
  }

  .drawing-widget-status {
    margin-left: 0;
  }
}
