:root {
  color-scheme: dark;
  --panel: rgba(20, 24, 27, 0.88);
  --panel-strong: rgba(16, 18, 20, 0.96);
  --line: rgba(236, 220, 180, 0.18);
  --text: #f4ead6;
  --muted: #b8aa90;
  --gold: #d7a94a;
  --gold-soft: rgba(215, 169, 74, 0.24);
  --green: #7fb06a;
  --red: #d06a4f;
  --blue: #6fa7c8;
  --shadow: rgba(0, 0, 0, 0.68);
  --side-panel-width: 420px;
  --left-panel-width: 340px;
  --chat-panel-height: 360px;
  --toolbar-left: 360px;
  --toolbar-right: 260px;
  --directions-width: 238px;
  --entity-dock-left: 360px;
  --floating-width: 430px;
  --floating-max-height: 440px;
  --sheet-window-width: 390px;
  --equipment-window-width: 380px;
  --map-window-width: 500px;
  --top-controls-top: 66px;
}

body[data-ui-density="compact"] {
  --side-panel-width: 360px;
  --left-panel-width: 300px;
  --chat-panel-height: 300px;
  --toolbar-left: 320px;
  --toolbar-right: 230px;
  --directions-width: 210px;
  --entity-dock-left: 320px;
}

body[data-ui-density="wide"] {
  --side-panel-width: 460px;
  --left-panel-width: 380px;
  --chat-panel-height: 420px;
  --toolbar-left: 400px;
  --toolbar-right: 276px;
  --directions-width: 254px;
  --entity-dock-left: 400px;
}

body[data-window-size="small"] {
  --floating-width: 360px;
  --floating-max-height: 360px;
  --sheet-window-width: 340px;
  --equipment-window-width: 330px;
  --map-window-width: 390px;
}

body[data-window-size="large"] {
  --floating-width: 520px;
  --floating-max-height: 540px;
  --sheet-window-width: 470px;
  --equipment-window-width: 440px;
  --map-window-width: 640px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #121416;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side-panel-width);
  width: 100vw;
  height: 100vh;
  min-height: 0;
}

body.auth-mode .app-shell {
  grid-template-columns: minmax(0, 1fr);
}

.scene-shell {
  position: relative;
  container-type: inline-size;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 34%, rgba(215, 169, 74, 0.16), transparent 28%),
    linear-gradient(135deg, #111514, #08090a 62%, #15100c);
}

#scene {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.scene-backdrop {
  position: absolute;
  z-index: 0;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0;
  transform: scale(1.001);
  transition: opacity 180ms ease;
  pointer-events: none;
}

.scene-backdrop.is-visible {
  opacity: 1;
}

.scene-vignette {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.64)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.58), rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0.5)),
    radial-gradient(circle at center, rgba(0, 0, 0, 0) 42%, rgba(0, 0, 0, 0.48) 100%);
}

body.auth-mode .scene-vignette {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.12) 32%, rgba(0, 0, 0, 0.78)),
    radial-gradient(circle at center, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.66) 100%);
}

.login-panel {
  position: absolute;
  z-index: 95;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
}

body.auth-mode .login-panel {
  display: grid;
}

.login-card {
  display: grid;
  gap: 11px;
  width: min(380px, calc(100vw - 36px));
  border: 1px solid rgba(215, 169, 74, 0.42);
  background:
    linear-gradient(180deg, rgba(18, 18, 16, 0.94), rgba(7, 8, 8, 0.96)),
    rgba(10, 12, 14, 0.94);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.74);
  padding: 22px;
}

.login-brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
}

.login-brand span {
  display: grid;
  place-items: center;
  width: 48px;
  aspect-ratio: 1;
  border: 1px solid rgba(127, 176, 106, 0.46);
  background: rgba(31, 54, 32, 0.58);
  color: #bfe1a7;
  font-weight: 800;
}

.login-brand h1 {
  font-size: 22px;
}

.login-card label {
  color: var(--muted);
  font-size: 13px;
}

.login-card input {
  border-radius: 0;
  background: rgba(255, 255, 255, 0.07);
}

.login-card button {
  min-height: 42px;
  border-radius: 0;
  margin-top: 4px;
}

.login-status {
  min-height: 18px;
  margin: 0;
  color: #e6c271;
  font-size: 12px;
}

.character-lobby-panel {
  position: absolute;
  z-index: 82;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  pointer-events: none;
}

.character-lobby-panel[hidden] {
  display: none;
}

.character-lobby-card {
  width: min(920px, calc(100% - 34px));
  max-height: min(760px, calc(100% - 42px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  border: 1px solid rgba(215, 169, 74, 0.36);
  background: linear-gradient(180deg, rgba(16, 17, 16, 0.94), rgba(7, 8, 8, 0.92));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.72);
  padding: 18px;
  pointer-events: auto;
}

.character-lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(215, 169, 74, 0.18);
  padding-bottom: 12px;
}

