/* Painted fittings are sliced at their bevels, keeping corner sizes independent of the control. */
body.trail-frame {
  --command-side: clamp(170px,16.15vw,285px);
  --command-header: clamp(52px,6.8vh,70px);
  --ink: #3e291d;
  --light: #f1dfbe;
  --paper: linear-gradient(155deg,#efe7d5,#e9dcc3);
  --paper-texture: url("/game/frame/atlas/plain-parchment.webp") center / cover no-repeat;
  --cloth: url("atlas/cloth.png");
  --stone: url("atlas/stone.png");
  margin: 0;
  color: var(--ink);
  font-family: Georgia,"Times New Roman",serif;
}
.workspace { background: #e5cda6 var(--paper-texture); }
.workspace :is(button,a,input,select,summary) { font: inherit; }
.workspace button { cursor:pointer; }
.workspace button:disabled,.workspace input:disabled { cursor:default; }
.workspace :focus-visible { outline: 2px solid #98621f; outline-offset: 2px; }
#game-frame-header {
  position:relative; z-index:45; display:grid; grid-template-columns:minmax(0,.85fr) minmax(0,3.25fr) minmax(56px,.8fr) auto;
  padding:0 clamp(9px,1vw,18px) 4px; gap:clamp(8px,1.2vw,20px); flex-wrap:nowrap;
  color:var(--light); background:#353633 var(--stone) repeat;
}
#game-frame-header::after {
  content:"";position:absolute;bottom:-2px;left:0;right:0;height:8px;z-index:2;pointer-events:none;
  background:url("atlas/edge-top.png") repeat-x center bottom / auto 9px;
}
.identity,.vitals,.vital,.quick-keys,.atlas-key,.purse-link,.side-keys,.side-key { display:flex;align-items:center; }
.identity { gap:8px;min-width:0; }
.identity>img {max-height:40px;max-width:40px;object-fit:contain;}
#game-account-name {font-size:clamp(15px,1.3vw,21px);}
.vitals { gap:clamp(10px,2.1vw,38px);min-width:0; }
.vital {flex:1;min-width:0;gap:3px;}
.vital>img {height:clamp(22px,2.5vw,41px);width:clamp(24px,2.5vw,41px);object-fit:contain;}
.meter-track {flex:1;min-width:0;height:clamp(20px,1.85vw,29px);position:relative;display:block;border:0 solid transparent;border-image:url("atlas/meter-track.png") 9 12 fill / 9px 12px stretch;}
.meter-ink {position:absolute;inset:23% 4.2% 22%; background-repeat:repeat-x;background-size:auto 100%;clip-path:inset(0 100% 0 0);}
[data-meter=health] .meter-ink {background-image:url("atlas/meter-health.png");}
[data-meter=stamina] .meter-ink {background-image:url("atlas/meter-stamina.png");}
[data-meter=xp] .meter-ink {background-image:url("atlas/meter-xp.png");}
.meter-text {position:absolute;inset:0;display:grid;place-items:center;font:600 clamp(11px,.85vw,14px)/1 Georgia,serif;color:#fff6de;text-shadow:0 1px 2px #21160e;}
.vital:not([data-value]) .meter-text {color:#d1c2a9;}
.purse-link {justify-content:center;width:fit-content;background:transparent;border:0;padding:3px;}
.purse-link img {width:clamp(30px,3.25vw,54px);}
.quick-keys {gap:clamp(3px,.55vw,10px);height:100%;position:relative;padding-left:clamp(9px,2.3vw,37px);background:url("atlas/hud-separator.png") left center/auto 78% no-repeat;}
.atlas-key,.side-key {position:relative;justify-content:center;border:0 solid transparent;box-sizing:border-box;padding:0;color:inherit;background:none; }
.atlas-key {width:clamp(37px,3.6vw,59px);height:clamp(37px,3.1vw,51px);border-image:url("atlas/hud-normal.png") 8 fill / 8px stretch;}
.atlas-key:hover,.atlas-key:focus-visible {border-image-source:url("atlas/hud-hover.png");}
.atlas-key[aria-expanded=true],.atlas-key:active {border-image-source:url("atlas/hud-selected.png");}
.atlas-key:disabled {border-image-source:url("atlas/hud-disabled.png");}
.atlas-key img {width:62%;height:70%;object-fit:contain;}
.frame-region-emblem.atlas-key {display:none;}
.shell-options {
  position:absolute;right:10px;top:calc(100% - 2px);display:grid;gap:12px;min-width:180px;z-index:60;
  background:#e7cfa7 var(--paper);color:var(--ink);padding:18px;
  border:0 solid transparent;border-image:url("atlas/chat-input.png") 11 / 8px stretch;
}
.shell-options :is(a,button) {color:inherit;text-align:left;}
#shell-options button {background:none;border:0;padding:4px 0;}
#trail-command-sidebar {
  display:block;grid-area:2 / 1 / 4 / 2;z-index:36;position:relative;overflow:auto; width:auto;height:auto;
  padding:clamp(20px,4.3vh,44px) clamp(8px,.85vw,16px) 12px;
  background:#581b23 var(--cloth) repeat;color:var(--light);
}
#trail-command-sidebar::after {content:"";position:fixed;top:var(--command-header);bottom:0;left:calc(var(--command-side) - 3px);width:9px;background:url("atlas/edge-side.png") repeat-y center/100% auto;pointer-events:none;}
.side-keys {justify-content:space-between;gap:3px;}
.side-key {border-image:url("atlas/nav-normal.png") 11 fill / 11px stretch;width:31%;aspect-ratio:75 / 72;}
.side-key:hover,.side-key:focus-visible {border-image-source:url("atlas/nav-hover.png");}
.side-key[aria-pressed=true] {border-image-source:url("atlas/nav-selected.png");}
.side-key:disabled {border-image-source:url("atlas/nav-disabled.png");}
.side-key img {max-width:69%;max-height:68%;object-fit:contain;}
.menu-divider {display:block;width:100%;height:25px;object-fit:fill;margin:8px 0 15px;}
@font-face {
  font-family:'Trail Menu Serif';src:url("atlas/fonts/trail-menu-serif.woff") format("woff");
  font-style:normal;font-weight:400;font-display:swap;
}
.nav-list {display:flex;flex-direction:column;gap:1px;}
.nav-item {display:flex;align-items:center;justify-content:center;min-height:48px;min-width:0;padding:4px 3px;color:#bdc3d2;background:none;border:0;text-align:center;text-decoration:none;}
.nav-item .nav-name {min-width:0;font:400 clamp(17px,1.43vw,22px)/1.2 'Trail Menu Serif',Georgia,serif;letter-spacing:.012em;overflow-wrap:anywhere;text-align:center;text-decoration:none;}
#trail-command-sidebar .side-key:focus-visible {outline-color:#ffe6a0;outline-offset:0;}
.nav-item:is(:hover,:focus-visible,.hub-nav-highlight) {color:#ffe19a;}
#trail-command-sidebar .nav-item:focus-visible {outline:2px solid #ffe19a;outline-offset:-2px;border-radius:3px;}
.nav-item:is(:hover,:focus-visible,:active,.hub-nav-highlight) .nav-name{text-decoration:none;}
@media (forced-colors:active) {#trail-command-sidebar .nav-item:focus-visible {outline-color:Highlight;}}
.side-info h2 {font-size:1.35rem;margin:.5rem 0;}
.side-info dl>div {display:flex;justify-content:space-between;gap:4px;margin:.6em 0;}
.side-info dd {margin:0;white-space:nowrap;}
#game-window {grid-area:2 / 2;isolation:isolate;overflow:hidden;background:#ead4b5 var(--paper-texture);}
.scene-title {
  position:absolute;z-index:32;left:0;right:0;top:clamp(8px,1.6vh,18px);display:flex;justify-content:center;align-items:center;
  gap:clamp(8px,1.25vw,22px);font:600 clamp(21px,2vw,35px)/1.12 Georgia,serif;color:#39271b;margin:0;text-align:center;pointer-events:none;
}
.scene-title::before,.scene-title::after {content:"";width:clamp(22px,3.5vw,60px);height:8px;background:url("atlas/title-rule.png") center/100% 100% no-repeat;}
.scene-title::after {transform:scaleX(-1);}
.scene-title:focus {outline:0;}
#game-window>.page:not(#page-town-gates) {padding-top:clamp(37px,5.6vh,58px);}
/* Illustrated scenes reserve a real title row. Keep Ford's approved layout unchanged. */
:is(#game-window:has(> .page:not([hidden]):not(#page-ford)), .scene-layout-measure) {
  --scene-inline-gutter: clamp(7px, 1.05vw, 17px);
  --scene-title-gap: clamp(6px, 1.05vh, 12px);
  display: grid;
  grid-template: auto minmax(0, 1fr) / minmax(0, 1fr);
}
:is(#game-window:has(> .page:not([hidden]):not(#page-ford)), .scene-layout-measure) > .scene-title {
  position: relative;
  inset: auto;
  grid-row: 1;
  min-width: 0;
  padding: clamp(7px, 1.4vh, 14px) var(--scene-inline-gutter) var(--scene-title-gap);
}
:is(#game-window:has(> .page:not([hidden]):not(#page-ford)), .scene-layout-measure) > .page:not([hidden]) {
  grid-row: 2;
  min-width: 0;
  height: 100%;
  padding: 0 var(--scene-inline-gutter) var(--scene-title-gap);
  box-sizing: border-box;
}
/* An inert, image-free copy of the title/stage measures the destination's
   responsive map while the current scene stays on screen. */
#game-window > .scene-layout-measure {
  position:absolute; inset:0; visibility:hidden; pointer-events:none;
}
#game-window > .scene-layout-measure > .page {
  display:flex; flex-direction:column;
}
.gate-viewport {flex:1;min-height:0;position:relative;container-type:size;display:grid;grid-template: minmax(0,1fr) / minmax(0,1fr);place-items:center;overflow:hidden;}
.gate-stage {position:relative;width:min(100cqw,calc(100cqh * var(--gate-ratio)));aspect-ratio:var(--gate-ratio);margin:0;}
.gate-stage>img {display:block;width:100%;height:100%;mask:url("atlas/camp-edge-ford-style.svg") center / 100% 100% no-repeat;}
.gate-hotspot {position:absolute;display:block;cursor:pointer;border:0;padding:0;background:transparent;pointer-events:auto;-webkit-tap-highlight-color:transparent; }
.gate-hotspot:focus-visible {outline:0;}
.gate-destination-label {
  position:absolute;bottom:5%;left:50%;transform:translateX(-50%);pointer-events:none;
  background:var(--paper);padding:5px 12px;color:var(--ink);text-align:center;
}
.gate-destination-label[hidden] {display:none;}
#community-dock {grid-area:3 / 2;z-index:38;position:relative;background:#e8cfa7 var(--paper-texture);}
#chat-drawer {height:var(--frame-chat-height,212px);min-height:0;display:flex;flex-direction:column;padding:clamp(22px,2.9vh,32px) 13px 10px;position:relative;isolation:isolate;}
#chat-drawer::before,#chat-drawer::after {content:"";position:absolute;left:0;right:0;height:12px;pointer-events:none;background:url("atlas/edge-chat.png") repeat-x center / auto 12px;z-index:-1;}
#chat-drawer::before {top:-4px;}
#chat-drawer::after {bottom:0;}
#community-dock::before,#community-dock::after {content:"";position:absolute;top:-4px;bottom:0;width:24px;z-index:1;pointer-events:none;background-repeat:no-repeat,no-repeat,repeat-y;background-size:24px 30px,24px 30px,6px auto;}
#community-dock::before{left:0;background-image:url("atlas/corner-tl.png"),url("atlas/corner-bl.png"),url("atlas/edge-side.png");background-position:left top,left bottom,left top;}
#community-dock::after{right:0;background-image:url("atlas/corner-tr.png"),url("atlas/corner-br.png"),url("atlas/edge-side.png");background-position:right top,right bottom,right top;}
#chat-resize{position:absolute;top:-5px;height:14px;left:min(335px,56%);right:54px;cursor:ns-resize;touch-action:none;}
.chat-tabs {position:absolute;top:0;left:10px;display:flex;align-items:flex-end;transform:translateY(-43%);z-index:3;}
.chat-tabs>button,.chat-compose>button,.chat-compose>input {border:0 solid transparent;min-width:0;color:var(--ink);background:transparent;font-family:Georgia,serif;}
.chat-tabs>button{border-image:url("atlas/chat-tab-normal.png") 12 fill / 12px stretch;min-width:clamp(85px,9.1vw,153px);height:clamp(36px,4.95vh,48px);padding:3px 12px 0;font-size:clamp(16px,1.45vw,24px);}
.chat-tabs>button:hover {border-image-source:url("atlas/chat-tab-hover.png");}
.chat-tabs>button[aria-selected=true] {border-image-source:url("atlas/chat-tab-selected.png");color:#fff1d9;}
.chat-tabs>button:disabled {border-image-source:url("atlas/chat-tab-disabled.png");}
#chat-drawer-close {position:absolute;right:18px;top:4px;border:0;background:transparent;color:var(--ink);width:34px;height:25px;font:22px Georgia,serif;}
#chat-drawer-close[aria-expanded=false] span {display:block;transform:rotate(180deg);}
#chat-status {flex:1;min-height:0;overflow:auto;margin:8px 14px;color:#604835;font:clamp(14px,1.05vw,17px)/1.4 Georgia,serif;}
#chat-status a {color:#6d2d29;}
.chat-compose {margin-top:auto;display:flex;align-items:stretch;gap:7px;height:clamp(38px,5.4vh,52px);}
.chat-compose>input {flex:1;border-image:url("atlas/chat-input.png") 12 fill / 12px stretch;padding:0 16px;}
.chat-compose>button {border-image:url("atlas/chat-send-normal.png") 12 fill / 12px stretch;min-width:clamp(94px,10.6vw,179px);padding:0 12px;font-size:clamp(17px,1.5vw,25px);color:#fff1d7;}
.chat-compose>button:hover:enabled{border-image-source:url("atlas/chat-send-hover.png");}
.chat-compose>button:active:enabled{border-image-source:url("atlas/chat-send-selected.png");}
.chat-compose>button:disabled{border-image-source:url("atlas/chat-send-disabled.png");}
#chat-drawer:has(#chat-drawer-close[aria-expanded=false]) .chat-compose{display:none;}
@media(max-width:1000px){#game-frame-header{grid-template-columns:minmax(0,.52fr) minmax(0,3.3fr) auto auto;gap:8px;}.vitals{gap:8px;}.quick-keys{padding-left:12px;}.nav-item{min-height:44px;}}
@media(max-width:700px){
  body.trail-frame{--command-header:86px;--command-side:min(245px,76vw);}
  .workspace{grid-template-columns:minmax(0,1fr);}
  #game-frame-header{display:grid;grid-template-columns:minmax(0,1fr) auto auto;grid-template-rows:44px 30px;gap:1px 6px;padding:3px 7px 7px;}
  .frame-region-emblem.atlas-key{display:flex;flex:none;width:42px;height:42px;}
  .identity{gap:5px;} .identity>img{width:28px;height:32px;} #game-account-name{font-size:15px;}
  .vitals{grid-row:2;grid-column:1/-1;gap:10px;}.vital>img{height:23px;width:24px;}
  .quick-keys{grid-column:3;grid-row:1;gap:2px;padding-left:8px;}.quick-keys .atlas-key{width:40px;height:40px;}
  .purse-link{grid-column:2;grid-row:1;min-height:40px;}.purse-link img{width:27px;}
  #game-window{grid-area:2 / 1;}#community-dock{grid-area:3 / 1;}
  #trail-command-sidebar{display:none;grid-area:2 / 1 / 3 / 2;width:var(--command-side);padding:12px 13px 10px;}
  #trail-command-sidebar.is-open{display:block;}
  #trail-command-sidebar::after{position:absolute;left:auto;right:0;top:0;}
  .menu-divider{margin:3px 0 5px;}.nav-item{padding:2px;}
  .scene-title{top:14px;font-size:clamp(21px,5.5vw,29px);}
  .chat-compose{height:40px;}#chat-drawer{padding:23px 8px 7px;}#chat-status{margin:5px 5px;font-size:14px;}
  .chat-tabs>button{min-width:86px;height:36px;}.chat-tabs{left:5px;}.chat-compose>button{min-width:96px;}
}
@media(min-width:701px) and (max-height:510px) {
  body.trail-frame{--command-header:45px;--command-side:clamp(145px,18vw,185px);}
  #trail-command-sidebar{padding:10px 8px;} .menu-divider{height:16px;margin:1px 0 3px;}.nav-item{min-height:37px;}
  .side-key{max-height:45px;}.scene-title{font-size:21px;top:5px;}
  #chat-drawer{padding:13px 9px 5px;}.chat-tabs>button{height:30px;}.chat-compose{height:32px;}#chat-status{font-size:13px;margin:4px 7px;}
}
@media(max-width:700px) {
  .workspace {grid-template-rows:var(--command-header) auto minmax(0,1fr) auto;}
  #trail-command-sidebar, #trail-command-sidebar.is-open {display:block;grid-area:2/1;width:100%;max-height:32dvh;padding:4px 7px 8px;background:#581b23 var(--cloth);}
  #trail-command-sidebar::after {left:0;right:0;bottom:0;top:auto;width:auto;height:6px;background:url("atlas/edge-top.png") center / auto 8px repeat-x;}
  #trail-command-sidebar .menu-divider {display:none;}
  #trail-command-sidebar:not(.is-open) .side-keys {display:none;}
  #trail-command-sidebar.is-open .side-keys {justify-content:flex-start;gap:8px;margin:4px 0;}
  #trail-command-sidebar .side-key {width:42px;height:40px;}
  #trail-command-sidebar .nav-list {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:12px;}
  #trail-command-sidebar .nav-item {font-size:16px;gap:5px;min-height:43px;}
  #trail-command-sidebar .nav-name {font-size:16px;}
  #game-window {grid-area:3/1;}#community-dock {grid-area:4/1;}
}
