:root {
  color-scheme: dark;
  /* Classic windows are enlarged apart from the text. app.js sets the chosen
     size, or one which follows the canvas: see display.js. */
  --gump:1.5;
  --ink:#e8dfc9;
  --muted:#aea998;
  --gold:#ceae70;
  --edge:#5e5946;
  --panel:#212721;
  /* Text follows the window's width gently: 12px on a phone, 14px on a small
     laptop, 16px at 1920, 17px at 2560, and 20px across a 4K desktop. Every
     other length is in rem. A chosen text size replaces this from app.js. */
  --font:clamp(12px, calc(11.5px + .22vw), 22px);
  font: var(--font)/1.5 system-ui, sans-serif;
  color: var(--ink);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
  background: #171b19;
}
button,
input,
select {
  font: inherit;
}
button,
select,
summary {
  cursor: pointer;
}
button {
  border: 1px solid #6c6650;
  background: #353b30;
  color: var(--ink);
  padding: .48rem .8rem;
  border-radius: 3px;
  white-space: nowrap;
}
button:hover {
  background: #464e3e;
  border-color: var(--gold);
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
button:disabled {
  opacity: .45;
  cursor: wait;
}
button.primary {
  background: #d5b979;
  color: #252c25;
  border-color: #e5cf94;
  font-weight: 650;
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: .7rem 1rem;
  margin-top: 1.3rem;
}
button.primary:hover {
  background: #e5cc91;
}
input,
select {
  color: var(--ink);
  background: #141b17;
  border: 1px solid #5d6353;
  border-radius: 3px;
  padding: .45rem .6rem;
  min-width: 0;
}
label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: .8rem 0;
}
label input:not([type=checkbox]),
label select {
  width: 56%;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2 {
  font-family: Georgia, serif;
  font-weight: 400;
}
h1 {
  font-size: 2.3rem;
  line-height: 1.15;
  letter-spacing: -.04em;
  margin: .8rem 0 1.2rem;
}
h2 {
  font-size: 1.45rem;
}
h3 {
  font-size: .85rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-bottom: .65rem;
}
kbd {
  font: .73rem system-ui, sans-serif;
  border: 1px solid #686d5b;
  border-bottom-width: 2px;
  padding: .1rem .28rem;
  border-radius: 3px;
  color: #cfc7b2;
  white-space: nowrap;
}
small {
  display: block;
  font-size: .65rem;
  letter-spacing: .2em;
  color: var(--gold);
}
[hidden] {
  display: none !important;
}
#world {
  position: absolute;
  inset: 0;
  outline: none;
  touch-action: none;
}
#world canvas {
  display: block;
  width: 100%;
  height: 100%;
}
#topbar {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.4rem;
  background: linear-gradient(#161e18f5, #161e18cf);
  border-bottom: 1px solid #4b513d;
  box-shadow: 0 3px 16px #0004;
}
nav {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.identity {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}
.identity strong {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: .1em;
}
.identity strong span {
  color: var(--gold);
}
.sigil {
  font-size: 2rem;
  color: var(--gold);
}
#connection-status {
  font-size: .8rem;
  color: #adaf97;
  margin-right: .6rem;
}
#vitals {
  display: flex;
  gap: .9rem;
  font-size: .7rem;
}
.vital {
  border-bottom: 3px solid;
  padding-bottom: .2rem;
  min-width: 5.7rem;
}
.vital b {
  float: right;
  font-weight: 500;
}
.health {
  border-color: #a76e63;
}
.stamina {
  border-color: #8e9d65;
}
.mana {
  border-color: #718ba4;
}
.panel {
  position: absolute;
  z-index: 10;
  background:
    linear-gradient(
      135deg,
      #2a3028,
      #1e2720);
  border: 1px solid #847b5c;
  box-shadow: 0 12px 50px #0008;
  border-radius: 4px;
  padding: 1.4rem;
  max-height: calc(100dvh - 7rem);
  overflow: auto;
}
.entry {
  left: 6vw;
  top: 50%;
  transform: translateY(-46%);
  width: 27rem;
  max-width: calc(100vw - 2rem);
  padding: 2rem;
}
#loading {
  font-size: .8rem;
  color: var(--muted);
  margin-top: 1.3rem;
}
#loading:empty, #guest-status:empty, #co-op-status:empty, .error:empty { display: none; }
details {
  font-size: .85rem;
  margin-top: 1rem;
}
summary {
  color: var(--muted);
}
.entry:has(#creation:not([hidden])) {
  top: 5rem;
  transform: none;
  width: 48rem;
  max-width: calc(100vw - 12vw);
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}
.creation-layout { display: flex; flex-wrap: wrap; gap: 1.8rem; align-items: start; }
.creation-fields { flex: 1 1 16rem; min-width: 0; }
.creation-preview { flex: 0 1 13rem; margin: 1rem 0 0; max-width: 100%; text-align: center; background: #161e19; border: 1px solid var(--edge); padding-bottom: 1rem; position: sticky; top: 0; }
.creation-preview canvas { width: 100%; height: auto; image-rendering: pixelated; }
.creation-preview figcaption { color: var(--gold); font-family: Georgia, serif; font-size: 1.2rem; }
.creation-preview p { font-size: .65rem; color: var(--muted); margin-top: .6rem; }
.color-field { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: .8rem 0; }
.color-picker { width: 56%; position: relative; }
.color-picker summary { display: flex; align-items: center; gap: .6rem; padding: .4rem .6rem; border: 1px solid #5d6353; border-radius: 3px; font-size: .8rem; background: #141b17; }
.color-picker summary::after { content: '▾'; margin-left: auto; }
.color-chip { width: 1.3rem; height: 1.3rem; border: 1px solid #ffffff60; flex-shrink: 0; }
.color-popup { position: absolute; right: 0; top: 100%; z-index: 20; background: #20281f; border: 1px solid var(--gold); box-shadow: 0 .4rem 1rem #0009; padding: .65rem; width: 19rem; max-width: 70vw; }
.color-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: .15rem; }
.color-grid.cloth-colors { grid-template-columns: repeat(20, 1fr); }
.color-grid button, .color-tones button { min-width: 0; padding: 0; height: 1.3rem; border: 1px solid #ffffff30; border-radius: 0; }
.color-grid.cloth-colors button { height: .85rem; }
.color-grid button[aria-pressed=true], .color-tones button[aria-pressed=true] { outline: 2px solid white; outline-offset: 1px; z-index: 1; }
.color-grid button:hover, .color-tones button:hover { border-color: white; }
.color-tones { display: flex; gap: .35rem; align-items: center; margin-top: .7rem; font-size: .8rem; }
.color-tones button { flex: 1; }
.error {
  color: #f0af98;
  margin-top: .8rem;
  font-size: .85rem;
}
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.3rem;
  margin-bottom: .8rem;
}
.settings {
  right: 1.4rem;
  top: 5.4rem;
  width: 25rem;
  max-width: calc(100vw - 2rem);
}
#music-volume { width: 100%; padding: 0; accent-color: var(--gold); }
#music-status:empty { display: none; }
.muted {
  color: var(--muted);
  font-size: .73rem;
  margin-top: .8rem;
}
.check {
  justify-content: flex-start;
  gap: .5rem;
}
.controls {
  border-top: 1px solid #58614b;
  margin-top: 1.3rem;
  padding-top: 1.1rem;
  font-size: .82rem;
  line-height: 1.9;
}
.controls p + p {
  margin-top: .7rem;
}
.panel-title + .controls {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}
.quest-journal, .document {
  top: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 46rem;
  max-width: calc(100vw - 2rem);
  background: linear-gradient(110deg, #e2d1a3, #c5b389);
  color: #332f24;
  border: 4px double #6a5b3d;
}
.document { width: 34rem; overflow-wrap: anywhere; }
.document h2 { font: 1.6rem/1.3 Georgia, serif; text-transform: none; letter-spacing: normal; }
#document-text { font: 1.1rem/1.65 Georgia, serif; }
#document-text p + p { margin-top: 1rem; }
.quest-pages { display: flex; flex-wrap: wrap; gap: 1.4rem; align-items: start; }
[data-quest-list] { display: flex; flex: 1 1 12rem; flex-direction: column; align-items: stretch; gap: .5rem; min-width: 0; }
[data-quest-list]:empty { display: none; }
[data-quest-list] h3 { font-size: .8rem; margin-top: .5rem; }
[data-quest-list] button { text-align: left; white-space: normal; background: #e7d7ab; color: #473822; border-color: #9c885b; }
[data-quest-list] button[aria-pressed=true] { background: #f5e9c8; border-color: #55442c; box-shadow: inset 3px 0 #6a5b3d; }
.quest-scope { display: block; font-size: .75rem; margin-top: .2rem; color: #68573d; }
[data-quest-detail] { flex: 2 1 20rem; min-width: 0; overflow-wrap: anywhere; }
[data-quest-detail] h3 { font: 1.5rem/1.3 Georgia, serif; text-transform: none; letter-spacing: normal; }
.quest-meta { color: #68573d; font-size: .8rem; margin-top: .3rem; }
[data-quest-detail] h4 { font-size: .8rem; margin: 1.4rem 0 .4rem; }
.quest-lead { font-weight: 600; }
[data-quest-detail] ol { padding-left: 1.2rem; margin: 0; }
[data-quest-detail] li + li { margin-top: .7rem; }
.conversation {
  left: 1.4rem;
  top: 6rem;
  width: 24rem;
  max-width: calc(100vw - 2.8rem);
  background:
    linear-gradient(
      120deg,
      #e2d1a3,
      #c5b389);
  color: #332f24;
  border: 4px double #6a5b3d;
}
.conversation .close {
  color: #51442c;
}
.conversation h2 {
  font-size: 1.8rem;
  margin: 0;
}
.conversation #npc-text {
  font-family: Georgia, serif;
  font-size: 1.08rem;
  line-height: 1.65;
  min-height: 4rem;
}
.conversation #topics {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  margin-top: 1.3rem;
}
.conversation #topics button {
  background: #e7d7ab;
  color: #473822;
  border-color: #9c885b;
}
.conversation #topics button:hover {
  background: #f0e5c5;
}
#bottom {
  position: absolute;
  bottom: .9rem;
  left: 1.4rem;
  right: 1.4rem;
  max-width: 45rem;
  pointer-events: none;
  z-index: 4;
}
#journal {
  max-height: 9rem;
  overflow: auto;
  padding: .6rem .8rem;
  background:
    linear-gradient(
      90deg,
      #151e19d9,
      #151e1944);
  border-left: 2px solid #9e8b60;
  pointer-events: auto;
  scrollbar-width: thin;
  font-size: .84rem;
  text-shadow: 0 1px 2px #000;
}
#journal p {
  margin: .2rem 0;
}
#journal strong {
  color: #d6bc85;
  font-weight: 600;
}
#journal .system {
  color: #aaa998;
  font-style: italic;
}
#chat {
  margin-top: .5rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  pointer-events: auto;
  background: #18211bee;
  border: 1px solid #72755a;
  padding: .2rem .4rem .2rem .8rem;
  border-radius: 3px;
}
#chat input {
  flex: 1;
  width: 0;
  border: 0;
  background: transparent;
  outline: none;
}
#chat label {
  margin: 0;
  font-variant: small-caps;
  color: var(--gold);
  font-size: .85rem;
}
#chat button {
  border: 0;
  padding: .3rem .65rem;
  background: transparent;
}
.footnote {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: .65rem;
  margin-top: .35rem;
  color: #c8c4b1;
  text-shadow: 0 1px 3px #000;
}
#barks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.bark {
  position: absolute;
  transform: translate(-50%, -100%);
  max-width: 25rem;
  text-align: center;
  font-size: .92rem;
  color: #fbf0c5;
  text-shadow:
    -1px -1px 2px #000,
    1px 1px 2px #000,
    0 2px 4px #000;
  background: #17201988;
  padding: .1rem .45rem;
  border-radius: 3px;
}
.bark .name {
  display: block;
  font-size: .65rem;
  color: #d3b77e;
}
#tooltip {
  position: absolute;
  pointer-events: none;
  padding: .25rem .5rem;
  background: #172019ef;
  border: 1px solid #6b7157;
  font-size: .78rem;
  z-index: 9;
}
#drag-image {
  position: absolute;
  pointer-events: none;
  z-index: 30;
  image-rendering: pixelated;
  filter: drop-shadow(2px 3px 1px #0008);
}
@media (max-width: 1000px) {
  #vitals {
    display: none !important;
  }
  #connection-status {
    display: none;
  }
  .identity strong {
    font-size: 1rem;
  }
  .sigil {
    font-size: 1.4rem;
  }
  .entry {
    left: 1rem;
  }
  .footnote span:last-child {
    display: none;
  }
}
@media (max-width: 700px) {
  #topbar {
    padding: .5rem .7rem;
    gap: .3rem;
  }
  .identity {
    gap: .3rem;
  }
  nav {
    gap: .3rem;
  }
  nav button {
    padding: .4rem .55rem;
  }
  nav kbd {
    display: none;
  }
  .panel {
    max-height: calc(100dvh - 5rem);
  }
  .entry {
    width: 27rem;
    padding: 1.5rem;
  }
  .settings,
  .conversation,
  .inventory,
  .paperdoll {
    top: 4.2rem;
    right: 1rem;
    left: auto;
  }
  .conversation {
    width: 23rem;
  }
  #bottom {
    left: .7rem;
    right: .7rem;
    bottom: .5rem;
  }
  #journal {
    max-height: 6rem;
  }
  .footnote {
    font-size: .6rem;
  }
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.classic-window {
  position: absolute;
  z-index: 10;
  top: 6rem;
  width: calc(var(--gump-width) * var(--gump));
  max-width: 100vw;
  max-height: calc(100dvh - 6rem);
  overflow: auto;
  scrollbar-width: thin;
  user-select: none;
  touch-action: none;
  pointer-events: none;
}
.paperdoll { left: 1.4rem; }
/* Below the paperdoll at whatever size it is, which on a short canvas is past the halfway mark. */
.status { left: 1.4rem; top: max(55vh, calc(7rem + 324px * var(--gump))); }
.gump-surface {
  position: relative;
  zoom: var(--gump);
  image-rendering: pixelated;
}
.gump-surface::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gump-art) no-repeat;
  clip-path: var(--gump-clip);
  pointer-events: auto;
}
.inventory-items img {
  position: absolute;
  image-rendering: pixelated;
  cursor: grab;
  pointer-events: auto;
}
.inventory-items img:hover { filter: drop-shadow(0 0 2px #fff5a8); }
#equipment { position: absolute; left: 8px; top: 19px; width: 260px; height: 237px; }
#paperdoll-surface { overflow: hidden; }
.doll-body { position: absolute; pointer-events: auto; }
.doll-item, .gump-button {
  position: absolute;
  border: 0;
  padding: 0;
  border-radius: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  pointer-events: auto;
}
.doll-item:hover { background-color: transparent; filter: brightness(1.12); }
.gump-button { background-image: var(--normal); }
.gump-button:hover { background-color: transparent; background-image: var(--hover); }
.gump-button:active { background-image: var(--pressed); }
#player-name {
  position: absolute;
  left: 39px;
  top: 264px;
  width: 185px;
  font: 14px/17px Georgia, serif;
  text-align: center;
  color: #25221c;
}
#status-values span { position: absolute; color: #25221c; font: 11px/12px Georgia, serif; }
.save-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: .7rem 0; }
.text-button { margin-top: .8rem; background: transparent; }
#import-dialog { position: fixed; margin: auto; width: min(32rem, 90vw); max-height: 90vh; overflow: auto; }
#import-dialog p { margin-top: .8rem; }
#import-dialog::backdrop { background: #0009; }