.character-lobby-header h2,
.lobby-section h3,
.creation-title-row h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: #fff7e8;
}

.character-lobby-header h2 {
  font-size: 24px;
}

.lobby-account {
  display: block;
  margin-bottom: 2px;
  color: var(--gold);
  font-size: 12px;
  text-transform: uppercase;
}

.lobby-columns {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
  gap: 14px;
}

.lobby-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  border: 1px solid rgba(215, 169, 74, 0.22);
  background: rgba(4, 5, 5, 0.34);
  padding: 12px;
}

.lobby-character-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
}

.lobby-character,
.creation-choice {
  width: 100%;
  min-width: 0;
  border-radius: 0;
  text-align: left;
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(215, 169, 74, 0.24);
}

.lobby-character {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 66px;
}

.lobby-character:hover,
.creation-choice:hover {
  border-color: rgba(244, 209, 138, 0.68);
  background: rgba(215, 169, 74, 0.1);
}

.lobby-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  aspect-ratio: 1;
  border: 1px solid rgba(127, 176, 106, 0.38);
  background: rgba(31, 54, 32, 0.54);
  color: #d9efc8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 800;
}

.lobby-character-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.lobby-character-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff7e8;
}

.lobby-character-main small,
.creation-choice span,
.creation-help,
.lobby-empty,
.lobby-status {
  color: var(--muted);
  font-size: 12px;
}

.lobby-level {
  color: var(--gold);
  font-size: 12px;
  white-space: nowrap;
}

.creation-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.creation-help {
  min-height: 34px;
  margin: 0;
  white-space: pre-line;
}

.creation-option-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  overflow-y: auto;
}

.creation-choice {
  display: grid;
  gap: 4px;
  min-height: 62px;
  padding: 9px;
}

.creation-choice strong {
  color: #f4d18a;
}

.creation-choice span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.creation-name-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.creation-name-form[hidden] {
  display: none;
}

.lobby-status {
  min-height: 18px;
  margin: 0;
  color: #e6c271;
}

body.auth-mode .mmo-topbar,
body.auth-mode .visual-toolbar,
body.auth-mode .visual-chat-panel,
body.auth-mode .character-card,
body.auth-mode .directions-panel,
body.auth-mode .entity-dock,
body.auth-mode .floating-window,
body.auth-mode .side-panel,
body.auth-mode .floating-label {
  display: none;
}

body.no-character-mode .mmo-topbar,
body.no-character-mode .visual-toolbar,
body.no-character-mode .visual-chat-panel,
body.no-character-mode .character-card,
body.no-character-mode .directions-panel,
body.no-character-mode .entity-dock,
body.no-character-mode .floating-window,
body.no-character-mode .floating-label {
  display: none;
}

.mmo-topbar {
  position: absolute;
  z-index: 20;
  top: 10px;
  left: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto auto minmax(180px, auto);
  gap: 8px;
  align-items: stretch;
  pointer-events: none;
}

.hud-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(215, 169, 74, 0.28);
  background: linear-gradient(180deg, rgba(18, 15, 10, 0.92), rgba(8, 9, 9, 0.9));
  box-shadow: 0 8px 22px var(--shadow);
  color: #ead9b6;
  padding: 5px 11px;
  font-size: 13px;
}

.hud-chip:not(.room-chip) {
  white-space: nowrap;
}

.room-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  align-items: start;
  pointer-events: auto;
  cursor: pointer;
}

.room-chip:hover,
.room-chip:focus-visible {
  border-color: rgba(244, 209, 138, 0.72);
  background: linear-gradient(180deg, rgba(31, 25, 14, 0.96), rgba(12, 12, 10, 0.92));
}

.room-chip:focus-visible {
  outline: 1px solid rgba(244, 209, 138, 0.72);
  outline-offset: 2px;
}

.room-title {
  min-width: 0;
}

.hud-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border: 1px solid rgba(127, 176, 106, 0.45);
  background: rgba(31, 54, 32, 0.56);
  color: #bfe1a7;
  font-size: 11px;
  font-weight: 800;
}

.visual-toolbar {
  position: absolute;
  z-index: 70;
  top: var(--top-controls-top);
  left: var(--toolbar-left);
  right: var(--toolbar-right);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  pointer-events: auto;
}

.visual-toolbar button {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 66px;
  min-height: 62px;
  padding: 5px 6px;
  border-radius: 0;
  border-color: rgba(215, 169, 74, 0.32);
  background: rgba(9, 10, 9, 0.72);
  color: #ead9b6;
  box-shadow: 0 8px 20px var(--shadow);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
}

.visual-toolbar button span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 2px solid rgba(215, 169, 74, 0.58);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(215, 169, 74, 0.18), rgba(10, 12, 14, 0.9));
  color: #f4d18a;
  font-weight: 800;
}

