:root {
  --steel: #343a46;
  --steel-dark: #1c2027;
  --steel-light: #5a6372;
  --orange: #ff981f;
  --yellow: #ffff00;
  --text: #e8e0c8;
  --font: 'VT323', 'Courier New', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0818; font-family: var(--font); color: var(--text); user-select: none; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
[hidden] { display: none !important; }
button { font-family: var(--font); }

.panel-frame {
  background: var(--steel);
  border: 2px solid var(--steel-dark);
  box-shadow: inset 0 0 0 1px var(--steel-light), 0 2px 8px rgba(0,0,0,.6);
}

/* hover text, top-left like the classic client */
#hovertext { position: fixed; left: 8px; top: 6px; font-size: 20px; text-shadow: 1px 1px 0 #000; pointer-events: none; z-index: 5; }
#hovertext .act, .menu-opt .act { color: #fff; }
#hovertext .more { color: #fff; }

/* overlays */
#overlay { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.hpbar { position: absolute; width: 30px; height: 5px; background: #e00000; border: 1px solid #000; }
.hpbar i { display: block; height: 100%; background: #00e000; }
.splat { position: absolute; transform: translate(-50%, -50%); min-width: 22px; height: 20px; padding: 0 4px; border-radius: 10px; text-align: center;
  font-size: 18px; line-height: 20px; color: #fff; text-shadow: 1px 1px 0 #000; border: 1px solid #000; }
.splat.hit { background: #b00000; }
.splat.miss { background: #2050c0; }
.click-x { position: fixed; transform: translate(-50%, -50%); font-size: 16px; pointer-events: none; z-index: 20; animation: clickx .4s forwards; text-shadow: 1px 1px 0 #000; }
.click-x.walk { color: #ffff00; }
.click-x.act { color: #ff2020; }
@keyframes clickx { to { transform: translate(-50%, -50%) scale(.4); opacity: .2; } }

/* xp drops */
#xpdrops { position: fixed; right: 200px; top: 20px; width: 120px; height: 180px; pointer-events: none; z-index: 4; }
.xpdrop { position: absolute; right: 0; top: 150px; font-size: 20px; color: #fff; text-shadow: 1px 1px 0 #000; animation: xpup 1.8s linear forwards; white-space: nowrap; }
.xpdrop span { font-size: 15px; }
@keyframes xpup { from { top: 150px; opacity: 1; } 85% { opacity: 1; } to { top: 0; opacity: 0; } }

/* minimap & orbs */
#topright { position: fixed; right: 6px; top: 6px; display: flex; gap: 4px; z-index: 6; }
#orbs { display: flex; flex-direction: column; gap: 8px; padding-top: 20px; }
.orb { --fill: 100%; position: relative; width: 58px; height: 30px; border-radius: 15px; background: var(--steel-dark); border: 2px solid var(--steel-light);
  display: flex; align-items: center; justify-content: space-between; padding: 0 8px; cursor: pointer; overflow: hidden; }
.orb::before { content: ''; position: absolute; left: 0; bottom: 0; height: 100%; width: var(--fill); background: rgba(160, 30, 30, .55); z-index: 0; }
#orb-run::before { background: rgba(140, 120, 40, .5); }
#orb-run.on::before { background: rgba(220, 190, 40, .75); }
.orb b, .orb span { position: relative; z-index: 1; font-size: 18px; text-shadow: 1px 1px 0 #000; font-weight: normal; }
.orb span { color: #0f0; }
#orb-run span { color: #ffff00; }
#mm-wrap { position: relative; width: 170px; height: 170px; border-radius: 50%; background: var(--steel); border: 3px solid var(--steel-dark); box-shadow: inset 0 0 0 2px var(--steel-light); padding: 2px; }
#minimap { width: 160px; height: 160px; border-radius: 50%; cursor: pointer; display: block; }
#compass { position: absolute; left: -6px; top: -6px; cursor: pointer; border-radius: 50%; }

/* chat */
#chat { position: fixed; left: 6px; bottom: 6px; width: min(520px, calc(100vw - 270px)); height: 168px; z-index: 6; }
#chat-log { position: absolute; inset: 0; overflow-y: auto; padding: 6px 10px; font-size: 18px; line-height: 19px; text-shadow: 1px 1px 0 #000;
  background: rgba(20, 22, 30, .78); border: 2px solid var(--steel-dark); box-shadow: inset 0 0 0 1px var(--steel-light); }
#chat-log::-webkit-scrollbar { width: 10px; } #chat-log::-webkit-scrollbar-thumb { background: var(--steel-light); }
#dialogue { position: absolute; inset: 0; background: #262b35; border: 2px solid var(--steel-dark); box-shadow: inset 0 0 0 1px var(--steel-light); padding: 10px 18px; cursor: pointer; text-align: center; }
.dlg-name { color: #ff3030; font-size: 21px; text-shadow: 1px 1px 0 #000; }
.dlg-text { font-size: 20px; color: #fff; margin: 8px 0; text-shadow: 1px 1px 0 #000; min-height: 80px; display: flex; align-items: center; justify-content: center; }
.dlg-cont { color: #4ab0ff; font-size: 18px; text-shadow: 1px 1px 0 #000; }
.dlg-name.you { color: #4ab0ff; }
.dlg-name.sel { color: #ff981f; }
.dlg-choices { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.dlg-choice { font-size: 20px; color: #fff; text-shadow: 1px 1px 0 #000; cursor: pointer; }
.dlg-choice:hover { color: #ffff00; }
.dlg-choice b { color: #ff981f; font-weight: normal; }

/* quests */
.qp { color: var(--orange); font-size: 20px; text-align: center; text-shadow: 1px 1px 0 #000; }
.qhead { color: var(--orange); font-size: 18px; margin: 8px 0 2px 4px; border-bottom: 1px solid var(--steel-dark); }
.qitem { font-size: 19px; padding: 1px 8px; cursor: pointer; text-shadow: 1px 1px 0 #000; }
.qitem:hover { background: rgba(255,255,255,.08); }
#iface.journal { background: #d8c9a3; border-color: #5a4630; box-shadow: inset 0 0 0 2px #b8a47a, 0 4px 18px rgba(0,0,0,.7); }
#iface.journal .win-title { color: #5a2808; text-shadow: none; border-color: #b8a47a; }
.journal { color: #2a1c0e; font-size: 19px; line-height: 20px; max-height: 340px; overflow-y: auto; padding: 0 8px; }
.journal p { margin: 4px 0 8px; }
.journal ul { margin: 0 0 8px; padding-left: 20px; }
.journal li { margin-bottom: 6px; color: #800000; }
.journal li span { color: #5a4630; }
.journal li small { display: block; color: #3a3a7a; font-size: 16px; line-height: 16px; }
.journal .struck { text-decoration: line-through; color: #6a5a40; }
.journal .qdone { color: #a00000; text-align: center; font-size: 22px; text-decoration: none; }

#questdone { position: fixed; left: calc(50% - 130px); top: 44%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 280px)); z-index: 26;
  background: #d8c9a3; border: 3px solid #5a4630; box-shadow: inset 0 0 0 2px #b8a47a, 0 6px 24px rgba(0,0,0,.8); padding: 10px 16px; color: #2a1c0e; text-align: center; animation: pop .35s ease-out; }
.qd-title { font-size: 30px; color: #a00000; }
.qd-sub { font-size: 20px; margin-bottom: 8px; }
.qd-sub b { font-weight: normal; color: #5a2808; }
.qd-body { display: flex; gap: 16px; align-items: center; text-align: left; }
.qd-art { font-size: 64px; }
.qd-aw { font-size: 19px; color: #5a2808; }
.qd-body ul { margin: 2px 0; padding-left: 18px; font-size: 18px; line-height: 18px; }
.qd-foot { font-size: 19px; margin-top: 8px; color: #5a2808; }
.qd-close { margin-top: 6px; background: #5a4630; color: #f0e4c8; border: 1px solid #2a1c0e; font-size: 18px; padding: 2px 18px; cursor: pointer; }

/* make box sits over the chat, as in the classic client */
#makebox { position: fixed; left: 6px; bottom: 6px; width: min(520px, calc(100vw - 270px)); min-height: 168px; z-index: 7; background: #262b35;
  border: 2px solid var(--steel-dark); box-shadow: inset 0 0 0 1px var(--steel-light); padding: 6px 10px; }
.make-title { color: var(--orange); font-size: 21px; text-shadow: 1px 1px 0 #000; display: flex; justify-content: space-between; }
.make-qty { display: flex; gap: 4px; margin: 4px 0; }
.make-qty button { background: var(--steel-dark); color: var(--text); border: 1px solid var(--steel-light); font-size: 17px; padding: 0 10px; cursor: pointer; }
.make-qty button.on { color: var(--yellow); border-color: var(--orange); }
.make-list { display: flex; flex-wrap: wrap; gap: 4px; max-height: 210px; overflow-y: auto; }
.make-item { width: 92px; height: 66px; background: var(--steel-dark); border: 1px solid var(--steel-light); color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2px; }
.make-item:hover { border-color: var(--orange); }
.make-item span { font-size: 14px; line-height: 13px; text-align: center; }
.make-item small { font-size: 13px; color: var(--orange); }
.make-item.dim { opacity: .45; }

/* side panel */
#side { position: fixed; right: 6px; bottom: 6px; width: 244px; z-index: 6; }
#tabs { display: flex; background: var(--steel); border: 2px solid var(--steel-dark); border-bottom: 0; }
.tab { flex: 1; height: 36px; font-size: 17px; padding: 0; background: var(--steel); border: 0; border-right: 1px solid var(--steel-dark); cursor: pointer; }
.tab:hover { background: #404858; }
.tab.on { background: #6a3020; box-shadow: inset 0 0 0 1px #c05030; }
#panel { height: 272px; background: var(--steel); border: 2px solid var(--steel-dark); box-shadow: inset 0 0 0 1px var(--steel-light); padding: 6px; overflow: hidden; }

.inv-grid { display: grid; grid-template-columns: repeat(4, 52px); grid-auto-rows: 36px; gap: 1px 4px; justify-content: center; }
.slot { position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 3px; }
.slot:hover { background: rgba(255,255,255,.06); }
.slot.sel { background: rgba(255,255,255,.18); outline: 1px solid #fff; }
.slot img { width: 36px; height: 32px; pointer-events: none; image-rendering: pixelated; }
.slot .qty { position: absolute; left: 3px; top: -3px; font-size: 16px; text-shadow: 1px 1px 0 #000; pointer-events: none; }

.skill-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.skill { display: flex; align-items: center; justify-content: space-between; background: var(--steel-dark); border: 1px solid #000; box-shadow: inset 0 0 0 1px #4a5260; height: 34px; padding: 0 6px; cursor: default; }
.sk-ic { font-size: 16px; }
.sk-lv { font-size: 19px; color: var(--yellow); text-shadow: 1px 1px 0 #000; }
.sk-lv i { color: var(--yellow); font-style: normal; margin: 0 1px; }
.total { text-align: center; margin-top: 8px; color: var(--yellow); font-size: 20px; text-shadow: 1px 1px 0 #000; }
.hint { text-align: center; color: #a0a8b8; font-size: 15px; margin-top: 4px; }

.cb-head { color: var(--orange); font-size: 20px; text-align: center; text-shadow: 1px 1px 0 #000; }
.cb-lvl { color: var(--orange); font-size: 18px; text-align: center; margin-bottom: 8px; }
.styles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.style, .retal { background: var(--steel-dark); border: 1px solid #000; box-shadow: inset 0 0 0 1px #4a5260; color: var(--orange); padding: 6px; cursor: pointer; font-size: 17px; line-height: 15px; }
.style b { display: block; font-weight: normal; font-size: 19px; color: #fff; }
.style.on, .retal.on { background: #5a2818; box-shadow: inset 0 0 0 1px #c05030; }
.retal { width: 100%; margin-top: 10px; }

.equip { display: flex; flex-direction: column; align-items: center; gap: 3px; margin-top: 2px; }
.erow { display: flex; gap: 12px; }
.eslot { width: 40px; height: 40px; background: var(--steel-dark); border: 1px solid #000; box-shadow: inset 0 0 0 1px #4a5260; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.eslot span { font-size: 13px; color: #6a7280; }
.bonus { margin-top: 8px; font-size: 18px; color: var(--orange); padding-left: 16px; line-height: 18px; }   /* (compact: four slot rows and four bonus lines fit the panel) */
.bonus b { color: #fff; font-weight: normal; }

.settings h3 { margin: 2px 0 4px; color: var(--orange); font-weight: normal; font-size: 21px; }
.settings p { margin: 0 0 6px; font-size: 16px; line-height: 16px; color: #d0d4dc; }
.settings button { background: var(--steel-dark); color: var(--text); border: 1px solid var(--steel-light); font-size: 18px; padding: 2px 10px; margin: 0 4px 8px 0; cursor: pointer; }
.settings button.danger { color: #ff7060; }

/* windows: bank & shop */
#iface { position: fixed; left: calc(50% - 130px); top: 46%; transform: translate(-50%, -50%); width: min(470px, calc(100vw - 280px)); z-index: 8;
  background: var(--steel); border: 2px solid var(--steel-dark); box-shadow: inset 0 0 0 1px var(--steel-light), 0 4px 18px rgba(0,0,0,.7); }
.win-title { color: var(--orange); font-size: 22px; text-align: center; padding: 4px; text-shadow: 1px 1px 0 #000; position: relative; border-bottom: 1px solid var(--steel-dark); }
.win-x { position: absolute; right: 4px; top: 4px; background: #5a2818; color: #fff; border: 1px solid #000; cursor: pointer; font-size: 14px; width: 24px; height: 22px; }
#makebox .win-x { position: static; }
.win-body { padding: 8px; }
.bank-grid, .shop-grid { display: grid; grid-template-columns: repeat(8, 1fr); grid-auto-rows: 40px; gap: 2px; min-height: 172px; max-height: 300px; overflow-y: auto; }
.shop-grid { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 50px; }
.slot .price { position: absolute; bottom: -2px; font-size: 15px; color: var(--yellow); text-shadow: 1px 1px 0 #000; }
.empty { grid-column: 1 / -1; text-align: center; color: #a0a8b8; font-size: 18px; padding-top: 50px; }
.win-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 16px; color: #c8ccd4; gap: 6px; }
.win-foot button { background: var(--steel-dark); color: var(--text); border: 1px solid var(--steel-light); font-size: 17px; cursor: pointer; padding: 2px 8px; }

/* context menu */
#ctxmenu { position: fixed; z-index: 30; background: #5d5447; border: 1px solid #000; min-width: 120px; font-size: 19px; padding-bottom: 2px; }
.menu-title { background: #000; color: #5d5447; padding: 1px 4px; font-size: 18px; }
.menu-opt { padding: 0 6px; white-space: nowrap; text-shadow: 1px 1px 0 #000; cursor: pointer; line-height: 20px; }
.menu-opt:hover { background: rgba(255,255,255,.12); }

/* level up & death */
#levelup { position: fixed; left: 6px; bottom: 180px; width: min(520px, calc(100vw - 270px)); z-index: 9; background: #262b35; border: 2px solid var(--steel-dark);
  box-shadow: inset 0 0 0 1px var(--steel-light); padding: 8px 14px; display: flex; gap: 14px; align-items: center; font-size: 19px; color: #fff; text-shadow: 1px 1px 0 #000; }
#levelup b { color: #4ab0ff; font-weight: normal; font-size: 21px; }
.lu-ic { font-size: 36px; }
#levelup.pop { animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#death { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; pointer-events: none; }
#death span { color: #ff3030; font-size: 44px; text-shadow: 2px 2px 0 #000; }
#death.fade { animation: deathfade 2.5s forwards; }
@keyframes deathfade { 0% { opacity: 1; } 60% { opacity: 1; } 100% { opacity: 0; } }

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

@media (max-width: 760px) {
  #chat, #makebox, #levelup { width: calc(100vw - 12px); bottom: 330px; }
  #levelup { bottom: 504px; }
  #xpdrops { right: 10px; top: 200px; }
}

/* inside a habitat dome: a still picture of the crew quarters that fades in while you rest */
#domeview { position: fixed; inset: 0; z-index: 24; background: #000; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .6s ease; cursor: pointer; }
#domeview.show { opacity: 1; }
#domeview img { width: 100%; height: 100%; object-fit: cover; }
#domeview span { position: absolute; bottom: 28px; left: 0; right: 0; text-align: center; color: #ffe8b0; font-size: 22px; text-shadow: 2px 2px 0 #000; }
#domeview.backdrop { z-index: 2; cursor: default; }   /* behind the windows and panels, over the world */
#domeview.backdrop span { display: none; }

/* a room you can look round: the still picture covers the view (cropped like the other interiors) with click spots on
   it; the chat, dialogue and side panels stay on top */
#roomview { position: fixed; inset: 0; z-index: 2; background: #000; overflow: hidden; opacity: 0; transition: opacity .5s ease; }
#roomview.show { opacity: 1; }
#roomview .room { position: absolute; left: 50%; top: 50%; width: max(100vw, 177.78vh); aspect-ratio: 16 / 9; transform: translate(-50%, -50%); }
#roomview .room img { width: 100%; height: 100%; display: block; }
#roomview .hots { position: absolute; inset: 0; width: 100%; height: 100%; }
#roomview .hots path { fill: transparent; stroke: transparent; stroke-width: 2.5px; transition: stroke .25s, filter .25s; stroke-linejoin: round; vector-effect: non-scaling-stroke; cursor: pointer; pointer-events: all; }
#roomview .hots path:hover { stroke: var(--hc); }   /* a steady glow: the bright line plus the blurred halo under it */
#roomview .hot-label { position: absolute; transform: translate(-50%, -130%); white-space: nowrap; font-size: 20px; pointer-events: none;
  -webkit-text-stroke: 3px #000; paint-order: stroke fill; text-shadow: 1px 1px 0 #000; }   /* a thin black outline so the yellow reads anywhere */
#roomview .leave { position: absolute; left: 10px; top: 10px; z-index: 1; font: inherit; font-size: 20px; color: #ffe8b0; background: #262b35;
  border: 2px solid #000; border-radius: 6px; padding: 4px 14px; cursor: pointer; }
#roomview .leave:hover { color: #fff; }
/* always glowing, like a hovered spot: a bright yellow rim with a soft halo round it */
#roomview .leave { border-color: #ffff00; box-shadow: 0 0 4px 1px #ffff00, 0 0 14px 5px rgba(255, 255, 0, .55), 0 0 26px 10px rgba(255, 255, 0, .25); }
#roomview .hots path.halo { stroke: var(--hc); stroke-width: 1.6; vector-effect: none; opacity: 0; filter: url(#hotglow); pointer-events: none; transition: opacity .25s; }
#roomview .hots path.halo.on { opacity: .9; }
#roomview .hots mask path { fill: #000; stroke: #000; stroke-width: 0.4; vector-effect: none; transition: none; }   /* shapes in front cut a hole in the glow behind */

/* oxygen orb: a cyan tank gauge that flashes when low */
#orb-o2::before { background: rgba(40, 170, 220, .55); }
#orb-o2 b { font-size: 15px; color: #bff4ff; }
#orb-o2.low { animation: o2low 1s ease-in-out infinite; }
@keyframes o2low { 50% { border-color: #ff5030; box-shadow: 0 0 10px #ff5030; } }

/* talking inside a room: the talk box sits centred under the speaker, and the room's click spots are off until done */
body.talking #roomview .hots, body.talking #roomview .hot-label { pointer-events: none !important; }
body.talking #roomview .hots path { stroke: transparent !important; pointer-events: none !important; cursor: default; }
body.talking #roomview .hots path.halo { opacity: 0 !important; }
body.talking #roomview .hot-label { display: none; }
body.in-room.talking #chat { left: 50%; transform: translateX(-50%); bottom: 14%; width: min(520px, 60vw); }
/* resting in a bunk: the room dims, then comes back */
#roomview .room img { transition: filter .8s ease; }
#roomview.resting .room img { filter: brightness(0.25); }

/* oxygen at 5% or less: the whole view pulses red, as if through a red filter switching on and off */
body.o2-critical::after { content: ''; position: fixed; inset: 0; background: rgba(255, 20, 20, 0.38); pointer-events: none; z-index: 9000; animation: o2pulse 1.1s ease-in-out infinite; }
@keyframes o2pulse { 0%, 100% { opacity: 0; } 45%, 60% { opacity: 1; } }

/* god mode tag (building and testing the story) */
#orbs .autobtn { display: block; width: 100%; font: bold 10px/1 sans-serif; color: #ffe040; background: rgba(40, 30, 10, 0.85); border: 1px solid #b08020; border-radius: 3px; padding: 4px 5px; margin-top: 4px; cursor: pointer; }
#orbs .autobtn:hover { background: rgba(80, 55, 10, 0.9); }
#orbs .autobtn.on { color: #ff8070; border-color: #c04030; background: rgba(60, 15, 10, 0.9); }
#orbs .autobtn[hidden] { display: none; }
#godmode { font: bold 10px/1 sans-serif; color: #ffe040; background: rgba(60, 20, 0, 0.75); border: 1px solid #ffb020; border-radius: 3px; padding: 3px 5px; text-align: center; letter-spacing: 1px; margin-top: 4px; }

/* ---------------------------------------------------------------- sign in */
#signin { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, #2a1840 0%, #0d0818 70%); }
#signin .box { width: 100%; max-width: 360px; background: rgba(20, 14, 34, 0.96); border: 2px solid #5a4630; border-radius: 6px;
  padding: 20px 22px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6); color: #e8dcc0; font: 20px 'VT323', monospace; }
#signin h1 { margin: 0 0 4px; font-size: 40px; color: var(--orange); text-align: center; letter-spacing: 1px; }
#signin .sub { margin: 0 0 14px; text-align: center; color: #c8b890; }
#signin label { display: block; margin: 8px 0; }
#signin input { display: block; width: 100%; box-sizing: border-box; margin-top: 3px; padding: 6px 8px; font: 20px 'VT323', monospace;
  color: #fff; background: #120c1e; border: 1px solid #6a5638; border-radius: 3px; }
#signin input:focus { outline: none; border-color: var(--orange); }
#signin .row { display: flex; gap: 8px; margin-top: 12px; }
#signin .row button { flex: 1; padding: 7px 6px; font: 20px 'VT323', monospace; color: #1a1208; background: var(--orange); border: none; border-radius: 3px; cursor: pointer; }
#signin .row button[data-act="signup"] { background: #3a2c48; color: #e8dcc0; }
#signin .row button:disabled { opacity: 0.6; cursor: default; }
#signin .row.small { justify-content: space-between; }
#signin .row button.link { flex: none; background: none; color: #9fd8ff; padding: 2px 0; text-decoration: underline; }
#signin .err { margin: 10px 0 0; color: #ff7060; }
#signin .hint { margin: 14px 0 0; font-size: 17px; color: #9a8a70; text-align: center; }
#signin input { user-select: text; -webkit-user-select: text; }
