/* Ranch Quest - the look of the panels around the 3D view. */
:root {
  --wood: #3b2c20; --wood-light: #54402e; --edge: #1e1610; --paper: #efe3c8; --ink: #2c2118;
  --gold: #ffd75e; --green: #7ed36b; --red: #e2574c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #b2d0e4; font: 14px/1.35 Georgia, 'Times New Roman', serif; color: var(--paper); user-select: none; -webkit-user-select: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: default; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }

/* words that float over the 3D view */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.label { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-weight: bold; text-shadow: 0 1px 2px #000, 0 0 3px #000; }
.label.name { color: var(--gold); font-size: 13px; }
.label.quest { color: var(--gold); font-size: 22px; }
.label.hit { color: #fff; background: var(--red); border-radius: 50%; min-width: 22px; text-align: center; padding: 2px 5px; font-size: 13px; text-shadow: none; }
.label.miss { color: #fff; background: #4a78c2; border-radius: 50%; min-width: 22px; text-align: center; padding: 2px 5px; font-size: 13px; text-shadow: none; }
.label.xp { color: #fff; font-size: 13px; }
.label.bar { width: 44px; height: 6px; background: #7a1d16; border: 1px solid #000; }
.label.bar > div { height: 100%; background: #46c23e; }

#hover { position: fixed; left: 10px; top: 8px; font-size: 15px; text-shadow: 0 1px 2px #000, 0 0 4px #000; pointer-events: none; }
#hover b { color: #7fe3ff; }

#status { position: fixed; left: 10px; top: 36px; display: flex; gap: 10px; align-items: center; }
#hpbar { position: relative; width: 150px; height: 18px; background: #5a1a15; border: 2px solid var(--edge); border-radius: 4px; overflow: hidden; }
#hpfill { height: 100%; background: linear-gradient(#e2574c, #b23a32); }
#hptext { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 15px; text-shadow: 0 1px 1px #000; }
#coins { text-shadow: 0 1px 2px #000; }

#banner { position: fixed; left: 0; right: 0; top: 16%; text-align: center; pointer-events: none; opacity: 0; transition: opacity 0.6s; text-shadow: 0 2px 4px #000, 0 0 8px #000; }
#banner.show { opacity: 1; }
#banner-title { font-size: 34px; color: var(--gold); letter-spacing: 1px; }
#banner-sub { font-size: 17px; }

#log { position: fixed; left: 10px; bottom: 10px; width: min(440px, 46vw); max-height: 150px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
       background: rgba(30, 22, 16, 0.62); border: 2px solid var(--edge); border-radius: 6px; padding: 6px 9px; pointer-events: none; }
#log div { margin-top: 2px; }
#log .good { color: var(--green); }
#log .bad { color: #ff9a8a; }
#log .quest { color: var(--gold); }
#log .say { color: #a8dcff; }

#side { position: fixed; right: 10px; top: 10px; width: 218px; background: var(--wood); border: 2px solid var(--edge); border-radius: 8px; padding: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.4); }
#minimap { width: 198px; height: 112px; display: block; border: 2px solid var(--edge); border-radius: 4px; cursor: pointer; image-rendering: pixelated; }
#tabs { display: flex; gap: 4px; margin: 8px 0 6px; }
#tabs button { flex: 1; padding: 4px 0; font-size: 16px; background: var(--wood-light); border: 2px solid var(--edge); border-radius: 5px; }
#tabs button.on { background: var(--paper); }
#tabs #side-hide { flex: 0 0 26px; font-size: 13px; color: var(--paper); }
#side.collapsed #tab-body { display: none; }
#side.collapsed #tabs { margin-bottom: 0; }
#side-show { position: fixed; right: 10px; top: 10px; width: 44px; height: 44px; font-size: 22px; background: var(--wood); border: 2px solid var(--edge); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.4); }
#side { display: flex; flex-direction: column; max-height: calc(100vh - 20px); box-sizing: border-box; }
#side > * { flex: none; }
#tab-body { flex: 1 1 auto !important; min-height: 120px; overflow-y: auto; }
#tab-body h3 { margin: 2px 0 6px; font-size: 15px; color: var(--gold); font-weight: normal; }

.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.slot { position: relative; height: 44px; background: var(--wood-light); border: 2px solid var(--edge); border-radius: 5px; font-size: 24px; line-height: 40px; text-align: center; cursor: pointer; }
.slot:hover { border-color: var(--gold); }
.slot .n { position: absolute; left: 3px; top: 1px; font-size: 11px; line-height: 12px; color: var(--gold); text-shadow: 0 1px 1px #000; }

.skill { display: grid; grid-template-columns: 24px 1fr auto; gap: 2px 6px; align-items: center; margin-bottom: 6px; }
.skill .lv { color: var(--gold); }
.skill .xpbar { grid-column: 2 / 4; height: 5px; background: var(--edge); border-radius: 3px; overflow: hidden; }
.skill .xpbar div { height: 100%; background: var(--green); }
.small { font-size: 12px; opacity: 0.85; }

.qrow { margin-bottom: 8px; padding: 5px 7px; background: var(--wood-light); border-radius: 5px; border-left: 4px solid var(--red); }
.qrow.active { border-left-color: var(--gold); }
.qrow.done { border-left-color: var(--green); }
.qrow b { display: block; font-weight: normal; color: var(--gold); }

.gear-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 7px; margin-bottom: 4px; background: var(--wood-light); border-radius: 5px; cursor: pointer; }
.gear-row:hover { outline: 1px solid var(--gold); }
.styles { display: flex; gap: 4px; margin: 6px 0; }
.styles button { flex: 1; padding: 4px 0; font-size: 12px; background: var(--wood-light); color: var(--paper); border: 2px solid var(--edge); border-radius: 5px; }
.styles button.on { background: var(--paper); color: var(--ink); }

#menu { position: fixed; min-width: 150px; background: var(--wood); border: 2px solid var(--edge); border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.5); z-index: 20; overflow: hidden; }
#menu div { padding: 4px 10px; cursor: pointer; }
#menu div:hover { background: var(--wood-light); color: var(--gold); }
#menu .title { background: var(--edge); cursor: default; color: var(--paper); font-size: 12px; }
#menu b { color: #7fe3ff; font-weight: normal; }

#dialog { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: min(560px, 92vw); background: var(--paper); color: var(--ink); border: 3px solid var(--edge); border-radius: 8px; padding: 12px 16px; box-shadow: 0 6px 20px rgba(0,0,0,0.5); z-index: 15; }
#dialog-name { font-size: 17px; color: #7a2c22; margin-bottom: 4px; }
#dialog-text { font-size: 15px; margin-bottom: 10px; white-space: pre-line; }
#dialog-options { display: flex; flex-direction: column; gap: 5px; }
#dialog-options button { text-align: left; padding: 6px 10px; background: #fff8e6; border: 2px solid #b79f72; border-radius: 5px; color: var(--ink); }
#dialog-options button:hover { border-color: #7a2c22; }

#shop { position: fixed; left: 50%; top: 50%; transform: translate(-60%, -50%); width: min(420px, 90vw); background: var(--wood); border: 3px solid var(--edge); border-radius: 8px; padding: 12px; z-index: 15; box-shadow: 0 6px 20px rgba(0,0,0,0.5); }
#shop-title { font-size: 18px; color: var(--gold); display: flex; justify-content: space-between; margin-bottom: 8px; }
#shop-stock { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.stock { display: flex; gap: 6px; align-items: center; padding: 5px 7px; background: var(--wood-light); border: 2px solid var(--edge); border-radius: 5px; cursor: pointer; }
.stock:hover { border-color: var(--gold); }
.stock .icon { font-size: 22px; }
.stock .price { color: var(--gold); font-size: 12px; }
#shop-note { margin-top: 8px; font-size: 12px; opacity: 0.85; }

#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #2c2118; color: var(--gold); font-size: 26px; z-index: 50; }

/* the "build your character" screen */
#creator { position: fixed; left: 16px; top: 16px; bottom: 16px; width: min(330px, 92vw); overflow-y: auto; background: var(--wood); border: 3px solid var(--edge); border-radius: 8px; padding: 12px 14px; z-index: 30; box-shadow: 0 6px 20px rgba(0,0,0,0.5); }
#creator h2 { margin: 0 0 8px; font-size: 20px; font-weight: normal; color: var(--gold); }
#creator label { display: block; margin: 9px 0 4px; font-size: 13px; opacity: 0.9; }
#creator input[type=text] { width: 100%; padding: 6px 8px; font: inherit; background: var(--paper); color: var(--ink); border: 2px solid var(--edge); border-radius: 5px; user-select: text; -webkit-user-select: text; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.swatch { width: 28px; height: 28px; border-radius: 5px; border: 2px solid var(--edge); cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.choices { display: flex; flex-wrap: wrap; gap: 4px; }
.choices button { flex: 1; padding: 5px 4px; font-size: 13px; background: var(--wood-light); color: var(--paper); border: 2px solid var(--edge); border-radius: 5px; white-space: nowrap; }
.choices button.on { background: var(--paper); color: var(--ink); }
#creator .done { width: 100%; margin-top: 14px; padding: 9px; font-size: 16px; background: var(--gold); color: var(--ink); border: 2px solid var(--edge); border-radius: 6px; }
#creator .hint { font-size: 12px; opacity: 0.8; margin-top: 8px; }
#whoami { text-shadow: 0 1px 2px #000; color: var(--gold); }

/* drawn item pictures */
svg.icon { width: 1.25em; height: 1.25em; vertical-align: middle; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.45)); }
.slot svg.icon { width: 34px; height: 34px; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.slot .n { z-index: 1; }
.stock .icon svg.icon { width: 30px; height: 30px; }
.gear-row svg.icon { width: 20px; height: 20px; }
#coins svg.icon { width: 18px; height: 18px; }
.stock .price svg.icon { width: 13px; height: 13px; }
#tabs button svg.icon { width: 22px; height: 22px; display: block; margin: 0 auto; }
.skill svg.icon { width: 22px; height: 22px; }
#side-show svg.icon { width: 30px; height: 30px; }

/* running */
#bars { display: flex; flex-direction: column; gap: 3px; }
#enbar { width: 150px; height: 8px; background: #3a3420; border: 2px solid var(--edge); border-radius: 4px; overflow: hidden; }
#enfill { height: 100%; background: linear-gradient(#e8d24a, #b89a2a); }
#run { display: flex; align-items: center; gap: 4px; padding: 3px 8px 3px 5px; font-size: 13px; background: var(--wood); color: var(--paper); border: 2px solid var(--edge); border-radius: 6px; }
#run.on { background: var(--gold); color: var(--ink); }
#run svg.icon { width: 22px; height: 22px; }

/* dragging items between backpack slots */
.slot { touch-action: none; }
.slot.lifting svg.icon { opacity: 0.25; }
.slot.target { border-color: var(--gold); background: #6a543c; }
.drag-ghost { position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, -50%); }
.drag-ghost svg.icon { width: 40px; height: 40px; filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6)); }

/* compass beside the status bars */
#compass { width: 58px; height: 58px; flex: none; padding: 0; border: 0; background: none; cursor: pointer; }
#compass svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5)); }

/* skills in two columns */
.skills { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-bottom: 6px; }
.skills .skill { margin-bottom: 0; grid-template-columns: 20px 1fr auto; gap: 2px 4px; font-size: 12px; min-width: 0; }
.skills .skill span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skills .skill svg.icon { width: 19px; height: 19px; }
/* a slightly wider side panel so skill names fit in two columns */
#side { width: 244px; }
#minimap { width: 100%; box-sizing: border-box; }

/* shown while you are driving the truck */
#getout { padding: 5px 10px; font-size: 13px; background: var(--gold); color: var(--ink); border: 2px solid var(--edge); border-radius: 6px; cursor: pointer; }
#getout.hidden { display: none; }