.eyebrow,
.panel-label {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  max-width: 100%;
  margin: 0;
  color: #fff7e8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.1;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vitals {
  display: grid;
  gap: 7px;
}

.vitals span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  border: 1px solid rgba(244, 234, 214, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 4px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.visual-chat-panel,
.character-card,
.directions-panel,
.floating-window,
.entity-strip {
  border: 1px solid rgba(215, 169, 74, 0.3);
  background: linear-gradient(180deg, rgba(12, 13, 12, 0.9), rgba(7, 8, 8, 0.84));
  box-shadow: 0 10px 28px var(--shadow);
}

.visual-chat-panel {
  position: absolute;
  z-index: 20;
  top: var(--top-controls-top);
  left: 10px;
  width: min(var(--left-panel-width), calc(100% - 34px));
  height: min(var(--chat-panel-height), calc(100% - 350px));
  min-height: 220px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.visual-chat-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid rgba(215, 169, 74, 0.22);
}

.visual-chat-tabs button {
  position: relative;
  min-height: 32px;
  border: 0;
  border-right: 1px solid rgba(215, 169, 74, 0.16);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.035);
  color: #b8aa90;
  padding: 0 5px;
  font-size: 11px;
}

.visual-chat-tabs button.active {
  color: #f4d18a;
  background: rgba(215, 169, 74, 0.14);
}

.visual-chat-tabs button.has-unread::after {
  content: attr(data-unread);
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  border: 1px solid rgba(7, 8, 8, 0.72);
  background: var(--red);
  color: #fff7e8;
  padding: 0 3px;
  font: 9px/13px Consolas, "Cascadia Mono", monospace;
}

.visual-chat-log {
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.32;
}

.visual-chat-line {
  margin: 0 0 8px;
  color: #dbcaa6;
}

.visual-chat-line.system {
  color: #a9d684;
}

.visual-chat-line.general {
  color: #7fb8d8;
}

.visual-chat-line.group,
.visual-chat-line.guild {
  color: #c7a7e6;
}

.visual-chat-line.combat {
  color: #e2a66f;
}

.visual-chat-line.error {
  color: #e18870;
}

.log-line .ansi-bright,
.visual-chat-line .ansi-bright {
  font-weight: 800;
}

.log-line .ansi-dim,
.visual-chat-line .ansi-dim {
  opacity: 0.78;
}

.log-line .ansi-fg-black,
.visual-chat-line .ansi-fg-black {
  color: #8b8375;
}

.log-line .ansi-fg-red,
.visual-chat-line .ansi-fg-red {
  color: #ff8068;
}

.log-line .ansi-fg-green,
.visual-chat-line .ansi-fg-green {
  color: #8fe26b;
}

.log-line .ansi-fg-yellow,
.visual-chat-line .ansi-fg-yellow {
  color: #f1c45f;
}

.log-line .ansi-fg-blue,
.visual-chat-line .ansi-fg-blue {
  color: #79b7ff;
}

.log-line .ansi-fg-magenta,
.visual-chat-line .ansi-fg-magenta {
  color: #ef9edc;
}

.log-line .ansi-fg-cyan,
.visual-chat-line .ansi-fg-cyan {
  color: #77d9ef;
}

.log-line .ansi-fg-white,
.visual-chat-line .ansi-fg-white {
  color: #fff1d3;
}

.visual-chat-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid rgba(215, 169, 74, 0.18);
  padding: 6px 8px;
}

.visual-chat-tools span {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visual-chat-tools button {
  min-height: 26px;
  border-radius: 0;
  padding: 0 8px;
  font-size: 11px;
}

.character-card {
  position: absolute;
  z-index: 20;
  left: 10px;
  bottom: 10px;
  width: min(var(--left-panel-width), calc(100% - 34px));
  padding: 8px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -2px 0 8px;
  color: #f0d7a1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
}

.panel-title button,
.floating-window header button {
  min-width: 28px;
  min-height: 26px;
  padding: 0;
  border-radius: 0;
}

.character-summary {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  align-items: center;
}

.character-portrait {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1px solid rgba(215, 169, 74, 0.34);
  background:
    radial-gradient(circle at 45% 34%, rgba(111, 167, 200, 0.4), transparent 22%),
    linear-gradient(135deg, rgba(52, 70, 54, 0.85), rgba(17, 13, 11, 0.95));
  color: #f4d18a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
}

.character-summary h2 {
  margin: 0 0 4px;
  color: #fff3d8;
  font-size: 16px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.character-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  margin: 10px 0 0;
  font-size: 12px;
}

.character-stats div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.character-stats dt {
  color: var(--muted);
}

.character-stats dd {
  margin: 0;
  color: #f1ddb4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directions-panel {
  position: absolute;
  z-index: 20;
  top: var(--top-controls-top);
  right: 10px;
  width: var(--directions-width);
  padding: 9px;
}

.directions-panel .panel-label {
  text-align: center;
  color: #f0d7a1;
  font-family: Georgia, "Times New Roman", serif;
  text-transform: none;
  font-size: 15px;
}

.direction-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.direction-grid button {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 54px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.055);
  color: #d8c6a1;
  padding: 4px;
  font-size: 11px;
}