#character-list { display: grid; gap: .65rem; margin: 1rem 0; }
.account-row { display: grid; grid-template-columns: 1fr auto; gap: .4rem; margin: .7rem 0; }
.account-row label { grid-column: 1 / -1; font-size: .75rem; color: var(--muted); }
.account-row input { min-width: 0; }
#host-invitation { width: 100%; }
#join-details, #manage-accounts { margin-top: 1rem; }
#co-op-status, #guest-status { overflow-wrap: anywhere; }

/* Host testing controls use the same text size as other panels. */
#activity-program { width: 100%; box-sizing: border-box; resize: vertical; background: #161a18; color: #e7dfcb; font: inherit; font-family: monospace; }
#activity-controls [role=status] { white-space: pre-line; }

.radar { right: 1.4rem; top: 55vh; }
#radar canvas { position: absolute; pointer-events: none; }
.skills { left: 1.4rem; top: 6rem; width: 33rem; max-width: calc(100vw - 2.8rem); }
.skills [data-skill-caps] { color: var(--muted); font-size: .8rem; }
.skill-list { overflow: auto; max-height: 55vh; }
.skill-list table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.skill-list th, .skill-list td { padding: .45rem .35rem; text-align: left; border-bottom: 1px solid var(--edge); }
.skill-list th:nth-child(2), .skill-list td:nth-child(2), .skill-list th:nth-child(4), .skill-list td:nth-child(4) { text-align: right; font-variant-numeric: tabular-nums; }
.skill-action { padding: 0; border: 0; background: none; color: var(--gold); text-decoration: underline; font: inherit; }
.targeting #world, .targeting [data-serial], .targeting [data-target-serial] { cursor: crosshair; }
.target-prompt { left: 50%; bottom: 5rem; transform: translateX(-50%); display: flex; gap: 1rem; align-items: center; }
.creation-package { padding: .7rem; margin-bottom: 1rem; border: 1px solid var(--edge); font-size: .8rem; }
.creation-package h3 { margin: 0 0 .35rem; font-size: .85rem; }
.creation-package p { margin: 0 0 .65rem; }
.creation-package p:last-child { margin-bottom: 0; }
.creation-package dl { display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; margin: 0 0 .65rem; }
.creation-package dd { margin: 0; font-variant-numeric: tabular-nums; }
.creation-package input[type=number] { width: 4.5rem; padding: .35rem; margin: 0; }
#advanced-stats label, .allocation-skill { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0 0 .5rem; }
.allocation-skill select { flex: 1; min-width: 0; margin: 0; padding: .35rem; }
#allocation-limits { margin: .5rem 0; font-variant-numeric: tabular-nums; }

.activity-window { top: 5.4rem; left: 50%; transform: translateX(-50%); width: 38rem; max-width: calc(100vw - 2rem); max-height:calc(100vh - 11rem); overflow:auto; }
.activity-window textarea { font-size: .85rem; }
#activities-button { margin-top: 1rem; }
