:root {
  --bg: #0b1410; --panel: #12201a; --panel2: #182b22; --line: #2a4436;
  --text: #eef5f0; --muted: #8fa89a; --accent: #ffd23f; --accent2: #3ee08f; --nitro: #ffb13b;
  --danger: #ff5a5f; --blue: #58a6ff;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --needsH: 150px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; background: none; border: 0; outline: none; width: 100%; -webkit-user-select: text; user-select: text; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.h { font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .02em; }
.box { background: rgba(8, 14, 11, .88); border: 1px solid #ffffff22; border-radius: 12px; box-shadow: 0 6px 20px #0008; }

/* ------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #hud .needs, #hud .cat, #hud .tray { pointer-events: auto; }
.funds { position: absolute; top: calc(10px + var(--sat)); left: calc(10px + var(--sal)); padding: 5px 11px 7px; min-width: 112px; }
.funds b { display: block; font-size: 21px; font-weight: 900; font-style: italic; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.funds span { display: block; font-size: 10px; font-weight: 900; letter-spacing: .1em; color: var(--accent2); margin-top: 3px; white-space: nowrap; min-height: 12px; }
.funds span.bad { color: #ff8a8d; }
.funds .party { margin-top: 4px; font-size: 9.5px; font-weight: 900; letter-spacing: .08em; color: #ff9ad0; white-space: nowrap; }
.funds .party b { margin-left: 4px; color: var(--accent); letter-spacing: 0; } .funds .party b i { font-style: normal; color: #ffffff30; }
.funds .party small { float: right; color: var(--muted); margin-left: 6px; }
.funds .party .bar { height: 4px; border-radius: 2px; background: #ffffff18; margin-top: 3px; overflow: hidden; }
.funds .party .bar div { height: 100%; background: linear-gradient(90deg, #ff7ab8, var(--accent)); }
.clock { position: absolute; top: calc(10px + var(--sat)); right: calc(58px + var(--sar)); padding: 4px 10px 6px; text-align: center; white-space: nowrap; }
.clock > b { display: block; font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; }
.clock > span { display: block; font-size: 9.5px; font-weight: 800; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.speed { display: flex; gap: 3px; margin-top: 5px; justify-content: center; }
.speed button { width: 30px; height: 24px; border-radius: 6px; background: #ffffff10; display: grid; place-items: center; font-size: 9px; font-weight: 900; letter-spacing: -1px; color: var(--muted); }
.speed button.sel { background: var(--accent); color: #1a1400; }
.speed button.sel[data-sp="0"] { background: var(--danger); color: #fff; }
.menub { position: absolute; top: calc(12px + var(--sat)); right: calc(12px + var(--sar)); width: 38px; height: 38px; border-radius: 10px; border: 1px solid #ffffff2a;
  background: rgba(8, 14, 11, .85); font-weight: 900; display: grid; place-items: center; font-size: 16px; }
.rotb { position: absolute; top: calc(108px + var(--sat)); right: calc(12px + var(--sar)); width: 38px; height: 38px; border-radius: 10px; border: 1px solid #ffffff2a; background: rgba(8, 14, 11, .85); font-size: 20px; font-weight: 900; display: grid; place-items: center; }
.rotb .k { position: absolute; bottom: -7px; font-size: 9px; background: #0b1410; border: 1px solid #ffffff44; border-radius: 4px; padding: 0 4px; display: none; }
.hasKeys .rotb .k { display: block; }
.m-buy .rotb, .m-build .rotb { top: calc(70px + var(--sat)); right: auto; left: calc(106px + var(--sal)); width: 42px; height: 42px; }
.lvl { position: absolute; top: calc(156px + var(--sat)); right: calc(12px + var(--sar)); width: 38px; display: flex; flex-direction: column; align-items: center; border-radius: 10px; padding: 2px 0; }
.lvl button { width: 36px; height: 26px; font-size: 12px; font-weight: 900; color: var(--text); }
.lvl button.off { opacity: .3; }
.lvl b { font-size: 8.5px; font-weight: 900; letter-spacing: .06em; color: var(--accent); }
.m-buy .lvl, .m-build .lvl { top: calc(70px + var(--sat)); right: auto; left: calc(156px + var(--sal)); flex-direction: row; width: auto; height: 42px; padding: 0 2px; }
.m-buy .lvl button, .m-build .lvl button { width: 30px; height: 40px; }
.wishb { position: absolute; top: calc(58px + var(--sat)); right: calc(12px + var(--sar)); width: 38px; padding: 4px 0 5px; display: flex; flex-direction: column; align-items: center; border-radius: 10px; }
.wishb span { color: var(--accent); font-size: 15px; line-height: 1; }
.wishb b { font-size: 9px; font-weight: 900; color: var(--muted); }
.wishb.done span { color: var(--accent2); }
.fam { position: absolute; top: calc(100px + var(--sat)); left: calc(10px + var(--sal)); display: flex; flex-direction: column; gap: 15px; }
.fam .p { position: relative; width: 50px; height: 50px; border-radius: 50%; border: 3px solid #3ee08f; background: #182b22; box-shadow: 0 4px 12px #0008; }
.fam .p canvas { width: 100%; height: 100%; display: block; border-radius: 50%; }
.fam .p.sel { border-color: var(--accent); box-shadow: 0 0 0 3px #ffd23f44, 0 4px 12px #0008; }
.fam .p.mid { border-color: var(--nitro); } .fam .p.low { border-color: var(--danger); } .fam .p.top { border-color: #c69aff; }
.fam .p.sel.mid, .fam .p.sel.low { border-color: var(--accent); }
.fam .nm { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); font-size: 8px; font-weight: 900; background: #0b1410; border: 1px solid #ffffff22; border-radius: 6px; letter-spacing: .06em; padding: 1px 5px; white-space: nowrap; text-transform: uppercase; }
.fam .away { position: absolute; inset: 0; border-radius: 50%; background: #0b1410bb; display: grid; place-items: center; font-size: 8px; font-weight: 900; letter-spacing: .04em; text-align: center; line-height: 1.1; color: var(--muted); }
.queue { position: absolute; top: calc(100px + var(--sat)); left: calc(72px + var(--sal)); right: 60px; display: flex; gap: 5px; align-items: flex-start; flex-wrap: wrap; pointer-events: none; }
.qa { background: rgba(8, 14, 11, .9); border: 1px solid #ffffff22; border-radius: 11px; padding: 5px 9px 6px; font-size: 11px; font-weight: 800; min-width: 120px; box-shadow: 0 6px 16px #0008; text-align: left; }
.qa .r { display: flex; align-items: center; gap: 6px; }
.qa .ic { font-size: 15px; }
.qa small { display: block; font-size: 8.5px; color: var(--muted); letter-spacing: .1em; font-weight: 900; text-transform: uppercase; }
.qa.where { border-color: #8ff7c155; color: #cfeee0; pointer-events: none; }
.qa .bar { height: 4px; border-radius: 2px; background: #ffffff18; margin-top: 5px; overflow: hidden; }
.qa .bar div { height: 100%; background: linear-gradient(90deg, #1fb46d, var(--accent2)); }
.qa.next { min-width: 0; padding: 6px 8px; display: flex; align-items: center; gap: 5px; }
.qa .x { margin-left: 4px; color: #ff8a8d; font-weight: 900; }
.qa.auto { opacity: .7; border-style: dashed; }

/* pie menu */
.pie { position: absolute; width: 0; height: 0; pointer-events: none; }
.pie .hub { position: absolute; left: -31px; top: -31px; width: 62px; height: 62px; border-radius: 50%; background: rgba(8, 14, 11, .92); border: 2px solid var(--accent);
  display: grid; place-items: center; text-align: center; font-size: 8.5px; font-weight: 900; letter-spacing: .05em; color: var(--accent); line-height: 1.15; box-shadow: 0 0 0 6px #ffd23f22, 0 8px 20px #000a; padding: 4px; text-transform: uppercase; pointer-events: auto; }
.pie .it { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; background: rgba(8, 14, 11, .94); border: 1px solid #ffffff2e; border-radius: 999px;
  padding: 7px 12px; font-size: 12.5px; font-weight: 800; box-shadow: 0 6px 16px #000a; display: flex; align-items: center; gap: 6px; animation: pin .16s ease-out backwards; }
.pie .it .ic { font-size: 15px; }
.pie .it:hover, .pie .it.hot { background: var(--accent); color: #1a1400; border-color: var(--accent); }
.pie .it small { color: var(--accent2); font-weight: 900; font-size: 10px; }
.pie .it:hover small, .pie .it.hot small { color: #1a5a2e; }
.pie .it kbd { font: 900 9px system-ui; background: #ffffff18; border-radius: 4px; padding: 1px 4px; color: var(--muted); }
.pie .it.off { opacity: .45; }
.pie .it.off small { color: #ff8a8d; }
@keyframes pin { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } }

/* needs */
.needs { position: absolute; left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); bottom: calc(10px + var(--sab)); padding: 9px 11px 10px; cursor: pointer; }
.needs .top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.needs .top b { font-size: 17px; white-space: nowrap; }
.mood { font-size: 10px; font-weight: 900; letter-spacing: .08em; padding: 3px 8px; border-radius: 999px; background: #3ee08f22; color: var(--accent2); border: 1px solid #3ee08f66; white-space: nowrap; text-transform: uppercase; }
.mood.mid { background: #ffffff10; color: var(--text); border-color: #ffffff33; }
.mood.bad { background: #ff5a5f22; color: #ff8a8d; border-color: #ff5a5f66; }
.mood.top { background: #c69aff22; color: #d9bcff; border-color: #c69aff66; }
.needs .top .dream { margin-left: auto; font-size: 9.5px; font-weight: 800; color: var(--muted); text-align: right; line-height: 1.25; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; }
.needs .top .dream b { display: block; font-size: 11px; color: var(--accent); font-style: italic; letter-spacing: 0; text-transform: none; }
.bars { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 10px; }
.nb span { display: flex; justify-content: space-between; font-size: 9.5px; font-weight: 900; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.nb span em { font-style: normal; font-size: 11px; }
.nb .bar { height: 8px; border-radius: 4px; background: #ffffff14; margin-top: 3px; overflow: hidden; }
.nb .bar div { height: 100%; border-radius: 4px; transition: width .4s; }
.moodlets { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.ml { font-size: 10px; font-weight: 800; border-radius: 7px; padding: 3px 7px; background: #ffffff0c; border: 1px solid #ffffff1a; white-space: nowrap; }
.ml i { font-style: normal; font-weight: 900; margin-left: 4px; } .ml i.up { color: var(--accent2); } .ml i.dn { color: #ff8a8d; }

/* mode buttons, in the NITRO / DRIFT style */
.modes { position: absolute; right: calc(12px + var(--sar)); bottom: calc(var(--needsH) + 22px + var(--sab)); width: 176px; height: 150px; pointer-events: none; }
.tb { position: absolute; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 900; text-align: center;
  border: 2px solid #ffffff55; box-shadow: 0 6px 16px #0008; line-height: 1.05; letter-spacing: .03em; font-size: 9.5px; width: 60px; height: 60px; }
.tb svg { width: 42%; height: 42%; margin-bottom: 2px; }
.tb .k { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); background: #0b1410; color: var(--text); border: 1px solid #ffffff44; border-radius: 5px; font-size: 9px; padding: 0 4px; font-style: normal; display: none; }
.tb.live { background: radial-gradient(circle at 35% 30%, #8ff7c1, #1fb46d); color: #002313; }
.tb.buy { background: radial-gradient(circle at 35% 30%, #a9c8ff, #3a64d8); color: #fff; }
.tb.build { background: radial-gradient(circle at 35% 30%, #ffd08a, #f08a00); color: #2a1600; }
.m-live .tb.live { width: 82px; height: 82px; font-size: 12px; right: 0; bottom: 0; box-shadow: 0 0 0 6px #3ee08f44, 0 0 0 12px #3ee08f1c, 0 6px 16px #0008; }
.m-live .tb.buy { right: 94px; bottom: 2px; }
.m-live .tb.build { right: 12px; bottom: 92px; }
.m-buy .modes, .m-build .modes { width: auto; height: auto; top: calc(110px + var(--sat)); bottom: auto; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.m-buy .tb, .m-build .tb { position: relative; width: 50px; height: 50px; font-size: 8px; }
.m-buy .tb.buy { width: 60px; height: 60px; box-shadow: 0 0 0 5px #58a6ff55, 0 6px 16px #0008; }
.m-build .tb.build { width: 60px; height: 60px; box-shadow: 0 0 0 5px #ffb13b55, 0 6px 16px #0008; }
.m-buy .needs, .m-build .needs, .m-buy .queue, .m-build .queue, .m-buy .fam, .m-build .fam, .m-buy .wishb, .m-build .wishb, .m-buy .clock, .m-build .clock { display: none; }
.hasKeys .tb .k { display: block; }

.toasts { position: absolute; top: calc(160px + var(--sat)); left: calc(72px + var(--sal)); right: calc(10px + var(--sar)); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; pointer-events: none; z-index: 5; }
.m-buy .toasts, .m-build .toasts { right: calc(78px + var(--sar)); }
.toast { background: rgba(8, 14, 11, .95); border: 1px solid #ffffff22; border-left: 4px solid var(--blue); padding: 7px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.35;
  box-shadow: 0 8px 24px #000a; animation: tin .25s ease-out; display: flex; gap: 8px; align-items: center; max-width: 100%; }
.toast.good { border-left-color: var(--accent2); } .toast.bad { border-left-color: var(--danger); }
.toast .ic { font-size: 16px; }
.toast.out { opacity: 0; transition: opacity .4s; }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

/* build / buy */
.modehd { position: absolute; top: calc(10px + var(--sat)); right: calc(58px + var(--sar)); padding: 6px 12px 7px; text-align: center; white-space: nowrap; }
.modehd b { display: block; font-size: 20px; color: var(--nitro); line-height: 1; }
.m-buy .modehd b { color: var(--blue); }
.modehd span { display: block; font-size: 9px; font-weight: 900; letter-spacing: .12em; color: var(--muted); margin-top: 4px; }
.ur { position: absolute; top: calc(70px + var(--sat)); left: calc(10px + var(--sal)); display: flex; gap: 6px; }
.ur button { width: 42px; height: 42px; border-radius: 10px; border: 1px solid #ffffff2a; background: rgba(8, 14, 11, .85); display: grid; place-items: center; font-size: 19px; font-weight: 900; }
.ur button svg { width: 22px; height: 22px; }
.ur button.off { opacity: .4; }
.ur button.on { border-color: var(--accent); color: var(--accent); }
.costtag { position: absolute; transform: translate(-50%, -150%); font-size: 13px; font-weight: 900; font-style: italic; background: var(--accent); color: #1a1400; border-radius: 8px; padding: 3px 9px; white-space: nowrap; box-shadow: 0 4px 12px #0008; }
.costtag.bad { background: var(--danger); color: #fff; }
.tray { position: absolute; left: 0; right: 0; bottom: 0; padding: 9px 10px calc(12px + var(--sab)); background: rgba(10, 18, 14, .96); border-top: 1px solid #ffffff22; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 24px #0009; }
.tray .lbl { font-size: 10px; font-weight: 900; color: var(--muted); letter-spacing: .14em; margin: 0 2px 6px; display: flex; justify-content: space-between; gap: 8px; }
.tray .lbl b { color: var(--accent); letter-spacing: .04em; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw { display: flex; gap: 7px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
.sw::-webkit-scrollbar, .tools::-webkit-scrollbar, .cats::-webkit-scrollbar { display: none; }
.sw button { flex: 0 0 54px; height: 40px; border-radius: 9px; border: 2px solid transparent; position: relative; overflow: hidden; }
.sw button.sel { border-color: var(--accent); box-shadow: 0 0 0 2px #ffd23f44; }
.sw button span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 7.5px; font-weight: 900; text-align: center; background: #0009; padding: 1px 0; letter-spacing: .04em; text-transform: uppercase; color: #fff; }
.sw button canvas { width: 100%; height: 100%; display: block; }
.tools { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
.tool { flex: 0 0 60px; height: 62px; border-radius: 12px; background: var(--panel2); border: 2px solid transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 9px; font-weight: 900; letter-spacing: .04em; color: var(--muted); }
.tool svg { width: 26px; height: 26px; }
.tool.sel { border-color: var(--nitro); background: #3a2a10; color: var(--text); }
.tool.sel svg { color: var(--nitro); }
.cat { position: absolute; left: 0; right: 0; bottom: 0; height: min(46%, 420px); background: rgba(10, 18, 14, .97); border-top: 1px solid #ffffff22; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 24px #0009;
  padding: 4px 10px calc(10px + var(--sab)); display: flex; flex-direction: column; transition: height .2s; }
.cat.min { height: calc(78px + var(--sab)); }
.grab { width: 100%; height: 18px; display: block; flex: 0 0 auto; position: relative; }
.grab::after { content: ''; position: absolute; left: 50%; top: 6px; width: 44px; height: 5px; border-radius: 3px; background: #ffffff33; transform: translateX(-50%); }
.cats { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 9px; flex: 0 0 auto; scrollbar-width: none; touch-action: pan-x; }
.cats button { flex: 0 0 auto; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.cats button.sel { background: var(--blue); border-color: var(--blue); color: #06172e; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 7px; overflow-y: auto; touch-action: pan-y; padding-bottom: 6px; flex: 1; align-content: start; }
.item { min-width: 0; background: var(--panel2); border: 2px solid transparent; border-radius: 12px; padding: 4px 4px 6px; position: relative; text-align: left; }
.item canvas { display: block; width: 100%; height: 70px; }
.item .nm { font-size: 11px; font-weight: 800; margin: 2px 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .pr { font-size: 11px; font-weight: 900; color: var(--accent); margin: 1px 3px 0; font-style: italic; }
.item .st { position: absolute; top: 5px; right: 6px; font-size: 8.5px; font-weight: 900; color: var(--muted); letter-spacing: .04em; }
.item.sel { border-color: var(--blue); background: #14243a; }
.item.lock canvas { opacity: .35; } .item.lock .pr { color: var(--muted); font-style: normal; font-size: 9.5px; }
.item.poor .pr { color: #ff8a8d; }
.place { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.wb { position: absolute; transform: translate(-50%, -50%); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 900; border: 2px solid #ffffff55; box-shadow: 0 6px 16px #000a; pointer-events: auto; }
.wb.ok { background: radial-gradient(circle at 35% 30%, #8ff7c1, #1fb46d); color: #002313; left: 54px; top: 0; }
.wb.ok.off { filter: saturate(.2) brightness(.6); }
.wb.no { background: radial-gradient(circle at 35% 30%, #ffb0b2, #d8343b); color: #fff; left: 0; top: 34px; }
.wb.rot { background: rgba(8, 14, 11, .92); color: var(--text); left: -54px; top: 0; }
.wb.sell { width: 58px; height: 58px; font-size: 10px; font-style: italic; background: radial-gradient(circle at 35% 30%, #ffe066, #f0b400); color: #241900; left: 0; top: -58px; line-height: 1; display: flex; flex-direction: column; justify-content: center; }
.wb.sell small { font-size: 10px; }
.wb .k { position: absolute; bottom: -8px; font-size: 9px; background: #0b1410; border: 1px solid #ffffff44; border-radius: 4px; padding: 0 4px; display: none; }
.hasKeys .wb .k { display: block; }

/* ------------------------------------------------------------ overlays */
.overlay { position: fixed; inset: 0; background: rgba(6, 11, 8, .7); backdrop-filter: blur(3px); display: grid; place-items: center; padding: calc(16px + var(--sat)) 14px calc(16px + var(--sab)); z-index: 10; }
.panel { position: relative; width: min(420px, 100%); max-height: 100%; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 20px 60px #000c; touch-action: pan-y; }
.panel .x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 10px; background: var(--panel2); font-weight: 900; z-index: 2; }
.ptitle { font-size: 26px; color: var(--accent); text-align: center; margin-bottom: 10px; }
.pname { text-align: center; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .1em; margin: -6px 0 12px; text-transform: uppercase; }
.go { display: block; width: 100%; padding: 14px; border-radius: 14px; background: linear-gradient(180deg, #ffe066, #f0b400); color: #241900; font-size: 20px; box-shadow: 0 8px 20px #f0b40044; text-align: center; margin-top: 4px; }
.go.off { filter: saturate(.2) brightness(.6); }
.btn { display: block; width: 100%; padding: 12px; border-radius: 12px; text-align: center; font-size: 15px; margin-top: 8px; }
.btn.ghost { background: var(--panel2); border: 1px solid var(--line); }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 12px; margin-top: 10px; }
.set { background: var(--panel2); border-radius: 10px; padding: 9px 10px; display: flex; justify-content: space-between; gap: 6px; text-align: left; }
.set b { color: var(--accent); white-space: nowrap; }
.how { margin-top: 10px; background: var(--panel2); border-radius: 12px; padding: 9px 11px; }
.how summary { cursor: pointer; margin: 0; }
.how ul { margin: 8px 0 2px 16px; font-size: 12.5px; line-height: 1.45; color: #cfe0d6; }
.how li { margin-bottom: 5px; } .how b { color: var(--accent); }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.hint b { color: var(--accent); }
.lbl { font-size: 11px; font-weight: 900; color: var(--muted); letter-spacing: .14em; margin-bottom: 8px; text-transform: uppercase; display: flex; justify-content: space-between; }
.lbl b { color: var(--accent); letter-spacing: .06em; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }

/* golem sheet */
.sheetp { width: min(460px, 100%); }
.sh-who { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; padding-right: 36px; }
.sh-who canvas { width: 68px; height: 68px; border-radius: 50%; border: 3px solid var(--accent); background: #203a2c; flex: 0 0 68px; }
.sh-who b { font-size: 22px; display: block; }
.sh-who span { font-size: 11px; color: var(--muted); font-weight: 700; }
.tr { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.tr i { font-style: normal; font-size: 9.5px; font-weight: 900; padding: 2px 6px; border-radius: 6px; background: #3ee08f1c; color: var(--accent2); border: 1px solid #3ee08f44; text-transform: uppercase; }
.sec { font-size: 10px; font-weight: 900; color: var(--muted); letter-spacing: .16em; margin: 14px 0 7px; display: flex; justify-content: space-between; text-transform: uppercase; }
.sec b { color: var(--accent); letter-spacing: .04em; }
.sheetp .bars { grid-template-columns: 1fr 1fr; gap: 7px 12px; }
.skill { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 800; margin-bottom: 6px; }
.skill .pips { display: flex; gap: 2px; margin-left: auto; }
.skill .pips i { width: 10px; height: 10px; border-radius: 2px; background: #ffffff14; }
.skill .pips i.on { background: var(--accent); }
.job { background: var(--panel2); border-radius: 11px; padding: 9px 10px; font-size: 12px; }
.job b { display: block; font-size: 14px; }
.job span { color: var(--muted); font-size: 11px; font-weight: 700; display: block; }
.job .bar { height: 6px; border-radius: 3px; background: #ffffff14; margin-top: 6px; overflow: hidden; }
.job .bar div { height: 100%; background: linear-gradient(90deg, #f0b400, var(--accent)); }
.job .acts { display: flex; gap: 6px; margin-top: 8px; }
.job .acts button { flex: 1; padding: 8px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); font-size: 12px; font-weight: 800; }
.job .acts button.pri { background: var(--accent); color: #1a1400; border-color: var(--accent); }
.rel { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.rel canvas { width: 34px; height: 34px; border-radius: 50%; background: #203a2c; border: 2px solid #ffffff22; }
.rel > div { flex: 1; } .rel b { font-size: 12.5px; display: block; } .rel span { font-size: 9.5px; color: var(--muted); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.rel .bar { height: 5px; border-radius: 3px; background: #ffffff14; margin-top: 3px; overflow: hidden; }
.rel .bar i { display: block; height: 100%; background: var(--accent2); }
.wish { display: flex; align-items: center; gap: 9px; background: var(--panel2); border-radius: 11px; padding: 9px 10px; margin-bottom: 6px; }
.wish .ic { width: 34px; height: 34px; border-radius: 9px; background: #ffffff0e; display: grid; place-items: center; font-size: 18px; flex: 0 0 34px; }
.wish b { display: block; font-size: 13px; }
.wish span { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.wish em { margin-left: auto; font-style: italic; font-weight: 900; color: var(--accent); font-size: 13px; white-space: nowrap; }
.wish.done { opacity: .55; } .wish.done b { text-decoration: line-through; } .wish.done em { color: var(--accent2); }
.jobc { display: flex; align-items: center; gap: 10px; width: 100%; background: var(--panel2); border: 2px solid transparent; border-radius: 12px; padding: 10px; margin-bottom: 6px; text-align: left; }
.jobc .ic { font-size: 22px; width: 36px; text-align: center; }
.jobc b { display: block; font-size: 14px; } .jobc span { font-size: 11px; color: var(--muted); font-weight: 700; }
.jobc em { margin-left: auto; font-style: italic; font-weight: 900; color: var(--accent); white-space: nowrap; }
.jobc.cur { border-color: var(--accent); }

/* ------------------------------------------------------------ menu */
.screen { position: fixed; inset: 0; overflow-y: auto; touch-action: pan-y; background: radial-gradient(120% 60% at 50% 0%, #1e4a30 0%, var(--bg) 60%); z-index: 8; }
#menu .wrap { padding: calc(16px + var(--sat)) 16px calc(20px + var(--sab)); max-width: 520px; margin: 0 auto; }
.logo { text-align: center; margin: 8px 0 14px; }
.logo .t1, .logo .t2 { font-size: 44px; line-height: .9; }
.logo .t2 { color: var(--accent); }
.logo .sub { color: var(--muted); font-size: 11px; letter-spacing: .3em; margin-top: 8px; font-weight: 700; font-style: italic; }
.hhs { display: grid; gap: 6px; }
.hhr { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 2px solid transparent; border-radius: 12px; padding: 6px 10px 6px 6px; width: 100%; text-align: left; position: relative; }
.hhr.sel { border-color: var(--accent); background: #2a2a10; }
.hhr .ps { display: flex; flex: 0 0 auto; }
.hhr .ps canvas { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--panel2); background: #203a2c; margin-right: -10px; }
.hhr .ps canvas:last-child { margin-right: 0; }
.hhr .mid { flex: 1; min-width: 0; margin-left: 6px; }
.hhr .nm { font-weight: 900; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hhr .ds { font-size: 10.5px; color: var(--muted); font-weight: 700; margin-top: 1px; }
.hhr .rt { text-align: right; font-size: 12px; font-weight: 900; color: var(--accent); font-style: italic; white-space: nowrap; }
.hhr .rt small { display: block; font-size: 9.5px; color: var(--muted); font-style: normal; letter-spacing: .06em; }
.hhr .del { position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); font-size: 11px; color: #ff8a8d; display: none; }
.hhr.sel .del { display: grid; place-items: center; }
.hhr.add { justify-content: center; border: 2px dashed var(--line); background: transparent; color: var(--muted); font-weight: 900; font-size: 13px; padding: 12px; }
.foot { text-align: center; color: var(--muted); font-size: 11px; margin-top: 10px; }
.lot { display: flex; gap: 12px; align-items: center; width: 100%; background: var(--panel2); border: 2px solid transparent; border-radius: 14px; padding: 8px; margin-bottom: 8px; text-align: left; }
.lot:hover { border-color: var(--accent); }
.lot canvas { width: 120px; height: 80px; border-radius: 9px; background: #13261b; flex: 0 0 120px; }
.lot b { display: block; font-size: 15px; } .lot span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; margin: 2px 0 4px; } .lot em { font-style: italic; font-weight: 900; color: var(--accent); font-size: 13px; }

/* ------------------------------------------------------------ shape a golem */
.caswrap { max-width: 980px; margin: 0 auto; padding: calc(10px + var(--sat)) 12px calc(130px + var(--sab)); }
.caswrap .hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.back { font-size: 13px; font-weight: 800; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; }
.caswrap .ttl { font-size: 19px; color: var(--accent); white-space: nowrap; }
.caswrap .hh { font-size: 9.5px; font-weight: 900; color: var(--muted); letter-spacing: .1em; text-align: right; }
.caswrap .hh b { display: block; color: var(--text); font-size: 13px; letter-spacing: .02em; }
.famrow { display: flex; gap: 8px; margin: 10px 0 2px; overflow-x: auto; padding: 4px 2px; }
.famrow button { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; background: var(--panel2); border: 2px solid transparent; border-radius: 999px; padding: 3px 10px 3px 3px; font-size: 12px; font-weight: 800; }
.famrow button canvas { width: 30px; height: 30px; border-radius: 50%; background: #203a2c; }
.famrow button.sel { border-color: var(--accent); }
.famrow button.add { padding: 8px 12px; color: var(--muted); border-style: dashed; border-color: var(--line); }
.famrow .rm { color: #ff8a8d; margin-left: 2px; }
.cascols { display: block; }
.stage { position: relative; height: min(42vh, 360px); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .rot { position: absolute; top: 44%; width: 42px; height: 42px; border-radius: 50%; background: rgba(8, 14, 11, .8); border: 1px solid #ffffff2a; display: grid; place-items: center; font-size: 20px; font-weight: 900; }
.stage .rot.l { left: 4px; } .stage .rot.r { right: 4px; }
.stage .dice { position: absolute; right: 4px; top: 6px; padding: 6px 10px; border-radius: 10px; background: rgba(8, 14, 11, .8); border: 1px solid #ffffff2a; font-size: 11px; font-weight: 900; letter-spacing: .06em; }
.stage .stg { position: absolute; left: 4px; top: 6px; display: flex; flex-direction: column; gap: 4px; }
.stage .stg button { font-size: 10px; font-weight: 900; letter-spacing: .08em; padding: 5px 9px; border-radius: 8px; background: rgba(8, 14, 11, .8); border: 1px solid #ffffff22; color: var(--muted); text-align: left; }
.stage .stg button.sel { background: var(--accent); color: #1a1400; border-color: var(--accent); }
.namebar { display: flex; gap: 6px; }
.in { flex: 1; display: block; background: var(--panel); border: 2px solid var(--accent); border-radius: 12px; padding: 6px 12px 7px; font-size: 19px; }
.in small { display: block; font-size: 9px; font-weight: 900; letter-spacing: .14em; color: var(--muted); }
.tabs { display: flex; gap: 5px; padding: 10px 0 8px; }
.tabs button { flex: 1; text-align: center; font-size: 11.5px; padding: 9px 2px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); }
.tabs button.sel { background: var(--accent); color: #1a1400; border-color: var(--accent); }
.stones { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.stones button { min-width: 0; text-align: center; font-size: 8.5px; font-weight: 900; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.stones button i { display: block; height: 38px; border-radius: 10px; border: 2px solid transparent; margin-bottom: 4px; box-shadow: inset 0 -6px 0 #0003; }
.stones button.sel { color: var(--text); } .stones button.sel i { border-color: var(--accent); box-shadow: inset 0 -6px 0 #0003, 0 0 0 3px #ffd23f44; }
.dots { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dots + .dots { margin-top: 10px; }
.dots button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #ffffff22; }
.dots button.sel { border-color: #fff; box-shadow: 0 0 0 3px #ffffff33; }
.dots button.glow { box-shadow: 0 0 10px var(--c); }
.dots button.glow.sel { box-shadow: 0 0 10px var(--c), 0 0 0 3px #ffffff55; }
.dots span { font-size: 10px; font-weight: 900; letter-spacing: .12em; color: var(--muted); width: 54px; }
.seg { display: flex; gap: 5px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 56px; padding: 7px 4px; border-radius: 9px; background: var(--panel2); border: 1px solid var(--line); font-size: 11px; font-weight: 800; }
.seg button.sel { background: var(--accent); color: #1a1400; border-color: var(--accent); }
.outfits { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.outfits button { height: 44px; border-radius: 10px; border: 2px solid transparent; position: relative; overflow: hidden; }
.outfits button i { position: absolute; left: 0; right: 0; bottom: 10px; height: 6px; }
.outfits button.sel { border-color: #fff; box-shadow: 0 0 0 3px #ffffff44; }
.traits { display: flex; flex-wrap: wrap; gap: 6px; }
.traits button { font-size: 12px; font-weight: 800; padding: 7px 10px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); }
.traits button.sel { background: #3ee08f22; border-color: var(--accent2); color: var(--accent2); }
.tdesc { font-size: 11.5px; color: var(--muted); margin-top: 8px; min-height: 16px; }
.dreams { display: grid; gap: 6px; }
.dreams button { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 2px solid transparent; border-radius: 11px; padding: 8px 10px; text-align: left; font-weight: 800; font-size: 13px; }
.dreams button span { font-size: 18px; }
.dreams button small { margin-left: auto; color: var(--muted); font-size: 10.5px; font-weight: 700; }
.dreams button.sel { border-color: var(--accent); background: #2a2a10; }
.casfoot { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(12px + var(--sab)); background: linear-gradient(180deg, transparent, var(--bg) 30%); display: flex; gap: 8px; align-items: stretch; max-width: 980px; margin: 0 auto; }
.casfoot .hhname { flex: 1; font-size: 16px; }
.casfoot .go { width: auto; flex: 1; margin: 0; font-size: 18px; padding: 10px; }

/* ------------------------------------------------------------ bigger screens */
@media (min-width: 760px) {
  .clock { right: auto; left: 50%; transform: translateX(-50%); }
  .modehd { right: auto; left: 50%; transform: translateX(-50%); }
  .needs { right: auto; width: 380px; }
  .modes { bottom: calc(18px + var(--sab)); }
  .toasts { top: calc(100px + var(--sat)); left: 50%; right: auto; transform: translateX(-50%); width: min(92vw, 440px); align-items: center; }
  .cascols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
  .stage { height: 460px; }
  .tray { left: 50%; right: auto; width: min(820px, 96vw); transform: translateX(-50%); }
  .cat { left: auto; right: 0; top: 0; bottom: 0; height: auto; width: 380px; border-radius: 18px 0 0 18px; padding-top: calc(10px + var(--sat)); }
  .cat.min { height: auto; }
  .cat .grab { display: none; }
  .m-buy .modes { right: 396px; }
  .m-buy .modehd { left: calc(50% - 190px); }
  .m-buy .menub { right: 392px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .fam { top: calc(8px + var(--sat)); left: auto; right: calc(58px + var(--sar)); flex-direction: row; gap: 8px; }
  .fam .p { width: 40px; height: 40px; }
  .fam .nm { display: none; }
  .clock { right: auto; left: 50%; transform: translateX(-50%); top: calc(6px + var(--sat)); }
  .queue { top: calc(66px + var(--sat)); left: calc(10px + var(--sal)); }
  .needs { right: auto; width: 290px; padding: 7px 9px 8px; bottom: calc(6px + var(--sab)); }
  .needs .moodlets { display: none; }
  .needs .top { margin-bottom: 4px; } .needs .top b { font-size: 14px; }
  .bars { gap: 4px 8px; }
  .modes { transform: scale(.78); transform-origin: right bottom; bottom: calc(6px + var(--sab)); right: calc(8px + var(--sar)); }
  .m-buy .modes, .m-build .modes { transform: scale(.85); transform-origin: right top; top: calc(60px + var(--sat)); }
  .wishb { top: calc(8px + var(--sat)); right: auto; left: calc(140px + var(--sal)); }
  .rotb { top: calc(58px + var(--sat)); }
  .lvl { top: calc(104px + var(--sat)); }
  .toasts { top: calc(62px + var(--sat)); left: auto; right: calc(60px + var(--sar)); transform: none; width: min(46vw, 380px); align-items: flex-end; }
  .tray { left: 50%; right: auto; width: min(700px, 92vw); transform: translateX(-50%); padding-top: 6px; }
  .tray .sw { margin-bottom: 6px; } .sw button { height: 32px; } .tool { height: 52px; }
  .cat { left: auto; right: 0; top: 0; bottom: 0; height: auto; width: 330px; border-radius: 18px 0 0 18px; }
  .cat.min { height: auto; width: 0; padding: 0; border: 0; }
  .cat .grab { display: none; }
  .m-buy .modes { right: 342px; }
  .m-buy .modehd { right: 392px; }
  .m-buy .menub { right: 340px; }
  .stage { height: 62vh; }
  .cascols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
}

/* gamepad cursor */
#padcur { position: fixed; z-index: 50; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 3px solid var(--accent); box-shadow: 0 0 0 2px #0009, 0 0 12px #ffd23f88; pointer-events: none; }
#padcur::after { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: var(--accent); }

/* districts + town map */
.dists { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dists button { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 11px; background: var(--panel2); border: 2px solid transparent; font-size: 12.5px; font-weight: 800; text-align: left; }
.dists button span { font-size: 18px; }
.dists button.sel { border-color: var(--accent); background: #2a2a10; }
.town { display: block; width: 100%; height: 200px; border-radius: 10px; background: #0f1d16; cursor: pointer; }

/* Studio credit and link back to the games page, the same on every Game Golem Studios title screen */
.ggs-foot { text-align: center; font-size: 11px; margin-top: 12px; }
.ggs-foot a { color: var(--muted); text-underline-offset: 2px; }

/* online */
#online .nm { font-size: 16px; margin-bottom: 8px; }
.ontabs { margin-bottom: 8px; }
.joinrow { display: flex; gap: 6px; align-items: stretch; margin-top: 6px; }
.joinrow .in { font-size: 18px; border-width: 1px; border-color: var(--line); }
.joinrow .in input { text-transform: uppercase; letter-spacing: .2em; }
#townp .joinrow .in input { text-transform: none; letter-spacing: 0; font-size: 14px; }
.btn.pri { background: var(--accent); color: #1a1400; width: auto; margin: 0; padding: 10px 16px; }
#on-host { margin-top: 6px; }
.srvs { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; }
.srv { display: flex; align-items: center; gap: 10px; width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px; text-align: left; }
.srv b { display: block; font-size: 13.5px; } .srv span { font-size: 11px; color: var(--muted); font-weight: 700; }
.srv em { margin-left: auto; font-style: italic; font-weight: 900; color: var(--accent); white-space: nowrap; }
.townb { position: absolute; top: calc(232px + var(--sat)); right: calc(12px + var(--sar)); width: 38px; padding: 4px 0 5px; display: flex; flex-direction: column; align-items: center; border-radius: 10px; border-color: #ff9ad088; }
.townb span { font-size: 15px; line-height: 1; } .townb b { font-size: 8.5px; font-weight: 900; color: #ffb0dc; letter-spacing: .06em; } .townb i { font-style: normal; font-size: 9px; font-weight: 900; color: var(--muted); }
.m-buy .townb, .m-build .townb { display: none; }
.lotr { display: flex; align-items: center; gap: 8px; background: var(--panel2); border-radius: 11px; padding: 7px 8px 7px 10px; margin-bottom: 5px; }
.lotr.me { border: 1px solid var(--accent); }
.lotr .ic { font-size: 18px; width: 24px; text-align: center; }
.lotr b { display: block; font-size: 13px; } .lotr span { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.lotr .acts { margin-left: auto; display: flex; gap: 5px; }
.lotr .acts button { padding: 6px 9px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 11.5px; font-weight: 800; }
.lotr .acts button.pri { background: var(--accent); color: #1a1400; border-color: var(--accent); }
.chatlog { max-height: 150px; overflow-y: auto; background: var(--panel2); border-radius: 10px; padding: 7px 9px; font-size: 12.5px; line-height: 1.45; min-height: 40px; color: #cfe0d6; -webkit-user-select: text; user-select: text; }
.chatlog b { color: #ffb0dc; } .chatlog i { color: var(--muted); font-style: normal; }
@media (max-height: 520px) and (orientation: landscape) { .townb { top: calc(8px + var(--sat)); right: auto; left: calc(186px + var(--sal)); } }
