/* Оболочка по макету: тёмная бронзовая шапка, бордовая панель, льняной центр и чат. */
body.trail-frame {
  --command-side: clamp(268px, 17.2vw, 332px);
  --command-header: clamp(64px, 7.2vh, 76px);
  --frame-linen: #f3e4d4;
  --shell-ink: #3e291d;
  --shell-bronze: #c4a36a;
  --shell-bronze-deep: #8d6a38;
}
.workspace { background: #f3e4d4 url("textures/linen.webp") center / 512px repeat; }
#game-frame-header {
  display: grid;
  grid-template-columns: var(--command-side) minmax(0, 1fr);
  grid-template-rows: var(--command-header);
  align-items: stretch;
  height: var(--command-header);
  gap: 0;
  padding: 0;
  overflow: visible;
  color: #f6ead8;
  background:
    linear-gradient(180deg, rgba(255, 226, 186, .07), transparent 36%, rgba(0, 0, 0, .2)),
    #241c17 url("textures/header.webp") center / 128px repeat;
  box-shadow: inset 0 -1px 0 #8d6a38;
}
#game-frame-header::after { content: none; }
.identity {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 100%;
  padding: 6px 12px 8px;
  box-sizing: border-box;
}
.level-orb {
  position: relative;
  flex: none;
  width: 52px;
  height: 52px;
  max-width: calc(var(--command-header) - 10px);
  max-height: calc(var(--command-header) - 10px);
}
.orb-well {
  position: absolute;
  left: 16%;
  top: 16%;
  right: 16%;
  bottom: 16%;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 38% 28%, rgba(255, 248, 220, .45), rgba(120, 64, 16, .2) 72%);
}
.orb-liquid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(180deg, #ffe9a6 0%, #f0b01c 46%, #c56e0e 100%);
  box-shadow: inset 0 2px 0 rgba(255, 248, 214, .8);
}
.orb-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.orb-level {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff8e8;
  font: 700 16px/1 Georgia, serif;
  text-shadow: 0 1px 2px #3a2208, 0 0 6px #e7b45a;
  pointer-events: none;
}
.identity-text { flex: 1; min-width: 0; display: grid; gap: 3px; }
.identity-name { display: flex; align-items: center; gap: 4px; min-width: 0; }
#game-account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f6ead8;
  font-size: clamp(14px, 1.15vw, 18px);
  text-shadow: 0 1px 1px #000a;
}
.name-badge { width: 18px; height: 18px; flex: none; opacity: .9; }
.name-badge.is-live { opacity: 1; filter: drop-shadow(0 0 3px #e6b34a); }
.identity-bars { display: grid; gap: 3px; }
.identity .vital { position: relative; display: block; flex: none; min-width: 0; }
.identity .meter-track {
  display: block;
  height: 8px;
  position: relative;
  border: 1px solid #c4a36a;
  border-image: none;
  border-radius: 2px;
  background: #1a140f;
  overflow: hidden;
  box-sizing: border-box;
}
.identity .meter-ink { position: absolute; inset: 0; border-radius: inherit; background-repeat: no-repeat; }
.identity [data-meter=health] .meter-ink { background: linear-gradient(#ff5c4e, #c42722); }
.identity [data-meter=stamina] .meter-ink { background: linear-gradient(#7dce45, #3a9a28); }
.shell-tip {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 80;
  padding: 3px 8px;
  border: 1px solid var(--shell-bronze);
  border-radius: 4px;
  background: #f7efe4;
  color: var(--shell-ink);
  font: 13px/1.3 Georgia, serif;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 4px 12px #0004;
}
.level-orb:hover .shell-tip,
.level-orb:focus-visible .shell-tip,
.vital:hover .shell-tip,
.vital:focus-visible .shell-tip { opacity: 1; }
.hud-band {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  height: 100%;
}
.hud-keys {
  --character-menu-width: 168px;
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.character-menu-anchor { position: relative; flex: none; }
.character-menu {
  position: absolute;
  z-index: 1;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  width: var(--character-menu-width);
  margin: 0;
  padding: 2px 6px 4px;
  list-style: none;
  color: #eee0c9;
  background: linear-gradient(180deg, #403125, #241b16);
  border: 1px solid #82674a;
  border-top: 3px solid #bd955c;
  border-bottom-color: #a48764;
  box-shadow: 0 5px 12px #20170d85;
}
.character-menu button {
  display: block;
  min-height: 31px;
  margin-inline: auto;
  padding: 3px 4px;
  border: 0;
  color: inherit;
  background: transparent;
  font: 400 16px/1.25 "Trail Menu Serif", Georgia, serif;
  text-align: center;
  white-space: nowrap;
}
.character-menu button:is(:hover, :focus-visible) { color: #ffd58b; }
@media (prefers-reduced-motion: no-preference) {
  .character-menu:not([hidden]) { animation: character-menu-open 140ms ease-out; }
  @keyframes character-menu-open {
    from { opacity: 0; transform: translate(-50%, -5px); }
    to { opacity: 1; transform: translate(-50%, 0); }
  }
}
#shell-settings { grid-column: 3; justify-self: end; margin-right: 10px; }
.hud-keys .atlas-key,
.side-keys .side-key,
.frame-region-emblem.atlas-key,
#shell-settings.atlas-key {
  border: 0;
  border-image: none;
  border-radius: 0;
  box-shadow: none;
  background: none;
  padding: 0;
}
.hud-keys .atlas-key { width: 54px; height: 54px; flex: none; }
.hud-keys #character-menu-trigger[aria-expanded=true] img {
  border-radius: 7px;
  box-shadow: 0 0 0 1px #d1a667, 0 0 10px #d8a35945;
  filter: brightness(1.13);
}
#shell-settings.atlas-key { width: 46px; height: 46px; flex: none; }
.hud-keys .atlas-key img,
.side-keys .side-key img,
.frame-region-emblem.atlas-key img,
#shell-settings.atlas-key img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.hud-keys .atlas-key:hover,
.side-keys .side-key:hover,
.side-keys .side-key[aria-pressed="true"],
#shell-settings.atlas-key:hover,
.frame-region-emblem.atlas-key:hover { filter: brightness(1.08); }
.mail-lamp,
.hud-keys .atlas-key img.mail-lamp {
  display: none;
  position: absolute;
  top: -4px;
  right: -2px;
  width: 46%;
  height: 46%;
}
.hud-keys .atlas-key.has-mail img.mail-lamp {
  display: block;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(255, 176, 48, .85));
  animation: mail-glow 1.6s ease-in-out infinite;
}
@keyframes mail-glow { 50% { filter: drop-shadow(0 0 7px #ffd56a) brightness(1.12); } }
@media (prefers-reduced-motion: reduce) { .has-mail .mail-lamp { animation: none; } }
.shell-options {
  background: #f7efe4 url("textures/linen.webp") center / 512px repeat;
  color: var(--shell-ink);
  border: 1px solid var(--shell-bronze);
  border-image: none;
  border-radius: 8px;
}
#trail-command-sidebar {
  background: #5a1828 url("/landing/web-01/panel-red-cloth-v01.png") center / 480px repeat;
  color: #f6ead8;
  padding: 10px 8px 12px;
}
#trail-command-sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: 1px;
  background: #c4a36a;
  pointer-events: none;
}
#trail-command-sidebar:not(.is-open) .side-keys,
#trail-command-sidebar.is-open .side-keys {
  display: flex;
  justify-content: stretch;
  gap: 6px;
  width: 100%;
  margin: 0;
}
#trail-command-sidebar .side-key {
  flex: 1 1 0;
  width: auto;
  height: auto;
  aspect-ratio: 1;
  max-height: none;
}
#trail-command-sidebar .menu-divider {
  display: block;
  width: auto;
  height: 1px;
  margin: 10px 6px 8px;
  background: #d4b56a;
  position: relative;
}
#trail-command-sidebar .menu-divider::after { content: none; }
.nav-item { color: #f6efe6; }
#trail-command-sidebar .nav-name { text-shadow: 0 1px 1px rgba(40, 8, 12, .65); }
#game-window { background: #f3e4d4 url("textures/linen.webp") center / 512px repeat; }
#game-window > .shell-panel {
  position: absolute;
  z-index: 34;
  left: 12px;
  right: 12px;
  bottom: 10px;
  top: clamp(64px, 8vh, 92px);
  overflow: auto;
  padding: 16px 18px 22px;
  color: var(--shell-ink);
  background: #f7efe4 url("textures/linen.webp") center / 512px repeat;
  border: 2px solid var(--shell-bronze);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(62, 41, 29, .12);
}
.shell-panel h2 { margin: 0 88px 12px 0; font: 600 clamp(22px, 2vw, 30px)/1.2 Georgia, serif; }
.shell-panel h3 { margin: 16px 0 4px; font: 600 18px/1.3 Georgia, serif; }
.shell-panel p { margin: 6px 0; }
.shell-panel a { color: #7a2e32; }
#shell-panel-close,
#shell-account-mirror {
  border: 1px solid var(--shell-bronze);
  border-radius: 6px;
  background: #f3e4d4;
  color: var(--shell-ink);
  padding: 6px 12px;
}
#shell-panel-close { position: absolute; top: 12px; right: 12px; }
.shell-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.shell-links a { min-height: 44px; display: inline-flex; align-items: center; }
.shell-groups { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.shell-groups li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e4d0b4; padding: 6px 0; }
.stat-sheet { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 4px 22px; margin: 8px 0 0; }
.stat-sheet div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e4d0b4; padding: 5px 0; }
.stat-sheet dd { margin: 0; }
#shell-portrait {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: cover;
  border: 2px solid var(--shell-bronze);
  border-radius: 8px;
  background: #efe0cc;
}
#community-dock { background: #efe0cc url("textures/linen.webp") center / 512px repeat; }
#community-dock::before, #community-dock::after,
#chat-drawer::before, #chat-drawer::after { content: none; background: none; }
#chat-drawer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(5.5rem, 20%);
  grid-template-rows: auto minmax(0, 1fr) auto;
  column-gap: 8px;
  padding-top: 6px;
}
#chat-status { grid-column: 1; grid-row: 2; margin: 4px 8px 6px; }
#chat-roster {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 0;
  overflow: auto;
  margin: 4px 8px 6px 0;
  padding: 4px 4px 4px 8px;
  border-left: 1px solid #e0cbb0;
  color: var(--shell-ink);
}
.chat-compose { grid-column: 1 / -1; grid-row: 3; }
#chat-drawer .chat-tabs {
  position: static;
  transform: none;
  grid-column: 1;
  grid-row: 1;
  left: auto;
  top: auto;
  width: auto;
  display: flex;
  align-items: flex-end;
  gap: 2px 16px;
  margin: 0 10px;
  padding: 2px 2px 0;
  z-index: 2;
}
#chat-drawer .chat-tabs > button {
  flex: 0 0 auto;
  height: auto;
  min-width: 0;
  border: 0;
  border-image: none;
  border-radius: 0;
  background: transparent;
  color: #9a7d66;
  padding: 5px 0 6px;
  font-size: 15px;
  box-shadow: none;
}
#chat-drawer .chat-tabs > button:hover { background: transparent; color: #5c3b2c; }
#chat-drawer .chat-tabs > button[aria-selected=true] {
  background: transparent;
  color: #3e291d;
  height: auto;
  box-shadow: inset 0 -2px 0 #7a2430;
}
.chat-compose > input {
  border-image: none;
  border: 1px solid var(--shell-bronze);
  border-radius: 8px;
  background: #f7efe4;
  color: var(--shell-ink);
}
.chat-compose > button {
  border-image: none;
  border: 1px solid var(--shell-bronze);
  border-radius: 8px;
  background: linear-gradient(#4a3828, #2c2118);
  color: #f6ead8;
}
#chat-roster-empty { margin: 8px 0; color: #7a624c; }
#chat-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.roster-row { display: flex; align-items: center; gap: 4px; min-height: 26px; min-width: 0; }
.roster-badge { width: 16px; height: 16px; flex: none; opacity: .9; }
.roster-badge.is-live { opacity: 1; filter: drop-shadow(0 0 2px #e6b34a); }
.roster-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-level { flex: none; color: #8a6230; font-weight: 700; }
#chat-drawer:has(#chat-drawer-close[aria-expanded=false]) #chat-roster { display: none; }
.modal::backdrop { background: rgba(243, 228, 212, .72); }
@media (max-width: 1000px) {
  .hud-keys { gap: 4px; }
  .hud-keys .atlas-key, #shell-settings.atlas-key { width: 42px; height: 40px; }
}
@media (max-width: 700px) {
  body.trail-frame { --command-header: 96px; --command-side: 100%; }
  #game-frame-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 48px 44px;
    height: var(--command-header);
  }
  .frame-region-emblem.atlas-key { grid-column: 1; grid-row: 1; width: 40px; height: 40px; align-self: center; margin-left: 6px; }
  .identity { grid-column: 2; grid-row: 1; padding: 4px 6px; }
  .level-orb { width: 36px; height: 36px; }
  .hud-band { display: contents; }
  .hud-keys {
    --hud-key-width: clamp(34px, 10.5vw, 42px);
    --character-key-width: 44px;
    --hud-width: calc(var(--character-key-width) + 5 * (var(--hud-key-width) + 4px));
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
    margin-inline-start: max(
      calc((100% - var(--hud-width)) / 2),
      calc((var(--character-menu-width) - var(--character-key-width)) / 2 + 8px)
    );
  }
  .hud-keys .atlas-key { width: var(--hud-key-width); }
  #character-menu-trigger { width: var(--character-key-width); height: var(--character-key-width); }
  #shell-settings { grid-column: 3; grid-row: 1; align-self: center; width: 40px; height: 40px; }
  #trail-command-sidebar .side-keys { justify-content: flex-start; }
  #trail-command-sidebar .side-key { flex: 0 1 48px; width: auto; max-width: 48px; height: auto; }
  #chat-drawer .chat-tabs { overflow-x: auto; gap: 2px 12px; }
}
@media (pointer: coarse) {
  .character-menu button { min-height: 44px; }
}
@media (min-width: 701px) and (max-height: 510px) {
  body.trail-frame { --command-header: 52px; --command-side: clamp(220px, 28vw, 260px); }
  .level-orb { width: 34px; height: 34px; }
  .orb-level { font-size: 13px; }
  .hud-keys .atlas-key, #shell-settings.atlas-key { width: 34px; height: 32px; }
  #trail-command-sidebar .side-key { max-height: 40px; }
  .identity .meter-track { height: 4px; }
}