.direction-grid button span {
  color: #f4d18a;
  font-size: 14px;
  font-weight: 800;
}

.direction-grid button.available {
  border-color: rgba(127, 176, 106, 0.48);
  background: rgba(55, 80, 42, 0.24);
}

.direction-grid button.blocked {
  border-color: rgba(142, 118, 72, 0.24);
  background: rgba(88, 70, 38, 0.12);
  color: #766d5f;
  cursor: not-allowed;
  opacity: 0.58;
}

.direction-grid button.blocked span {
  color: #8b7b60;
}

.direction-grid button.unavailable,
.direction-grid button:disabled {
  border-color: rgba(244, 234, 214, 0.08);
  background: rgba(255, 255, 255, 0.025);
  color: #6f6758;
  cursor: not-allowed;
  opacity: 0.52;
}

.direction-grid button.unavailable span,
.direction-grid button:disabled span {
  color: #7a705d;
}

.direction-grid button.blocked:disabled {
  border-color: rgba(142, 118, 72, 0.24);
  background: rgba(88, 70, 38, 0.12);
  color: #766d5f;
  opacity: 0.58;
}

.direction-grid button.blocked:disabled span {
  color: #8b7b60;
}

.room-description {
  margin: 3px 0 0;
  color: rgba(244, 234, 214, 0.86);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.65);
}

.entity-dock {
  position: absolute;
  z-index: 20;
  left: var(--entity-dock-left);
  right: 10px;
  bottom: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.entity-strip {
  padding: 7px 8px 8px;
  overflow: hidden;
}

.entity-strip header {
  color: #f0d7a1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  margin-bottom: 6px;
}

.entity-list {
  display: flex;
  gap: 8px;
  min-height: 64px;
  overflow-x: auto;
  overflow-y: hidden;
}

.entity-empty {
  color: var(--muted);
  font-size: 12px;
  align-self: center;
}

.entity-card {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(84px, 1fr);
  gap: 7px;
  align-items: center;
  flex: 0 0 168px;
  min-height: 62px;
  border: 1px solid rgba(215, 169, 74, 0.22);
  border-radius: 0;
  background: rgba(7, 8, 8, 0.78);
  color: #ead9b6;
  padding: 6px;
  text-align: left;
}

.entity-card:hover,
.entity-card:focus {
  border-color: rgba(244, 209, 138, 0.75);
  background: rgba(215, 169, 74, 0.11);
}

.entity-card.hostile {
  border-color: rgba(208, 106, 79, 0.5);
}

.entity-card.in-combat {
  border-color: rgba(221, 73, 44, 0.78);
  box-shadow: inset 0 0 0 1px rgba(221, 73, 44, 0.18);
}

.entity-card.preparing {
  border-color: rgba(88, 168, 226, 0.72);
  box-shadow: inset 0 0 0 1px rgba(88, 168, 226, 0.18);
}

.entity-avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  aspect-ratio: 1;
  border: 1px solid rgba(244, 234, 214, 0.18);
  background:
    radial-gradient(circle at 42% 30%, rgba(244, 209, 138, 0.2), transparent 24%),
    linear-gradient(135deg, rgba(37, 50, 40, 0.94), rgba(8, 8, 8, 0.96));
  color: #f4d18a;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
}

.entity-initials {
  line-height: 1;
}

.entity-kind-mark,
.entity-combat-mark,
.entity-prepare-mark {
  position: absolute;
  border: 1px solid rgba(244, 209, 138, 0.45);
  background: rgba(6, 8, 8, 0.88);
  color: #f4d18a;
  font-family: "Segoe UI", sans-serif;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  padding: 2px 3px;
}

.entity-kind-mark {
  top: 3px;
  left: 3px;
}

.entity-combat-mark {
  right: 3px;
  bottom: 3px;
  border-color: rgba(221, 73, 44, 0.72);
  color: #ffb59b;
}

.entity-prepare-mark {
  left: 3px;
  bottom: 3px;
  border-color: rgba(88, 168, 226, 0.72);
  color: #b7e2ff;
}

.entity-info {
  min-width: 0;
}

.entity-name {
  display: block;
  overflow: hidden;
  color: #fff3d8;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radial-menu {
  --radial-size: 224px;
  position: fixed;
  z-index: 120;
  width: var(--radial-size);
  height: var(--radial-size);
  margin: calc(var(--radial-size) / -2) 0 0 calc(var(--radial-size) / -2);
  border: 1px solid rgba(215, 169, 74, 0.5);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(18, 19, 18, 0.98) 0 28%, rgba(12, 10, 7, 0.92) 29% 58%, rgba(6, 7, 7, 0.88) 59% 100%);
  box-shadow: 0 14px 34px var(--shadow);
}

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

