/* FELSENFEST HUD — parchment-on-dusk medieval */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #10141c; }
body { font: 14px/1.45 Georgia, 'Times New Roman', serif; color: #e8dfc8; user-select: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }

.panel {
  background: linear-gradient(180deg, rgba(24,20,16,.92), rgba(16,14,11,.92));
  border: 1px solid #4d4030; border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,.5);
}
.hidden { display: none !important; }

/* top bar */
#topbar {
  position: absolute; top: 8px; left: 8px; right: 8px;
  display: flex; align-items: center; gap: 14px; padding: 6px 12px;
  border-radius: 8px; white-space: nowrap; overflow: hidden;
}
#logo { font-weight: bold; letter-spacing: 2px; color: #d8b95a; font-size: 15px; }
#topbar .spacer { flex: 1; }
#date { color: #f0e6d0; }
#temp, #larder, #pop, #sliceInfo { color: #b8ac90; font-size: 13px; }
#larder.low { color: #ff8a6a; }
button {
  font: inherit; color: #e8dfc8; background: #2a2318; border: 1px solid #55462e;
  border-radius: 5px; padding: 3px 10px; cursor: pointer;
}
button:hover { background: #3a3020; border-color: #7a663f; }
button.on { background: #55462a; border-color: #d8b95a; color: #ffe9a8; }
button.danger { background: #4a1f18; border-color: #a04a3a; }
#speed { display: flex; gap: 3px; }
#speed button { padding: 3px 8px; }

/* colonist chips */
#chips { position: absolute; top: 52px; right: 8px; display: flex; flex-direction: column; gap: 4px; }
.chip {
  display: flex; align-items: center; gap: 6px; padding: 3px 10px; cursor: pointer;
  background: rgba(24,20,16,.85); border: 1px solid #4d4030; border-radius: 12px; font-size: 12.5px;
}
.chip:hover { border-color: #d8b95a; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.chip.sel { border-color: #ffe27a; }

/* goals */
#goals { position: absolute; top: 52px; left: 8px; padding: 8px 12px; font-size: 12.5px; max-width: 250px; }
#goals h4 { color: #d8b95a; font-size: 12px; letter-spacing: 1px; margin-bottom: 4px; }
#goals .goal { color: #cbbfa4; }
#goals .goal.done { color: #7fa04a; text-decoration: line-through; }

/* toasts */
#toasts { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { padding: 6px 16px; border-radius: 6px; background: rgba(20,17,12,.94); border: 1px solid #55462e; animation: fadein .2s; font-size: 13.5px; }
.toast.danger { border-color: #c05a4a; color: #ffb0a0; }
.toast.warn { border-color: #c0954a; color: #ffd9a0; }
.toast.good { border-color: #6a9a4a; color: #c0e8a0; }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } }

/* toolbar */
#toolbar {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px; padding: 8px 12px; border-radius: 8px; align-items: flex-end;
  max-width: 96vw; flex-wrap: wrap; justify-content: center;
}
.toolgroup { display: flex; flex-direction: column; gap: 3px; }
.toolgroup .glabel { font-size: 10px; letter-spacing: 1px; color: #8a7c60; text-align: center; text-transform: uppercase; }
.toolgroup .btns { display: flex; gap: 3px; }
.tbtn { padding: 4px 9px; font-size: 13px; }
#toolhint {
  position: absolute; bottom: 66px; left: 50%; transform: translateX(-50%);
  font-size: 12.5px; color: #ffe9a8; background: rgba(20,17,12,.85); padding: 3px 12px; border-radius: 10px;
}

/* inspector */
#inspector { position: absolute; right: 8px; bottom: 8px; width: 270px; padding: 10px 14px; font-size: 13px; }
#inspector h3 { color: #ffe9a8; font-size: 15px; margin-bottom: 2px; }
#inspector .traits { color: #b8ac90; font-style: italic; font-size: 12px; margin-bottom: 6px; }
#inspector .bar { height: 9px; background: #1a1712; border: 1px solid #4d4030; border-radius: 4px; margin: 2px 0 6px; overflow: hidden; }
#inspector .bar > div { height: 100%; }
#inspector .blabel { display: flex; justify-content: space-between; font-size: 11.5px; color: #b8ac90; }
#inspector .task { color: #cbbfa4; margin-top: 4px; font-style: italic; }
#inspector .kv { color: #b8ac90; font-size: 12.5px; }
#inspector .kv b { color: #e8dfc8; }

/* chronicle */
#chronicle { position: absolute; right: 8px; top: 52px; bottom: 70px; width: 330px; padding: 10px 4px 10px 14px; display: flex; flex-direction: column; }
#chronicle h3 { color: #d8b95a; margin-bottom: 6px; }
#chronList { overflow-y: auto; flex: 1; padding-right: 10px; font-size: 12.5px; }
#chronList .ce { margin-bottom: 7px; color: #cbbfa4; }
#chronList .ce .cd { color: #8a7c60; font-size: 11px; }
#chronList .ce.doom { color: #e08a7a; }
#chronList .ce.triumph { color: #b8d890; }

/* overlays / menu */
.overlay { position: absolute; inset: 0; background: rgba(8,10,14,.72); display: flex; align-items: center; justify-content: center; z-index: 10; }
.menuCard { padding: 28px 34px; text-align: center; max-width: 460px; }
.menuCard.wide { max-width: 720px; text-align: left; }
.menuCard h1 { color: #d8b95a; letter-spacing: 6px; font-size: 34px; margin-bottom: 6px; }
.menuCard h2 { color: #d8b95a; margin-bottom: 10px; }
.menuCard .sub { color: #b8ac90; margin-bottom: 18px; }
.menuCard label { display: block; margin-bottom: 14px; color: #b8ac90; font-size: 13px; }
.menuCard input { font: inherit; background: #1a1712; color: #e8dfc8; border: 1px solid #55462e; border-radius: 4px; padding: 5px 10px; margin-left: 8px; width: 160px; }
.menuCard .big { display: block; width: 100%; margin: 8px 0; padding: 10px; font-size: 15px; }
.menuCard .tiny { color: #8a7c60; font-size: 12px; margin-top: 14px; }
.cols { display: flex; gap: 26px; margin-bottom: 14px; }
.cols > div { flex: 1; }
.cols h4 { color: #d8b95a; margin: 10px 0 3px; }
.cols p { color: #cbbfa4; font-size: 13px; }
table.keys { font-size: 12.5px; color: #cbbfa4; border-collapse: collapse; }
table.keys td { padding: 2px 10px 2px 0; }
table.keys td:first-child { color: #ffe9a8; font-family: monospace; }
.chronTail { max-height: 260px; overflow-y: auto; margin: 12px 0; font-size: 13px; color: #cbbfa4; }
.chronTail .ce { margin-bottom: 6px; }
.chronTail .ce .cd { color: #8a7c60; font-size: 11px; }

/* big panels (research / craft / worldmap / pause) */
.bigpanel {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  width: 620px; max-width: 94vw; max-height: calc(100vh - 140px);
  overflow-y: auto; padding: 12px 16px; z-index: 5;
}
.phead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.phead h3 { color: #d8b95a; }
.pclose { cursor: pointer; color: #8a7c60; font-size: 16px; padding: 2px 8px; }
.pclose:hover { color: #ffe9a8; }
.rsub { display: block; color: #9a8e74; font-size: 11.5px; font-weight: normal; }
.ractive { background: #241f16; border: 1px solid #55462e; border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; font-size: 13px; }
.rbranches { display: flex; gap: 10px; flex-wrap: wrap; }
.rbranch { flex: 1; min-width: 180px; }
.rbranch h4 { color: #d8b95a; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
.rnode { border: 1px solid #4d4030; border-radius: 6px; padding: 5px 9px; margin-bottom: 5px; font-size: 12.5px; }
.rnode.avail { cursor: pointer; }
.rnode.avail:hover { border-color: #d8b95a; background: #2a2318; }
.rnode.done { opacity: 0.55; border-color: #4a6a3a; }
.rnode.locked { opacity: 0.4; }
.rnode.active { border-color: #ffe27a; background: #2e2718; }
.crow { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #2e281e; padding: 7px 2px; font-size: 13px; }
.crow.locked { opacity: 0.5; }
.cctl { display: flex; gap: 7px; align-items: center; min-width: 110px; justify-content: flex-end; }
#wmCanvas { width: 100%; border-radius: 6px; cursor: pointer; margin-bottom: 8px; }
#wmDetail h4 { color: #ffe9a8; }
.wparty { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0; font-size: 13px; }
.wparty label { cursor: pointer; }
.wtrade { margin: 8px 0; font-size: 13px; }
.wtrade select, .wtrade input { font: inherit; background: #1a1712; color: #e8dfc8; border: 1px solid #55462e; border-radius: 4px; padding: 2px 6px; }
#wmDetail .big { width: 100%; margin-top: 8px; padding: 8px; }
.slotlist { margin-bottom: 12px; }
.slot { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; border-bottom: 1px solid #2e281e; font-size: 13.5px; }
.slot button { margin-left: 6px; }
.slotrow { display: flex; gap: 8px; margin-top: 10px; }
.slotrow button { flex: 1; padding: 8px; }

/* shard / online */
#onlineBadge { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #1a2418; border: 1px solid #3a5a2e; }
#onlineBadge.good { color: #9adf6a; }
#onlineBadge.bad { color: #ff8a6a; border-color: #a04a3a; background: #2a1512; }
.onlineBox { border: 1px solid #55462e; border-radius: 8px; padding: 10px 12px; margin: 12px 0; text-align: left; }
.onlineBox h3 { color: #d8b95a; font-size: 14px; }
.onlineBox input { width: 118px; margin: 2px 4px 2px 0; }
#shardMap { width: 100%; border-radius: 6px; cursor: default; margin-bottom: 6px; }
.ticker { max-height: 92px; overflow-y: auto; font-size: 12px; color: #b8ac90; border-bottom: 1px solid #2e281e; margin-bottom: 8px; padding-bottom: 6px; }
.shardrow { margin: 6px 0; font-size: 13px; }
.shardrow select, .shardrow input { font: inherit; background: #1a1712; color: #e8dfc8; border: 1px solid #55462e; border-radius: 4px; padding: 2px 6px; }
.chip2 { background: #241f16; border: 1px solid #55462e; border-radius: 10px; padding: 2px 8px; font-size: 12.5px; margin-right: 4px; }
.chip2 button { padding: 0 5px; font-size: 11px; }
table.shardtbl { border-collapse: collapse; width: 100%; font-size: 12.5px; margin: 4px 0; }
table.shardtbl th { text-align: left; color: #8a7c60; font-weight: normal; border-bottom: 1px solid #4d4030; padding: 2px 8px; }
table.shardtbl td { padding: 3px 8px; border-bottom: 1px solid #2a251c; }
#shard h4 { color: #d8b95a; margin: 10px 0 3px; }
