:root {
  --gold: #ffd84a;
  --gold2: #f2a73b;
  --glass: rgba(14, 15, 11, 0.78);
  --glass2: rgba(255, 244, 214, 0.06);
  --line: rgba(255, 236, 190, 0.14);
  --text: #f3ecd8;
  --muted: #b2a98f;
  --cyan: #5ef0ff;
  --green: #79d98d;
  --display: 'Bebas Neue', Impact, 'Arial Narrow', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text); font: 13px/1.4 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; }
#cesium { position: absolute; inset: 0; }
.cesium-viewer-bottom { left: 10px !important; right: auto !important; bottom: 2px !important; opacity: 0.55; transform: scale(0.85); transform-origin: left bottom; }
.cesium-widget-credits { font-size: 10px; }
button, .btn, input, select { font: inherit; color: var(--text); background: var(--glass2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
button, .btn { cursor: pointer; transition: background .15s, border-color .15s, transform .1s; }
button:hover, .btn:hover { background: rgba(255, 236, 190, 0.13); border-color: rgba(255, 216, 74, 0.45); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: default; }
input::placeholder { color: #8c8672; }
select option { background: #1d1c17; }
kbd { display: inline-block; min-width: 17px; padding: 0 4px; margin-right: 4px; font: 600 10px/16px ui-monospace, Consolas, monospace; text-align: center; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: rgba(0,0,0,.35); color: var(--muted); }

/* ------------------------------------------------------------------ title screen */
#title {
  position: fixed; inset: 0; z-index: 50; cursor: pointer;
  background: linear-gradient(90deg, rgba(8,7,4,.92) 0%, rgba(8,7,4,.55) 38%, rgba(8,7,4,0) 68%), linear-gradient(0deg, rgba(8,7,4,.7), rgba(8,7,4,0) 30%);
  transition: opacity .9s ease, transform .9s ease;
}
#title.out { opacity: 0; transform: scale(1.04); pointer-events: none; }
#title .inner { position: absolute; left: 7vw; top: 50%; transform: translateY(-52%); max-width: 560px; }
#title .kicker { font: 600 12px Inter, sans-serif; letter-spacing: 5px; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
#title h1 { margin: 0; font: 400 clamp(72px, 11vw, 132px)/.82 var(--display); letter-spacing: 2px; color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.6); }
#title h1 span { display: block; font-size: .52em; color: var(--gold); letter-spacing: 4px; margin-top: 8px; }
#title .tag { color: #d9d0b8; font-size: 15px; margin: 18px 0 26px; }
#title .big { font: 400 26px/1 var(--display); letter-spacing: 2px; padding: 14px 28px; border-radius: 10px; color: #19160a; background: linear-gradient(180deg, #ffe27a, var(--gold2)); border: 0; box-shadow: 0 8px 30px rgba(242,167,59,.35); }
#title .big:hover { filter: brightness(1.08); transform: translateY(-1px); }
#title .sub { color: var(--muted); margin-top: 10px; min-height: 18px; }
#title .loading { display: flex; align-items: center; gap: 12px; margin-top: 30px; color: var(--muted); font-size: 12px; }
#title .bar { width: 220px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
#title .bar i { display: block; height: 100%; width: 4%; background: linear-gradient(90deg, var(--gold2), var(--gold)); transition: width .4s; }
#title .press { margin-top: 24px; font: 400 18px var(--display); letter-spacing: 3px; color: rgba(255,255,255,.7); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
#title .foot { position: absolute; left: 7vw; bottom: 28px; display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------------ HUD layer */
#hudLayer { transition: opacity .3s; }
body:not(.playing) #hudLayer { display: none; }
body.nohud #hudLayer > *:not(#panel) { opacity: 0; pointer-events: none; }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(8px); box-shadow: 0 10px 30px rgba(0,0,0,.4); }

#statCard { position: absolute; top: 14px; left: 14px; z-index: 6; width: 300px; padding: 12px 14px; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(8px); box-shadow: 0 10px 30px rgba(0,0,0,.4); transition: opacity .3s, transform .3s; }
body.ledger #statCard { opacity: 0; transform: translateX(-20px); pointer-events: none; }
#statCard .ranch { font: 400 22px/1 var(--display); letter-spacing: 1.5px; color: var(--gold); margin-bottom: 8px; }
#statCard .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
#statCard .stats b { display: block; font: 400 28px/1 var(--display); letter-spacing: 1px; color: #fff; }
#statCard .stats small { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
#timeChip { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); color: #e9dfc2; font-size: 12px; cursor: pointer; }
#timeChip kbd { float: right; }
#quests { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); }
#quests:empty { display: none; }
#quests li { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; font-size: 12px; color: #e7dfc8; transition: opacity .4s; }
#quests li .box { flex: none; width: 14px; height: 14px; margin-top: 1px; border-radius: 4px; border: 1.5px solid rgba(255,216,74,.6); display: grid; place-items: center; font-size: 10px; color: #19160a; }
#quests li.done { color: var(--muted); text-decoration: line-through; }
#quests li.done .box { background: var(--green); border-color: var(--green); }
#quests li.opt { opacity: .75; }
#quests li.pop { animation: pop .6s ease; }
#quests .head { font: 400 15px var(--display); letter-spacing: 1.5px; color: var(--gold); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); color: var(--green); } 100% { transform: scale(1); } }

#compass { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5; width: 440px; max-width: 46vw; height: 30px; overflow: hidden; border-radius: 8px; background: linear-gradient(180deg, rgba(14,15,11,.7), rgba(14,15,11,.45)); border: 1px solid var(--line); -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); pointer-events: none; }
#compassStrip { position: absolute; top: 0; left: 0; height: 100%; will-change: transform; }
#compassStrip .t { position: absolute; bottom: 0; width: 1px; height: 6px; background: rgba(255,255,255,.45); }
#compassStrip .t.m { height: 10px; }
#compassStrip .l { position: absolute; top: 4px; transform: translateX(-50%); font: 400 15px var(--display); letter-spacing: 1px; color: #fff; }
#compassStrip .l.c { color: var(--gold); font-size: 18px; top: 2px; }
#compass .needle { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 8px solid var(--gold); }

#minimap { position: absolute; right: 16px; bottom: 16px; z-index: 5; width: 200px; height: 200px; border-radius: 50%; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 0 2px rgba(255,216,74,.55), 0 0 0 5px rgba(14,15,11,.6); }

#hotbar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 6; display: flex; gap: 8px; padding: 8px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.slot { position: relative; width: 66px; height: 66px; padding: 6px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 10px; background: rgba(255,244,214,.05); border: 1.5px solid rgba(255,236,190,.12); color: #e9dfc2; }
.slot svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.slot span { font-size: 10px; font-weight: 600; letter-spacing: .3px; color: var(--muted); }
.slot i { position: absolute; top: 3px; left: 6px; font: 600 10px ui-monospace, Consolas, monospace; font-style: normal; color: var(--muted); }
.slot:hover { transform: translateY(-2px); }
.slot.active { color: #19160a; background: linear-gradient(180deg, #ffe58a, var(--gold2)); border-color: #fff3c0; box-shadow: 0 0 22px rgba(255,216,74,.45); transform: translateY(-4px); }
.slot.active span, .slot.active i { color: #3a2f0c; }
#toolName { position: absolute; left: 50%; bottom: 112px; transform: translate(-50%, 8px); z-index: 6; font: 400 34px var(--display); letter-spacing: 3px; color: var(--gold); text-shadow: 0 3px 16px rgba(0,0,0,.8); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
#toolName.show { opacity: 1; transform: translate(-50%, 0); }
#hud { position: absolute; left: 50%; bottom: 158px; transform: translateX(-50%); z-index: 5; pointer-events: none; max-width: min(760px, calc(100vw - 32px)); padding: 7px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); text-align: center; white-space: pre-line; font-size: 12.5px; }
#hud:empty { display: none; }
#hud b { color: var(--gold); }

#quick { position: absolute; left: 14px; bottom: 30px; z-index: 6; display: flex; flex-direction: column; gap: 6px; }
#quick button { text-align: left; padding: 6px 10px; background: var(--glass); backdrop-filter: blur(8px); font-weight: 600; font-size: 12px; min-width: 128px; }
#quick button.on { border-color: var(--green); color: var(--green); }
#quick button.off { color: var(--muted); text-decoration: line-through; }

#crosshair { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; z-index: 4; pointer-events: none; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); box-shadow: 0 0 4px rgba(0,0,0,.8); }
#crosshair::after { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: var(--gold); }
#walkHint { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); z-index: 5; max-width: 90vw; padding: 6px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); pointer-events: none; font-size: 12px; text-align: center; }
#toast { position: absolute; top: 92px; left: 50%; z-index: 60; transform: translate(-50%, -6px); max-width: 420px; padding: 8px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); opacity: 0; pointer-events: none; transition: .2s; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#notify { position: absolute; top: 14px; right: 14px; z-index: 7; display: flex; flex-direction: column; gap: 8px; width: 310px; pointer-events: none; }
.card { padding: 10px 14px 11px; border-radius: 10px; background: var(--glass); backdrop-filter: blur(8px); border: 1px solid var(--line); border-left: 4px solid var(--cyan); box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: slidein .35s cubic-bezier(.2,1.3,.4,1); transition: opacity .4s, transform .4s; }
.card.gold { border-left-color: var(--gold); }
.card.out { opacity: 0; transform: translateX(30px); }
.card b { display: block; font: 400 20px/1.05 var(--display); letter-spacing: 1.2px; color: #fff; }
.card.gold b { color: var(--gold); }
.card span { color: #ddd3b8; font-size: 12px; }
@keyframes slidein { from { opacity: 0; transform: translateX(40px); } }

/* ------------------------------------------------------------------ ledger */
#panel { position: absolute; top: 12px; left: 12px; bottom: 12px; z-index: 8; width: 340px; max-width: calc(100vw - 24px); display: flex; flex-direction: column; background: rgba(16,16,12,.9); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(10px); box-shadow: 0 14px 40px rgba(0,0,0,.55); transform: translateX(calc(-100% - 30px)); transition: transform .35s cubic-bezier(.2,.9,.3,1); }
#panel.open { transform: none; }
#panel header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
#panel h1 { margin: 0; font: 400 26px/1 var(--display); letter-spacing: 2px; color: var(--gold); }
#collapse { padding: 0 10px; font-size: 20px; line-height: 28px; }
#panel .scroll { overflow-y: auto; padding: 4px 14px 14px; }
section { padding: 12px 0; border-bottom: 1px solid var(--line); }
h2 { margin: 0 0 8px; font: 400 16px var(--display); letter-spacing: 1.5px; color: #e9dfc2; display: flex; justify-content: space-between; gap: 8px; }
h2 .sub { font: 600 12px Inter, sans-serif; letter-spacing: 0; color: var(--gold); }
footer { padding-top: 12px; }
#searchForm { display: flex; gap: 6px; }
#searchForm input { flex: 1; min-width: 0; }
.row { display: flex; gap: 6px; margin-top: 6px; }
.row > * { flex: 1; min-width: 0; }
.field { display: block; margin: 8px 0; color: var(--muted); }
.field select, .field input[type=range] { display: block; width: 100%; margin-top: 4px; }
.field.inline input { width: 64px; margin: 0 4px; }
input[type=range] { padding: 0; accent-color: var(--gold); background: none; border: 0; }
.chk { display: flex; align-items: center; gap: 6px; margin: 8px 0; }
.chk input { accent-color: var(--gold); }
.chk select { padding: 2px 4px; }
.note { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.note b.o { color: #ff9f1c; } .note b.r { color: #ff3b30; } .note b.b { color: #4aa8ff; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 6px; padding: 6px 7px; border-radius: 7px; cursor: pointer; }
.list li:hover { background: var(--glass2); }
.list li.sel { background: rgba(94,240,255,.1); outline: 1px solid rgba(94,240,255,.4); }
.list li .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li .meta { color: var(--muted); white-space: nowrap; }
.list li button { padding: 1px 7px; font-size: 12px; }
.list li.empty { color: var(--muted); cursor: default; font-style: italic; }
.list li.empty:hover { background: none; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.warn { color: #ff9f1c; } .water { color: #4aa8ff; }
#selInfo input { width: 100%; margin-bottom: 6px; }
#selInfo table { width: 100%; border-collapse: collapse; }
#selInfo td { padding: 2px 0; }
#selInfo td:last-child { text-align: right; font-weight: 600; }
#selInfo td:first-child { color: var(--muted); }
#alignInfo .who { font-weight: 600; margin-bottom: 4px; }
#alignInfo .off { color: var(--muted); margin-bottom: 6px; }
.nudge { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 6px 0; }
.nudge button { padding: 4px 0; }
dl.keys { margin: 0; display: grid; grid-template-columns: 44px 1fr; gap: 6px 8px; font-size: 12px; }
dl.keys dt { color: var(--gold); font-weight: 600; }
dl.keys dd { margin: 0; color: var(--muted); }
dl.keys kbd { margin-right: 1px; }

@media (max-width: 900px) {
  #minimap { width: 140px; height: 140px; }
  #statCard { width: 250px; }
  #quick button { min-width: 0; }
  .slot { width: 52px; height: 52px; }
  .slot span { display: none; }
}
