:root {
  filter: var(--game-brightness, none);
  color-scheme: dark;
  --ink: #f3ead6;
  --soft: #b9b2a3;
  --light-brass: #f2d390;
  --brass: #ceaa68;
  --border: #454640;
  --panel: #222a28;
  font: 16px/1.45 system-ui, sans-serif;
  color: var(--ink);
  background: #23342b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
button:focus-visible { outline: 2px solid var(--light-brass); outline-offset: 3px; }
.game { display: grid; grid-template-rows: 60px minmax(0, 1fr); height: 100dvh; min-height: 460px; }
.masthead { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center; gap: 16px; padding: 0 22px; background: #1b2221; border-bottom: 1px solid #68614d; box-shadow: 0 4px 16px #10181645; z-index: 1; }
.brand, .region, .top-stats { display: flex; align-items: center; gap: 12px; }
.brand h1 { font: 500 1.72rem Georgia, serif; letter-spacing: .04em; margin: 0; }
.brand-mark { display: grid; place-content: center; width: 30px; height: 30px; color: var(--light-brass); border: 1px solid #a88957; transform: rotate(45deg); font-style: normal; }
.region { justify-content: center; color: #dde7d9; white-space: nowrap; font-size: .9rem; }
.region > span:first-child { width: 7px; height: 7px; background: #a2ce90; border-radius: 50%; box-shadow: 0 0 9px #9fd69377; }
.top-stats { justify-content: end; white-space: nowrap; color: var(--soft); font-size: .87rem; font-variant-numeric: tabular-nums; }
.top-stats b { color: var(--ink); margin-left: 4px; font-weight: 600; }
.gold { display: flex; align-items: center; gap: 5px; }
.gold :is(img,svg) { width: 18px; height: 18px; object-fit: contain; image-rendering: pixelated; }
.playfield { display: grid; min-height: 0; }
.world { position: relative; min-width: 0; min-height: 0; background: #334738; overflow: hidden; }
#scene { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: manipulation; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; background: #23342b; }
.location-card { position: absolute; top: 18px; left: 20px; padding: 8px 15px 9px; pointer-events: none; background: #202a24eb; border: 1px solid #756a50; border-left: 3px solid var(--brass); box-shadow: 0 4px 14px #13201861; }
#location-name { font: 500 1.25rem Georgia, serif; color: var(--light-brass); }
.location-status { color: #dbded1; font-size: .85rem; }
.game-notice { position: absolute; bottom: 99px; left: 50%; transform: translateX(-50%); max-width: 75%; width: max-content; padding: 8px 13px; text-align: center; background: #202924ee; border: 1px solid #88805e; pointer-events: none; }
#pack-full-alert:not(:empty) { position: fixed; z-index: 10000; top: 50%; left: 50%; transform: translate(-50%, -50%); width: max-content; max-width: calc(100vw - 32px); padding: 20px clamp(20px, 6vw, 40px); border: 2px solid #d8a65d; border-radius: 7px; background: #332219; color: #ffe6ac; box-shadow: inset 0 0 0 3px #71472d, 0 8px 34px #0c0907c0; text-align: center; font: bold clamp(1.4rem, 4vw, 2rem)/1.2 Georgia, serif; pointer-events: none; }
.map-controls { position: absolute; bottom: 16px; right: 18px; display: flex; align-items: center; gap: 2px; background: #19231de8; border: 1px solid #756a50; font-variant-numeric: tabular-nums; }
.map-controls button { border: 0; background: transparent; color: var(--light-brass); height: 36px; width: 36px; font-size: 1.3rem; }
.map-controls button:hover { background: #67736161; }
.map-controls output { font-size: .78rem; width: 44px; text-align: center; }
.floating-ui { position: fixed; inset: 60px 0 0; z-index: 3; pointer-events: none; }
.game-window { position: absolute; display: flex; flex-direction: column; max-width: calc(100% - 8px); max-height: calc(100% - 8px); pointer-events: auto; overflow: hidden; color: #e8d7b5; background: #242724f5; border: 1px solid #8b7658; border-radius: 7px; box-shadow: inset 0 0 0 1px #191b17, 0 8px 25px #080e0ab0; }
.game-window.resizable { resize: both; }
.shell-titlebar { display: flex; align-items: center; flex: none; gap: 8px; min-height: 31px; padding: 3px 7px 3px 10px; background: linear-gradient(#43362b,#272521); border-bottom: 1px solid #796341; cursor: grab; touch-action: none; }
.shell-titlebar:active { cursor: grabbing; }
.shell-titlebar h2 { margin: 0 auto 0 0; font: 500 1.03rem Georgia, serif; }
.shell-window-tools { display: flex; justify-content: flex-end; gap: 3px; }
.game-window button:not(.primary,.secondary,.inv-item-button), .game-window input, .game-window select { border: 1px solid #755b3e; border-radius: 3px; background: #312820; color: #f0dcad; }
.game-window button:not(.primary,.secondary,.inv-item-button):not(:disabled):hover { background: #574333; }
.shell-window-tools [data-close] { display: grid; place-items: center; width: 24px; height: 23px; padding: 0; font-size: 17px; line-height: 1; }
.window-body { padding: 8px 11px; min-height: 0; overflow: auto; flex: 1; }
.map-window { top: 18px; right: 20px; width: 244px; }
.pack-window { top: min(190px,33%); right: 20px; width: 300px; height: 334px; min-width: min(82px,calc(100% - 8px)); min-height: min(334px,calc(100% - 8px)); background: #342318; container: backpack-frame / inline-size; }
#shell-pack .pack-compact-title { display: none; }
@container backpack-frame (max-width: 152px) {
  body.uo-theme #shell-pack.inv-scroll-pack > .shell-titlebar > h2.uo-banner-title { position: static; transform: none; grid-area: 1 / 1; margin: 0; font-size: .74rem; }
  #shell-pack .pack-full-title { display: none; }
  #shell-pack .pack-compact-title { display: inline; }
  #shell-pack .shell-window-tools :is(.inv-container-corner,[data-close]) { width: 18px; min-width: 18px; height: 20px; }
  #shell-pack.inv-scroll-pack .inv-pack-stats > :nth-child(-n+3) { display: none; }
}
@container backpack-frame (max-width: 100px) {
  body.uo-theme #shell-pack.inv-scroll-pack .inv-pack-overflow .inv-surface.inv-grid { scrollbar-gutter: auto; scrollbar-width: none; }
}
.bank-window { top: min(190px,33%); right: 332px; width: 460px; height: 350px; min-width: min(280px,calc(100% - 8px)); min-height: min(260px,calc(100% - 8px)); background: #26201a; }
.journal-window { bottom: 99px; left: 24px; width: 320px; height: min(242px,65%); min-width: min(220px,calc(100% - 8px)); min-height: 92px; }
.game-window .shell-gump-body { overflow: hidden; padding: 7px; }
.game-window .inventory-host { height: 100%; min-height: 0; position: relative; }
.game-window .inventory-host:is([data-inventory-view=help],[data-inventory-view=details],[data-inventory-view=gold]) { overflow: auto; }
[data-active-tool=true] .inv-item-button::after { content: '•'; position: absolute; top: -2px; right: 4px; color: #b8de8e; font-size: 16px; }
#bank-service { padding: 7px; color: #e7d6b4; }
#bank-service p { margin: 0 0 10px; }
#bank-service form { display: flex; flex-wrap: wrap; gap: 9px; align-items: end; }
#bank-service label { display: grid; gap: 3px; font-size: .78rem; }
#bank-service input { width: 90px; padding: 3px 5px; }
#bank-service :is(select,button) { padding: 3px 5px; }
.count-label { color: var(--soft); font-size: .82rem; font-variant-numeric: tabular-nums; }
.work-controls { margin-top: 7px; }
.action-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.action-line button { pointer-events: auto; min-height: 29px; padding: 4px 8px; font-size: .8rem; }
.work-controls progress { display: block; margin-top: 6px; }
.primary, .secondary { padding: 7px 12px; min-height: 36px; border: 1px solid #ddbf80; border-radius: 2px; background: #ddbf80; color: #242c25; font-weight: 650; font-size: .9rem; }
.primary:not(:disabled):hover { background: #f5d799; }
.secondary { border-color: #727061; background: #303b33; color: var(--ink); }
progress { width: 100%; height: 9px; margin-top: 9px; accent-color: var(--brass); }
#minimap { display: block; margin-top: 7px; width: 100%; aspect-ratio: 2.12; border: 1px solid #5b6350; background: #141e1a; cursor: crosshair; touch-action: manipulation; }
.compass { color: var(--light-brass); font-size: .8rem; }
.map-key { display: flex; gap: 17px; margin-top: 5px; font-size: .77rem; color: var(--soft); }
.map-key span { display: flex; align-items: center; gap: 6px; }
.map-key i { width: 7px; height: 7px; border-radius: 50%; background: #e9f4ff; }
.map-key span + span i { border-radius: 0; transform: rotate(45deg); background: #e8c47a; }
.journal-body { display: flex; flex-direction: column; }
.journal ol { list-style: none; padding: 0 8px 0 0; margin: 0; display: grid; align-content: start; flex: 1; gap: 5px; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; overflow-anchor: none; }
.journal ol:focus-visible { outline: 1px solid var(--light-brass); outline-offset: 3px; }
.journal li { font-size: .82rem; color: var(--soft); }
.journal li:first-child { color: #ebdfc3; }
.journal .skill-gain { color: #b8eca9; }
#last-skill-gain { font-size: .82rem; margin: 7px 0; }
.option-bar, .option-popup {
  position: fixed; z-index: 5; border: 1px solid #8b7658; border-radius: 12px;
  color: #e5d6b5; background: linear-gradient(105deg, #101414f2, #252b22ed 58%, #101310f5);
  box-shadow: inset 0 0 0 1px #151812, inset 0 -1px #4a3f2c, 0 5px 18px #000a;
}
.option-bar { left: 24px; bottom: 24px; display: flex; align-items: center; flex-wrap: wrap; gap: 3px; width: max-content; max-width: calc(100vw - 16px); padding: 5px 7px; }
.option-bar-grip { display: grid; place-items: center; width: 17px; height: 44px; padding: 0; margin-right: 1px; border: 0; background: transparent; color: #b28a65; font-size: 18px; font-weight: 700; cursor: grab; touch-action: none; }
.option-bar-grip:active { cursor: grabbing; }
.option-bar-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 50px; height: 52px; padding: 2px 4px; border: 1px solid transparent; border-radius: 4px; color: inherit; background: transparent; font-size: 10px; white-space: nowrap; text-shadow: 0 1px 2px #000; }
.option-bar-face { position: relative; display: grid; place-items: center; width: 37px; height: 37px; }
.option-bar img, .option-popup img { object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 1px 2px #0009); }
.option-bar img { width: 29px; height: 29px; }
.option-bar-tile:disabled { opacity: .57; }
.option-bar-tile:disabled img { filter: saturate(.63); }
.option-bar-tile:is([aria-pressed=true],[aria-expanded=true]) .option-bar-face { outline: 1px solid #91a87382; outline-offset: -2px; border-radius: 5px; background: #b4c87813; }
.option-bar-tile:not(:disabled):hover .option-bar-face, .option-bar-tile:focus-visible .option-bar-face { outline: 1px solid #f3cd7d; outline-offset: -2px; border-radius: 5px; background: #af8c4c24; }
.option-popup { z-index: 6; display: grid; gap: 2px; min-width: 192px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 7px; overflow: auto; }
.option-popup h2 { margin: 2px 6px 5px; font: 500 1.1rem Georgia, serif; }
.option-menu-item { display: flex; gap: 8px; align-items: center; width: 100%; min-height: 30px; padding: 3px 7px; border: 1px solid transparent; border-radius: 4px; color: inherit; background: transparent; text-align: left; font-size: .79rem; }
.option-menu-item:not(:disabled):hover { background: #805f353d; border-color: #b28a6566; }
.option-popup img { width: 21px; height: 21px; }
.option-popup input { accent-color: var(--brass); }
.option-search { width: 100%; padding: 5px 7px; margin-bottom: 4px; color: var(--ink); border: 1px solid #746349; border-radius: 4px; background: #171e19; }
.option-window-list { display: grid; gap: 2px; }
.option-graphics { display: grid; gap: 6px; width: min(232px, calc(100vw - 40px)); padding: 8px 8px 5px; border-top: 1px solid #8b765860; }
.option-graphics-heading, .option-graphics-buttons, .option-graphics-scale { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.option-graphics-heading { font-size: .82rem; }
.option-graphics-heading output { color: var(--light-brass); font-variant-numeric: tabular-nums; }
.option-graphics-scale { color: #b9ae94; font-size: .68rem; font-variant-numeric: tabular-nums; }
.option-graphics input[type=range] { appearance: none; width: 100%; height: 25px; margin: 0; background: transparent; cursor: pointer; }
.option-graphics input[type=range]:focus-visible { outline: 1px solid #e1b972; outline-offset: 2px; border-radius: 3px; }
.option-graphics input[type=range]::-webkit-slider-runnable-track { height: 7px; border: 1px solid #8f784f; border-radius: 6px; background: linear-gradient(to right, #ad8549 0 var(--range-fill), #191e18 var(--range-fill) 100%); }
.option-graphics input[type=range]::-moz-range-track { height: 5px; border: 1px solid #8f784f; border-radius: 6px; background: linear-gradient(to right, #ad8549 0 var(--range-fill), #191e18 var(--range-fill) 100%); }
.option-graphics input[type=range]::-webkit-slider-thumb { appearance: none; width: 15px; height: 15px; margin-top: -5px; border: 1px solid #f5d696; border-radius: 50%; background: linear-gradient(#e2bf7d,#9a703e); box-shadow: 0 1px 4px #0008; }
.option-graphics input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border: 1px solid #f5d696; border-radius: 50%; background: linear-gradient(#e2bf7d,#9a703e); box-shadow: 0 1px 4px #0008; }
.option-graphics-buttons { padding-top: 5px; }
.option-graphics-buttons button { min-height: 26px; padding: 2px 9px; border: 1px solid #8b7658; border-radius: 4px; background: #332b20; color: inherit; font-size: .73rem; }
.option-graphics-buttons button:not(:disabled):hover { border-color: #d4ae74; background: #52402a; }
@media (max-width: 780px) {
  .bank-window { right: 8px; }
  .masthead { padding-inline: 15px; }
}
@media (max-width: 590px) {
  .game { grid-template-rows: 56px minmax(0,1fr); }
  .masthead { grid-template-columns: auto auto; }
  .region { display: none; }
  .floating-ui { top: 56px; }
  .map-window { top: 10px; right: 8px; width: min(182px,43%); }
  .pack-window { top: 72px; right: 8px; }
  .bank-window { top: 105px; right: 4px; }
  .map-key { display: none; }
  .location-card { left: 12px; top: 12px; max-width: calc(57% - 24px); }
  .option-bar { left: 8px; bottom: 8px; gap: 2px; padding: 4px; }
  .option-bar-tile { min-width: 44px; padding-inline: 2px; }
}

/* An active tool remains in its Backpack slot even while the action is locked. */
#shell-pack [data-active-tool=true] .inv-item-button {
    opacity: 1;
    outline: 2px solid #adba77;
    outline-offset: -2px;
    animation: britain-active-tool 3.4s ease-in-out infinite;
}
@keyframes britain-active-tool {
    0%,100% { outline-color: #adba77; }
    50% { outline-color: #e4dbaa; }
}
@media (prefers-reduced-motion: reduce) {
    #shell-pack [data-active-tool=true] .inv-item-button { animation:none; }
}