.radial-title {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 84px;
  min-height: 38px;
  transform: translate(-50%, -58%);
  color: #f4d18a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
}

.radial-hint {
  position: absolute;
  left: 50%;
  top: calc(50% + 28px);
  width: 106px;
  transform: translateX(-50%);
  color: var(--muted);
  font: 10px/1.2 Consolas, "Cascadia Mono", monospace;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radial-action {
  position: absolute;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  width: 78px;
  min-height: 42px;
  border-radius: 0;
  border-color: rgba(215, 169, 74, 0.38);
  background: rgba(7, 8, 8, 0.92);
  color: #ead9b6;
  padding: 4px 6px;
  font-size: 10px;
  text-align: left;
}

.radial-action:hover,
.radial-action:focus {
  border-color: rgba(244, 209, 138, 0.78);
  background: rgba(215, 169, 74, 0.18);
}

.radial-action.danger {
  border-color: rgba(208, 106, 79, 0.58);
}

.radial-action.danger .radial-icon {
  color: #f3b197;
}

.radial-action.social .radial-icon {
  color: #c7a7e6;
}

.radial-action.utility .radial-icon {
  color: #a9d684;
}

.radial-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(244, 234, 214, 0.18);
  background: rgba(255, 255, 255, 0.045);
  color: #f4d18a;
  font-size: 9px;
  font-weight: 800;
}

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

.floating-window {
  position: absolute;
  z-index: 35;
  top: 230px;
  right: 36px;
  width: min(var(--floating-width), calc(100% - 390px));
  min-width: 310px;
  max-height: min(var(--floating-max-height), calc(100% - 300px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.floating-window[hidden] {
  display: none;
}

.floating-window header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  border-bottom: 1px solid rgba(215, 169, 74, 0.25);
  color: #f0d7a1;
  font-family: Georgia, "Times New Roman", serif;
  padding: 4px 8px;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.floating-window.dragging {
  opacity: 0.96;
}

.floating-window header button {
  cursor: pointer;
}

.inventory-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  padding: 8px 10px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
  min-height: 150px;
  overflow-y: auto;
  padding: 0 10px 10px;
}

.inventory-slot {
  position: relative;
  display: grid;
  grid-template-rows: 28px auto auto;
  gap: 2px;
  place-items: center;
  min-height: 64px;
  border: 1px solid rgba(244, 234, 214, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #e2c479;
  padding: 5px 4px;
  font-size: 10px;
  text-align: center;
  overflow: hidden;
}

.inventory-slot.equipped {
  border-color: rgba(127, 176, 106, 0.55);
}

.inventory-slot.rarity-uncommon {
  border-color: rgba(111, 167, 200, 0.52);
  background: rgba(38, 70, 90, 0.22);
}

.inventory-slot.rarity-rare {
  border-color: rgba(199, 167, 230, 0.6);
  background: rgba(68, 48, 90, 0.24);
}

.inventory-slot.empty {
  color: rgba(184, 170, 144, 0.34);
}

.item-icon,
.equipment-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(244, 234, 214, 0.18);
  background: rgba(255, 255, 255, 0.045);
  color: #f4d18a;
  font-size: 10px;
  font-weight: 800;
}

.item-weapon {
  color: #f3b197;
}

.item-armor {
  color: #d9c48e;
}

.item-potion {
  color: #a9d684;
}

.item-key {
  color: #e8c86f;
}

.item-trophy {
  color: #c7a7e6;
}

.item-name {
  max-width: 100%;
  overflow: hidden;
  color: #fff3d8;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  max-width: 100%;
  min-height: 13px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-empty-mark {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(184, 170, 144, 0.18);
  background: rgba(255, 255, 255, 0.025);
}

.inventory-text {
  max-height: 104px;
  margin: 0;
  border-top: 1px solid rgba(215, 169, 74, 0.22);
  color: #cab996;
  font: 12px/1.35 Consolas, "Cascadia Mono", monospace;
  overflow: auto;
  padding: 8px 10px;
  white-space: pre-wrap;
}

.sheet-window {
  left: var(--toolbar-left);
  right: auto;
  top: 170px;
  width: min(var(--sheet-window-width), calc(100% - 640px));
}

.equipment-window {
  top: 190px;
  right: 36px;
  width: min(var(--equipment-window-width), calc(100% - 390px));
}

.map-window {
  top: 382px;
  right: 36px;
  width: min(var(--map-window-width), calc(100% - 390px));
}

.ui-settings-window {
  left: 50%;
  right: auto;
  top: 150px;
  width: min(360px, calc(100% - 390px));
  transform: translateX(-50%);
}

.ui-settings-window[style*="left"] {
  transform: none;
}

.room-info-window {
  left: 22px;
  right: auto;
  top: 54px;
  width: min(460px, calc(100% - 44px));
  grid-template-rows: auto minmax(0, 1fr);
}

.room-info-body {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding: 12px;
}

.room-info-body h2,
.room-info-body h3 {
  margin: 0;
  color: #f0d7a1;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.room-info-body h2 {
  font-size: 19px;
}

.room-info-body h3 {
  font-size: 13px;
}

.room-info-body p {
  margin: 0;
  color: #ead9b6;
  font-size: 14px;
  line-height: 1.45;
}

.room-info-section {
  display: grid;
  gap: 8px;
}

.room-info-exits {
  display: grid;
  gap: 6px;
}

.room-info-exit {
  display: grid;
  grid-template-columns: minmax(74px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(215, 169, 74, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: #d8c6a1;
  padding: 6px 8px;
}

.room-info-exit strong {
  color: #f4d18a;
  font-size: 12px;
  text-transform: capitalize;
}

.room-info-exit.blocked {
  border-color: rgba(142, 118, 72, 0.22);
  background: rgba(82, 62, 33, 0.16);
  color: #9d907a;
}

.room-info-exit.blocked strong {
  color: #b69a62;
}

.room-info-exit span {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.3;
}

.room-info-empty {
  color: var(--muted);
  font-size: 13px;
}

.ui-settings-body {
  display: grid;
  gap: 14px;
  padding: 12px;
}

.ui-settings-body section {
  display: grid;
  gap: 8px;
}

.ui-settings-body h3 {
  margin: 0;
  color: #f0d7a1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.segmented-control button {
  min-height: 34px;
  border-radius: 0;
  color: #d8c6a1;
  background: rgba(255, 255, 255, 0.045);
  padding: 0 6px;
  font-size: 12px;
}

.segmented-control button.active,
.segmented-control button[aria-pressed="true"] {
  border-color: rgba(244, 209, 138, 0.68);
  background: rgba(215, 169, 74, 0.18);
  color: #f4d18a;
}

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

.ui-settings-actions button {
  min-height: 36px;
  border-radius: 0;
  padding: 0 8px;
  font-size: 12px;
}

.sheet-body {
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
}

.sheet-identity {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.sheet-identity .character-portrait {
  font-size: 24px;
}

.sheet-identity h3 {
  margin: 0 0 4px;
  color: #fff3d8;
  font-size: 18px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-identity p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.sheet-bars {
  display: grid;
  gap: 7px;
  margin: 12px 0;
}

.sheet-bar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  min-height: 28px;
  align-items: center;
  border: 1px solid rgba(244, 234, 214, 0.14);
  background: rgba(255, 255, 255, 0.035);
  color: #ead9b6;
  padding: 4px 8px;
  overflow: hidden;
}

.sheet-bar span,
.sheet-bar strong {
  position: relative;
  z-index: 1;
  font-size: 12px;
}

.sheet-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(127, 176, 106, 0.28);
}

.sheet-bar.mana i {
  background: rgba(111, 167, 200, 0.28);
}

.sheet-bar.stamina i {
  background: rgba(215, 169, 74, 0.26);
}

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

.sheet-grid div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(244, 234, 214, 0.12);
  background: rgba(255, 255, 255, 0.035);
  padding: 7px 8px;
  min-width: 0;
}

.sheet-grid span {
  color: var(--muted);
  font-size: 12px;
}

.sheet-grid strong {
  color: #f1ddb4;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-slots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
}

.equipment-slot {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 76px;
  border-radius: 0;
  border-color: rgba(244, 234, 214, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #ead9b6;
  padding: 8px;
  text-align: left;
}

.equipment-slot.filled {
  border-color: rgba(127, 176, 106, 0.48);
  background: rgba(45, 70, 39, 0.22);
}

.equipment-slot.rarity-uncommon {
  border-color: rgba(111, 167, 200, 0.52);
  background: rgba(38, 70, 90, 0.2);
}

.equipment-slot.rarity-rare {
  border-color: rgba(199, 167, 230, 0.6);
  background: rgba(68, 48, 90, 0.22);
}

.equipment-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.equipment-slot-name {
  color: var(--gold);
  font-size: 11px;
  text-transform: uppercase;
}

.equipment-slot strong {
  color: #fff3d8;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipment-slot small {
  color: var(--muted);
  font-size: 11px;
}

.item-bonus-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.item-bonus-row span {
  border: 1px solid rgba(244, 234, 214, 0.13);
  background: rgba(255, 255, 255, 0.045);
  color: #ead9b6;
  padding: 1px 4px;
  font-size: 10px;
}

.equipment-summary {
  border-top: 1px solid rgba(215, 169, 74, 0.22);
  color: var(--muted);
  font-size: 12px;
  padding: 8px 10px;
}

.map-body {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
}

.map-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.map-tabs button {
  min-height: 30px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.035);
  color: #b8aa90;
  padding: 0 8px;
  font-size: 12px;
}

.map-tabs button.active,
.map-tabs button[aria-selected="true"] {
  border-color: rgba(215, 169, 74, 0.58);
  background: rgba(215, 169, 74, 0.16);
  color: #f4d18a;
}

.map-panel {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.map-panel[hidden] {
  display: none;
}

.map-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.map-room-name {
  color: #f0d7a1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-header button {
  min-height: 28px;
  border-radius: 0;
  padding: 0 8px;
  font-size: 11px;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.map-cell {
  min-height: 34px;
  border-radius: 0;
  border-color: rgba(244, 234, 214, 0.14);
  background: rgba(255, 255, 255, 0.035);
  color: #b8aa90;
  padding: 3px;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-cell.current {
  border-color: rgba(215, 169, 74, 0.62);
  background: rgba(215, 169, 74, 0.16);
  color: #f4d18a;
}

.map-cell.visited:not(.current) {
  border-color: rgba(111, 167, 200, 0.46);
  background: rgba(40, 62, 74, 0.22);
  color: #cce6f3;
}

.map-cell.known:not(.visited) {
  border-color: rgba(184, 170, 144, 0.26);
  background: rgba(255, 255, 255, 0.06);
}

.map-cell.available {
  border-color: rgba(127, 176, 106, 0.48);
  background: rgba(55, 80, 42, 0.2);
  color: #dff0c4;
}

.map-exit-list {
  display: grid;
  gap: 6px;
}

.map-exit-list button,
.map-exit-list p {
  min-height: 32px;
  margin: 0;
  border: 1px solid rgba(244, 234, 214, 0.12);
  background: rgba(255, 255, 255, 0.035);
  color: #ead9b6;
  padding: 7px 8px;
  font-size: 12px;
  text-align: left;
}

.map-exit-list button.visited {
  border-color: rgba(111, 167, 200, 0.42);
  color: #cce6f3;
}

.world-map-panel {
  align-content: start;
}

.world-map-frame {
  display: grid;
  place-items: center;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid rgba(215, 169, 74, 0.26);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.18)),
    rgba(8, 10, 11, 0.72);
}

.world-map-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
}

.world-region-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 6px;
}

.world-region-card {
  display: grid;
  gap: 3px;
  min-height: 78px;
  align-content: start;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.035);
  color: #ead9b6;
  padding: 8px;
  text-align: left;
}

.world-region-card.good {
  border-color: rgba(111, 167, 200, 0.44);
}

.world-region-card.evil {
  border-color: rgba(208, 106, 79, 0.46);
}

.world-region-card.neutral {
  border-color: rgba(215, 169, 74, 0.34);
}

.world-region-card.current {
  border-color: rgba(244, 209, 138, 0.78);
  background: rgba(215, 169, 74, 0.14);
  box-shadow: inset 0 0 0 1px rgba(244, 209, 138, 0.2);
}

.world-region-title {
  color: #fff3d8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.1;
}

.world-region-meta,
.world-region-role {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.world-region-role {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.world-route-list {
  display: grid;
  gap: 6px;
}

.world-route-list h3 {
  margin: 2px 0 0;
  color: #f0d7a1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
}

.world-route-card {
  display: grid;
  gap: 2px;
  border: 1px solid rgba(244, 234, 214, 0.12);
  background: rgba(255, 255, 255, 0.035);
  color: #ead9b6;
  padding: 7px 8px;
}

.world-route-card.current {
  border-color: rgba(127, 176, 106, 0.5);
  background: rgba(55, 80, 42, 0.2);
}

.world-route-card strong {
  color: #f4d18a;
  font-size: 12px;
}

.world-route-card span,
.world-route-card small,
.world-empty {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.world-empty {
  margin: 0;
  border: 1px solid rgba(244, 234, 214, 0.12);
  background: rgba(255, 255, 255, 0.035);
  padding: 8px;
}

.side-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--panel-strong);
}

.connection-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.connection-bar label {
  color: var(--muted);
  font-size: 13px;
}

.connection-status {
  grid-column: 2 / 6;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.connection-status.online {
  color: #a8d892;
}

.connection-status.warning {
  color: #e6c271;
}

.connection-status.offline {
  color: var(--red);
}

.access-key-panel {
  grid-column: 1 / 6;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding-top: 2px;
}

.access-key-panel[hidden] {
  display: none;
}

.access-key-panel label {
  grid-column: 1 / 5;
}

.access-key-panel input {
  height: 36px;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 12px;
}

.access-key-panel button {
  min-height: 34px;
  padding: 0 10px;
}

input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid rgba(244, 234, 214, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus {
  border-color: rgba(215, 169, 74, 0.72);
  box-shadow: 0 0 0 3px rgba(215, 169, 74, 0.12);
}

button {
  min-height: 38px;
  border: 1px solid rgba(215, 169, 74, 0.34);
  border-radius: 6px;
  background: rgba(215, 169, 74, 0.12);
  color: #ffe3a3;
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  background: rgba(215, 169, 74, 0.2);
}

.output-panel {
  min-height: 0;
  overflow: hidden;
}

.output-log {
  height: 100%;
  overflow-y: auto;
  padding: 16px;
  color: #eadfc9;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.log-line {
  margin: 0 0 10px;
}

.log-system {
  color: var(--blue);
}

.log-error {
  color: var(--red);
}

.command-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
}

.floating-label {
  position: absolute;
  z-index: 10;
  transform: translate(-50%, -50%);
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(10, 12, 14, 0.72);
  color: #fff3d8;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

@container (max-width: 1700px) {
  .mmo-topbar {
    top: 8px;
    left: 8px;
    right: 8px;
    grid-template-columns: minmax(240px, 1fr) auto auto minmax(150px, auto);
    gap: 6px;
  }

  .hud-chip {
    min-height: 32px;
    padding: 4px 9px;
    font-size: 12px;
  }

  .room-description {
    max-width: 70ch;
  }

  .visual-toolbar,
  .visual-chat-panel,
  .directions-panel {
    top: 68px;
  }

  .visual-toolbar {
    left: calc(var(--left-panel-width) + 18px);
    right: calc(var(--directions-width) + 18px);
    gap: 7px;
  }

  .visual-toolbar button {
    width: 58px;
    min-height: 56px;
    padding: 4px 5px;
    font-size: 11px;
  }

  .visual-toolbar button span {
    width: 31px;
    height: 31px;
  }

  .visual-chat-panel {
    width: min(var(--left-panel-width), calc(100% - var(--directions-width) - 42px));
    height: min(300px, calc(100% - 350px));
  }

  .directions-panel {
    width: min(var(--directions-width), 220px);
  }
}

@container (max-width: 1240px) {
  .mmo-topbar {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  #worldWeather {
    display: none;
  }

  .visual-toolbar {
    top: 66px;
    left: 8px;
    right: 8px;
    justify-content: center;
  }

  .visual-chat-panel {
    top: 138px;
    width: min(310px, calc(100% - 236px));
    height: 220px;
  }

  .directions-panel {
    top: 138px;
    right: 8px;
    width: 210px;
  }

  .direction-grid {
    gap: 5px;
  }

  .direction-grid button {
    min-height: 48px;
    font-size: 10px;
  }
}

@container (max-width: 760px) {
  .character-lobby-panel {
    padding: 12px;
  }

  .character-lobby-card {
    width: 100%;
    max-height: calc(100% - 24px);
    padding: 12px;
  }

  .character-lobby-header {
    align-items: stretch;
    flex-direction: column;
  }

  .lobby-columns {
    grid-template-columns: 1fr;
  }

  .creation-option-grid {
    grid-template-columns: 1fr;
  }

  .mmo-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #worldDate,
  #worldWeather {
    display: none;
  }

  .visual-toolbar {
    top: 66px;
    overflow-x: auto;
    justify-content: flex-start;
    flex-wrap: nowrap;
  }

  .visual-chat-panel {
    top: 136px;
    left: 8px;
    right: 8px;
    width: auto;
    height: 190px;
  }

  .directions-panel {
    top: 338px;
    left: 8px;
    right: 8px;
    width: auto;
  }
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(1320px, auto) minmax(420px, 44vh);
    height: auto;
    min-height: 100vh;
  }

  body.auth-mode .app-shell {
    grid-template-rows: minmax(100vh, auto);
    height: 100vh;
  }

  .scene-shell {
    min-height: 1320px;
  }

  body.auth-mode .scene-shell {
    min-height: 100vh;
  }

  body.no-character-mode .app-shell {
    grid-template-rows: minmax(900px, auto) minmax(360px, 36vh);
  }

  body.no-character-mode .scene-shell {
    min-height: 900px;
  }

  .side-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  h1 {
    font-size: 15px;
  }

  .mmo-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #worldDate,
  #worldWeather {
    display: none;
  }

  .visual-toolbar {
    top: 90px;
    left: 10px;
    right: 10px;
    transform: none;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .visual-chat-panel {
    top: 236px;
    right: 10px;
    width: auto;
    height: 180px;
    min-height: 0;
  }

  .directions-panel {
    top: 430px;
    left: 10px;
    right: 10px;
    width: auto;
  }

  .character-card {
    top: 780px;
    left: 10px;
    right: 10px;
    bottom: auto;
    width: auto;
  }

  .entity-dock {
    top: 1070px;
    left: 10px;
    right: 10px;
    bottom: auto;
  }

  .floating-window {
    left: 10px;
    right: 10px;
    width: auto;
    min-width: 0;
  }
}
