/* Işık Bekçisi — "night atlas" interface.
   Chrome is cool and thin (hairlines, serif small caps); warm colour is reserved for light itself:
   the wick, sparks, and the one action that matters on a screen. No pills, no drop ledges, no emoji. */

:root {
  --ink-0: #060914;
  --ink-1: #0b1022;
  --ink-2: #131a36;
  --line: rgba(205, 214, 240, .26);
  --line-2: rgba(205, 214, 240, .5);
  --text: #e8ecf8;
  --dim: #9aa5c6;
  --ember: #ff9f4d;
  --ember-hi: #ffd08a;
  --spark: #ffd98a;
  --dust: #9fd8ff;
  --danger: #ff6b5e;
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", "Iowan Old Style", "Noto Serif", Georgia, serif;
  --notch: 9px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--ink-0); color: var(--text);
  font-family: var(--serif); font-size: 16px; font-variant-numeric: lining-nums tabular-nums;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}

#game, #sky { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#game { cursor: crosshair; }
#sky { cursor: default; }
.hidden { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; padding: 0; }

/* ---------- primitives ---------- */
.ico { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.14em; }
.ico.fill { fill: currentColor; stroke: none; }

.cap { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--dim); }
.note { font-size: 14px; color: var(--dim); font-style: italic; }
.speech { font-style: italic; color: var(--text); line-height: 1.45; }

/* a framed plate: hairline, a gap, a second hairline */
.plate {
  position: relative;
  background: linear-gradient(180deg, rgba(19, 26, 54, .96), rgba(9, 13, 29, .97));
  border: 1px solid var(--line-2);
  box-shadow: 0 0 0 4px rgba(6, 9, 20, .9), 0 0 0 5px var(--line), 0 24px 70px rgba(0, 0, 0, .6);
}
.plate::before, .plate::after {
  content: ''; position: absolute; left: 50%; width: 9px; height: 9px;
  background: var(--ink-1); border: 1px solid var(--line-2); transform: translateX(-50%) rotate(45deg);
}
.plate::before { top: -5.5px; }
.plate::after { bottom: -5.5px; }

/* buttons: a notched frame, spaced capitals, no ledge */
.btn {
  position: relative; isolation: isolate;
  padding: 10px 22px; min-height: 40px;
  font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--text);
  background: var(--line-2);
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch));
  transition: color .15s, background .15s;
}
.btn::before {
  content: ''; position: absolute; inset: 1px; z-index: -1; background: var(--ink-1);
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch));
  transition: background .15s;
}
.btn:hover { background: var(--text); }
.btn:hover::before { background: var(--ink-2); }
.btn:active::before { background: #1d2750; }
.btn.primary { color: var(--ember-hi); background: var(--ember); }
.btn.primary::before { background: linear-gradient(180deg, #2a1d16, #17110f); }
.btn.primary:hover { color: #fff3dc; background: var(--ember-hi); }
.btn.primary:hover::before { background: linear-gradient(180deg, #3d2714, #20150f); }
.btn.large { font-size: 15px; padding: 14px 36px; min-height: 50px; }
.btn.small { font-size: 11px; padding: 6px 14px; min-height: 30px; --notch: 6px; }
.btn.danger { color: var(--danger); background: rgba(255, 107, 94, .6); }
.btn:disabled { color: #5d6686; background: var(--line); cursor: default; }
.btn:disabled:hover::before { background: var(--ink-1); }

.iconbtn {
  width: 40px; height: 40px; display: grid; place-items: center; font-size: 20px; color: var(--dim);
  border: 1px solid var(--line); background: rgba(9, 13, 29, .55);
}
.iconbtn:hover { color: var(--text); border-color: var(--line-2); }

/* currencies */
.cur { display: inline-flex; align-items: center; gap: 7px; }
.cur i { display: inline-flex; font-size: .78em; }
.cur b { font-weight: 400; }
.cur.spark { color: var(--spark); }
.cur.spark i { filter: drop-shadow(0 0 6px rgba(255, 200, 100, .8)); }
.cur.dust { color: var(--dust); }
.cur.dust i { filter: drop-shadow(0 0 6px rgba(140, 210, 255, .8)); }

/* ---------- shared pieces ---------- */
#purse {
  position: fixed; top: 16px; left: 18px; z-index: 2; pointer-events: none;
  display: flex; gap: 22px; font-size: 26px; text-shadow: 0 2px 10px #000;
}

#hint {
  position: fixed; left: 50%; bottom: 13%; transform: translateX(-50%); z-index: 2; pointer-events: none;
  max-width: min(90vw, 560px); padding: 10px 26px; text-align: center; font-style: italic; font-size: 16px; line-height: 1.4;
  color: var(--text); text-shadow: 0 2px 8px #000;
  background: linear-gradient(90deg, transparent, rgba(6, 9, 20, .82) 12%, rgba(6, 9, 20, .82) 88%, transparent);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  animation: rise .4s;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

#toasts { position: fixed; top: 74px; left: 18px; z-index: 3; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 7px 14px 7px 10px; font-size: 14px;
  background: rgba(9, 13, 29, .86); border-left: 2px solid var(--ember); color: var(--text);
  animation: toastIn .3s, toastOut .5s 3.4s forwards;
}
.toast i { display: inline-flex; color: var(--ember-hi); font-size: 17px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-14px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-8px); } }

/* ---------- run HUD ---------- */
#hud, #campHud, #skyHud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #campHud button, #skyHud button { pointer-events: auto; }

#gain { position: absolute; top: 16px; left: 18px; font-size: 28px; text-shadow: 0 2px 10px #000; display: flex; flex-direction: column; gap: 2px; }
#gain .dust { font-size: 17px; }
#gain.bump .spark b { animation: bump .2s; display: inline-block; }
@keyframes bump { 40% { transform: scale(1.14); color: #fff; } }

#tracker { position: absolute; top: 88px; left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--dim); text-shadow: 0 1px 6px #000; }
#tracker .tq { display: flex; align-items: center; gap: 7px; }
#tracker .tq i { display: inline-flex; font-size: 15px; }
#tracker .tq.done { color: var(--ember-hi); }

/* the oil gauge is a wick: a thin line burning down towards the left, with an ember at its end */
#wickBox { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); width: min(430px, 44vw); text-align: center; }
#wick { position: relative; height: 16px; }
#wick .track { position: absolute; left: 0; right: 0; top: 7px; height: 2px; background: rgba(205, 214, 240, .18); }
#wick .fill { position: absolute; left: 0; top: 6px; height: 4px; width: 100%; background: linear-gradient(90deg, #a8703a, #ffd08a); box-shadow: 0 0 10px rgba(255, 170, 80, .5); }
#wick .free { position: absolute; left: 0; top: 4px; height: 8px; width: 0; border: 1px solid rgba(159, 216, 255, .7); border-left: none; border-right: none; }
#wick .ember {
  position: absolute; top: 2px; left: 100%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%;
  background: radial-gradient(#fff6dc 0 28%, #ffb04a 46%, rgba(255, 120, 40, 0) 72%);
  box-shadow: 0 0 14px 4px rgba(255, 150, 60, .75);
  animation: flicker .13s infinite alternate;
}
@keyframes flicker { to { transform: scale(1.18); opacity: .86; } }
#oilTxt { margin-top: 3px; font-size: 14px; color: var(--ember-hi); text-shadow: 0 2px 6px #000; }
#wickBox.low #wick .fill { background: linear-gradient(90deg, #8a2f24, #ff6b5e); box-shadow: 0 0 12px rgba(255, 80, 60, .7); }
#wickBox.low #wick .ember { background: radial-gradient(#fff 0 26%, #ff5a48 46%, rgba(255, 60, 40, 0) 72%); box-shadow: 0 0 18px 6px rgba(255, 70, 50, .85); animation-duration: .07s; }
#wickBox.low #oilTxt { color: var(--danger); }
#wickBox.glow #wick .fill { background: #fff; box-shadow: 0 0 16px #fff; }
/* burning faster than normal (a focused lantern, a thorn drinking): the end of the wick flares, a hot stretch
   runs ahead of the ember and the rate stands above it */
#wick .burn {
  position: absolute; top: 5px; left: 100%; height: 6px; width: 0; transform: translateX(-100%); opacity: 0;
  background: linear-gradient(90deg, rgba(255, 150, 60, 0), rgba(255, 200, 120, .75) 55%, #fff4da);
  box-shadow: 0 0 12px rgba(255, 170, 80, .8); transition: opacity .2s;
  animation: burnRun .32s linear infinite;
}
@keyframes burnRun { 50% { filter: brightness(1.45); } }
#wick .ember { transition: width .15s, height .15s, margin .15s, top .15s; animation-duration: var(--flick, .13s); }
#wickBox.fast #wick .burn { opacity: 1; }
#wickBox.fast #wick .ember {
  top: -2px; width: 20px; height: 20px; margin-left: -10px;
  background: radial-gradient(#fff 0 24%, #ffd08a 40%, #ff8a3a 58%, rgba(255, 110, 40, 0) 74%);
  box-shadow: 0 0 22px 8px rgba(255, 160, 70, .85);
}
#wickBox.fast #wick .fill { background: linear-gradient(90deg, #a8703a, #ffd08a 85%, #fff4da); }
#burnTag {
  position: absolute; bottom: 17px; left: 100%; transform: translate(-50%, 4px); opacity: 0; white-space: nowrap;
  font-size: 12px; letter-spacing: .14em; color: var(--ember-hi); text-shadow: 0 0 10px rgba(255, 160, 70, .9), 0 1px 4px #000;
  transition: opacity .2s, transform .2s; pointer-events: none;
}
#wickBox.fast #burnTag { opacity: 1; transform: translate(-50%, 0); }
/* a night thorn drinking: the same, in the thorn's violet */
#wickBox.drain #wick .burn { background: linear-gradient(90deg, rgba(150, 90, 230, 0), rgba(190, 140, 255, .75) 55%, #f0e4ff); box-shadow: 0 0 12px rgba(170, 110, 255, .8); }
#wickBox.drain #burnTag { color: #d9b8ff; text-shadow: 0 0 10px rgba(170, 110, 255, .9), 0 1px 4px #000; }
#wickBox.low.fast #wick .ember { background: radial-gradient(#fff 0 24%, #ff8a70 42%, #ff5a48 58%, rgba(255, 60, 40, 0) 74%); box-shadow: 0 0 24px 9px rgba(255, 70, 50, .85); }
#brewTag { margin-top: 2px; font-size: 12px; letter-spacing: .12em; color: #a8f0c4; display: inline-flex; align-items: center; gap: 6px; text-shadow: 0 1px 6px #000; }
#brewTag i { display: inline-flex; font-size: 14px; }

#zoneName { position: absolute; top: 20px; right: 72px; text-align: right; text-shadow: 0 1px 6px #000; color: var(--text); }
#btnPause { position: absolute; top: 14px; right: 16px; }

/* how far the next beacon is: a ruler up the right edge, from this zone's start to its beacon */
#ruler { position: absolute; right: 35px; top: 26%; height: 40%; width: 1px; background: var(--line-2); }
#ruler .goal { position: absolute; left: -5.5px; top: -6px; width: 11px; height: 11px; transform: rotate(45deg); border: 1px solid var(--line-2); background: var(--ink-1); }
#ruler .goal.lit { background: var(--ember-hi); border-color: #fff3dc; box-shadow: 0 0 12px rgba(255, 190, 90, .9); }
#ruler .mark { position: absolute; left: -4px; bottom: 0; width: 9px; height: 9px; margin-bottom: -4.5px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 10px 2px rgba(255, 150, 60, .8); }
#rulerLbl { position: absolute; right: 16px; bottom: 0; transform: translateY(50%); white-space: nowrap; font-size: 13px; color: var(--text); text-shadow: 0 1px 6px #000; }

#prog { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); width: min(300px, 56vw); text-align: center; }
#progLabel { color: var(--dust); margin-bottom: 5px; text-shadow: 0 1px 6px #000; }
#prog .bar { height: 3px; background: rgba(205, 214, 240, .2); }
#progFill { display: block; height: 100%; width: 0; background: var(--dust); box-shadow: 0 0 10px rgba(140, 210, 255, .8); }
#prog.boss #progLabel { color: #c9a8ff; }
#prog.boss .bar { height: 5px; }
#prog.ready #progLabel { color: var(--ember-hi); }
#prog.boss #progFill { background: #b488ff; box-shadow: 0 0 12px rgba(170, 110, 255, .9); }

#combo { position: absolute; left: 50%; bottom: 20%; transform: translateX(-50%); text-align: center; text-shadow: 0 3px 12px #000; }
#comboN { display: block; font-size: 40px; font-weight: 400; color: var(--spark); line-height: 1; }
#combo.pop #comboN { animation: bump .16s; }

/* the keeper's skills, shown with their keys (they are not buttons): focus (lit while held), flare and dash
   (with a cooldown ring) */
#skills { position: absolute; right: 24px; bottom: 28px; display: flex; gap: 18px; align-items: flex-end; }
.skill {
  position: relative; width: 66px; height: 66px; border-radius: 50%;
  display: grid; place-items: center; font-size: 28px; color: var(--dim);
  background: rgba(9, 13, 29, .7); border: 1px solid var(--line);
}
.skill kbd {
  position: absolute; left: 50%; top: -19px; transform: translateX(-50%); white-space: nowrap;
  font: 10px var(--serif); letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
}
.skill span { display: inline-flex; }
#btnBeam { width: 78px; height: 78px; font-size: 34px; }
#btnBeam.on { color: var(--ember-hi); border-color: var(--ember); box-shadow: 0 0 26px rgba(255, 160, 70, .55); background: rgba(60, 34, 12, .75); }
#btnFlare::before, #btnDash::before {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  background: conic-gradient(var(--ember) var(--cd, 100%), rgba(205, 214, 240, .16) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
}
#btnFlare.ready, #btnDash.ready { color: var(--ember-hi); border-color: var(--ember); box-shadow: 0 0 24px rgba(255, 160, 70, .45); }

#zoneTitle { position: absolute; top: 23%; left: 0; right: 0; text-align: center; animation: zt 3.8s forwards; }
#zoneTitle h2 { margin: 0; font-weight: 400; font-size: clamp(28px, 5.4vw, 52px); letter-spacing: .34em; text-indent: .34em; text-transform: uppercase; text-shadow: 0 4px 26px #000; }
#zoneTitle h2::after { content: ''; display: block; width: 120px; height: 1px; margin: 12px auto 0; background: linear-gradient(90deg, transparent, var(--line-2), transparent); }
#zoneTitle p { margin: 10px 0 0; font-style: italic; color: var(--dim); text-shadow: 0 2px 10px #000; }
@keyframes zt { 0% { opacity: 0; letter-spacing: .5em; } 14%, 76% { opacity: 1; } 100% { opacity: 0; } }

#banner { position: absolute; top: 33%; left: 0; right: 0; text-align: center; animation: zt 4.2s forwards; }
#banner h3 { margin: 0; font-weight: 400; font-size: clamp(26px, 5vw, 44px); letter-spacing: .2em; text-transform: uppercase; color: var(--ember-hi); text-shadow: 0 0 34px rgba(255, 170, 70, .8), 0 4px 16px #000; }
#banner p { margin: 10px 0 0; font-style: italic; text-shadow: 0 2px 10px #000; }

/* ---------- camp ---------- */
#btnSettings { position: absolute; top: 14px; right: 16px; }

/* A conversation: a plate at the foot of the screen, over the camp. The portrait, the name in warm spaced capitals
   (a voice is a light here), the line typing itself, and under a hairline the line's place in the conversation
   and how to go on. The part of the line still to come is laid out but hidden, so the words never jump. */
#talk { position: fixed; left: 0; right: 0; bottom: 28px; z-index: 3; display: flex; justify-content: center; padding: 0 22px; pointer-events: none; }
#talkBox { pointer-events: auto; cursor: pointer; width: min(100%, 800px); display: flex; align-items: flex-start; gap: 20px; padding: 20px 26px 14px 20px; animation: plateIn .25s; }
#tPortrait {
  width: 84px; height: 84px; flex: none; border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 70%, #26315e, #0c1124 72%);
  box-shadow: 0 0 0 3px rgba(6, 9, 20, .9), 0 0 0 4px rgba(205, 214, 240, .14);
}
#tPortrait.swap { animation: speakerIn .3s; }
@keyframes speakerIn { from { opacity: .15; transform: translateY(4px); } }
.tMain { flex: 1; min-width: 0; }
.tWho { display: flex; align-items: baseline; gap: 14px; }
#tName { font-size: 14px; letter-spacing: .28em; text-transform: uppercase; color: var(--ember-hi); }
/* Two lines hold the longest line at desktop sizes. Balanced, so no lone word is left on the second; "pretty"
   would do it more lightly, but Chrome skips it for a line split into the two spans the typing needs. */
#tLine { margin: 8px 0 0; min-height: 3em; font-size: 18px; line-height: 1.5; color: var(--text); text-wrap: balance; }
#tRest { visibility: hidden; }
.tFoot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
#tPips { display: flex; gap: 9px; padding-left: 3px; }
#tPips i { width: 6px; height: 6px; transform: rotate(45deg); border: 1px solid var(--line-2); }
#tPips i.on { background: var(--dim); border-color: var(--dim); }
#tPips i.now { background: var(--ember-hi); border-color: var(--ember-hi); box-shadow: 0 0 6px rgba(255, 190, 100, .8); }
.tKeys { display: flex; align-items: center; gap: 24px; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
.tKeys kbd {
  display: inline-block; min-width: 20px; margin-right: 9px; padding: 2px 5px 1px; border: 1px solid var(--line-2);
  font: 11px var(--serif); letter-spacing: .04em; text-align: center; text-transform: none; color: var(--text);
}
#tNext { display: inline-flex; align-items: center; color: var(--ember-hi); transition: opacity .2s; }
#tNext kbd { border-color: rgba(255, 159, 77, .75); }
#tNext i { display: inline-flex; font-size: 15px; margin-left: 5px; }
#tNext.wait { opacity: .3; }
#tNext:not(.wait) i { animation: nudge 1.1s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(3px); } }
/* a hint would sit right over the plate */
#talk:not(.hidden) ~ #hint { visibility: hidden; }

/* ---------- telescope ---------- */
#skyBack { position: absolute; top: 14px; right: 16px; display: inline-flex; align-items: center; gap: 8px; padding-left: 14px; }
#skyBack i { display: inline-flex; font-size: 16px; }

/* at the telescope a hint sits in the lower left corner: the stars fill the middle of the screen */
#skyHud:not(.hidden) ~ #hint {
  left: 18px; bottom: 20px; transform: none; max-width: min(34vw, 420px); padding: 10px 40px 10px 16px; text-align: left;
  background: linear-gradient(90deg, rgba(6, 9, 20, .86) 70%, transparent); border-top: none; border-bottom: none;
  border-left: 2px solid var(--line-2); animation: riseLeft .4s;
}
@keyframes riseLeft { from { opacity: 0; transform: translateY(8px); } }

/* what the purse just paid drops away under it */
#purse .cur { position: relative; }
#purse .delta {
  position: absolute; left: 1.15em; top: 100%; font-size: 15px; white-space: nowrap; color: inherit; opacity: 0;
  animation: spend 1.2s ease-out;
}
@keyframes spend { 0% { opacity: 0; transform: translateY(-6px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* The details box beside the hovered star. --c is the star's branch colour; s-locked / s-short / s-owned /
   s-ready / s-done follow the star's state, the same five looks as on the canvas. */
#pop { --c: #cdd6f0; position: absolute; left: 0; top: 0; width: 300px; padding: 16px 18px 15px; pointer-events: none; animation: popIn .14s; }
@keyframes popIn { from { opacity: 0; } }
.popHead { display: flex; align-items: center; gap: 13px; }
#popIcon {
  flex: none; width: 46px; height: 46px; display: grid; place-items: center; font-size: 25px; border-radius: 50%;
  color: var(--c); border: 1px solid var(--c);
  background: radial-gradient(circle at 45% 38%, rgba(255, 255, 255, .09), rgba(10, 14, 34, .9) 70%);
  box-shadow: 0 0 0 3px rgba(6, 9, 20, .9), 0 0 0 4px rgba(205, 214, 240, .14), 0 0 22px -6px var(--c);
}
#popIcon svg { display: block; }
.popWho { min-width: 0; }
#popName { font-size: 19px; letter-spacing: .03em; line-height: 1.2; }
#popSub { margin-top: 4px; font-size: 10.5px; letter-spacing: .2em; line-height: 1.5; white-space: pre-wrap; }
#popPips { display: flex; gap: 7px; margin: 13px 0 0 3px; }
#popPips i { width: 8px; height: 8px; transform: rotate(45deg); border: 1px solid var(--line-2); }
#popPips i.on { background: var(--c); border-color: var(--c); box-shadow: 0 0 7px var(--c); }
#popPips i.next { border-color: var(--ember-hi); animation: pipNext 1.6s ease-in-out infinite; }
@keyframes pipNext { 50% { background: rgba(255, 190, 100, .55); box-shadow: 0 0 9px rgba(255, 180, 80, .9); } }
#popDesc { margin: 12px 0 9px; font-size: 14.5px; line-height: 1.45; color: var(--text); }
#popStat { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; font-size: 13.5px; color: var(--dim); min-height: 18px; }
#popStat:empty { display: none; }
#popStat b { color: var(--text); font-weight: 400; font-size: 15px; }
#popStat .to { color: var(--dim); }
#popStat em { color: var(--ember-hi); font-style: normal; font-size: 15px; }
.s-done #popStat b { color: var(--c); }

/* cost | what the purse holds, and a bar between them */
#popCost { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; row-gap: 3px; }
#popCost .cap { font-size: 10px; letter-spacing: .2em; }
#popPurseL, #popPurseV { text-align: right; }
#popCostV, #popPurseV { font-size: 18px; }
#popPurseV .cur { opacity: .85; }
#popPurseV .cur.short { color: #7b84a2; }
#popPurseV .cur.short i { filter: none; }
#popBar { grid-column: 1 / -1; height: 3px; margin-top: 7px; background: rgba(205, 214, 240, .13); }
#popBarFill { display: block; height: 100%; width: 0; background: #cdd6f0; opacity: .7; }
.s-ready #popBarFill { background: linear-gradient(90deg, var(--ember), var(--ember-hi)); opacity: 1; box-shadow: 0 0 8px rgba(255, 170, 80, .7); }
.s-locked #popCost { opacity: .6; }

/* the one line that says what can be done */
#popFoot { display: flex; align-items: center; gap: 9px; margin-top: 13px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
#popFoot i { display: inline-flex; font-size: 15px; flex: none; }
.s-short #popFoot i, .s-owned #popFoot i { opacity: .7; }
.s-done #popFoot { color: var(--c); }
.s-locked #popFoot { text-transform: none; letter-spacing: .02em; font-size: 14px; font-style: italic; color: var(--text); }
.s-locked #popFoot i { font-size: 17px; }
/* can be lit: the primary action's notched warm frame (a label here: the click goes to the star) */
.s-ready #popFoot {
  position: relative; isolation: isolate; justify-content: space-between; padding: 9px 14px; min-height: 36px;
  color: var(--ember-hi); background: var(--ember); --notch: 7px;
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch));
  animation: footReady 2s ease-in-out infinite;
}
.s-ready #popFoot::before {
  content: ''; position: absolute; inset: 1px; z-index: -1; background: linear-gradient(180deg, #2c1e15, #16100e);
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch));
}
.s-ready #popFoot b { font-weight: 400; color: #fff3dc; }
.s-ready #popFoot span { font-size: 10.5px; letter-spacing: .2em; }
@keyframes footReady { 50% { background: var(--ember-hi); } }
.s-ready.plate::before { background: var(--ember); border-color: var(--ember-hi); box-shadow: 0 0 8px rgba(255, 170, 80, .8); }
.s-done.plate::before { background: var(--c); border-color: var(--c); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 22px; z-index: 5; }
.overlay.dim { background: rgba(4, 6, 14, .66); }
#title { background: radial-gradient(ellipse at 50% 78%, rgba(6, 9, 20, 0) 0, rgba(6, 9, 20, .92) 74%); place-items: start center; padding-top: 9vh; }
#ending { background: radial-gradient(ellipse at 50% 74%, rgba(255, 196, 130, .42), rgba(48, 26, 44, .88)); place-items: start center; padding-top: 12vh; }

.tbox { text-align: center; max-width: 780px; }
.tbox .mark { font-size: 44px; color: var(--ember-hi); filter: drop-shadow(0 0 18px rgba(255, 170, 70, .8)); }
.tbox .mark i { display: inline-flex; }
.tbox h1 { margin: 6px 0 0; font-weight: 400; font-size: clamp(27px, 5.6vw, 60px); letter-spacing: .3em; text-indent: .3em; text-transform: uppercase; text-shadow: 0 4px 30px #000; }
.rule { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 14px; }
.rule span { width: min(26vw, 150px); height: 1px; background: linear-gradient(90deg, transparent, var(--line-2)); }
.rule span:last-child { background: linear-gradient(90deg, var(--line-2), transparent); }
.rule i { width: 7px; height: 7px; transform: rotate(45deg); background: var(--ember); box-shadow: 0 0 10px var(--ember); }
.tbox p { margin: 0 0 30px; font-size: 18px; font-style: italic; line-height: 1.5; text-shadow: 0 2px 12px #000; }
.tbox .note { margin: 22px 0 16px; font-size: 13px; }
/* on a device without a mouse, in place of the play button: where the game is played */
#tDesk { max-width: min(86vw, 400px); margin: 4px auto 28px; padding: 18px 26px 17px; }
#tDesk p { margin: 9px 0 0; font-size: 16px; }

.sbox { width: min(92vw, 400px); padding: 28px 28px 26px; text-align: center; animation: plateIn .3s; }
@keyframes plateIn { from { opacity: 0; transform: translateY(12px); } }
.sbox h2, .pbox h2 { margin: 0 0 18px; font-weight: 400; font-size: 21px; letter-spacing: .24em; text-indent: .24em; text-transform: uppercase; }
.sbox p { margin: 0 0 20px; line-height: 1.45; font-style: italic; color: var(--dim); }
.sbox .btn.large { width: 100%; margin-top: 22px; }
.sbox .btn:not(.large):not(.small) { width: 100%; margin-top: 12px; }
#sRows .srow { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; font-size: 16px; color: var(--dim); }
#sRows .srow .dots { flex: 1; border-bottom: 1px dotted rgba(205, 214, 240, .28); transform: translateY(-4px); }
#sRows .srow b { font-weight: 400; font-size: 19px; color: var(--text); }
#sRows .srow.gold b { color: var(--spark); font-size: 26px; }
#sRows .srow.blue b { color: var(--dust); }
#sRows .rec { margin-left: 8px; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--ember-hi); }
.setRow { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; font-size: 16px; color: var(--dim); }
.btnRow { display: flex; gap: 14px; }
.btnRow > * { flex: 1; margin-top: 0 !important; }

/* a resident's panel */
.pbox { width: min(94vw, 480px); max-height: 90vh; display: flex; flex-direction: column; padding: 22px 24px 24px; animation: plateIn .25s; }
#pBody { overflow-y: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.pbox header { display: flex; align-items: center; gap: 14px; }
#pPortrait { width: 64px; height: 64px; flex: none; border: 1px solid var(--line); background: radial-gradient(circle at 50% 70%, #26315e, #0c1124 72%); }
.pWho { flex: 1; }
#pName { font-size: 22px; letter-spacing: .08em; }
#pLine { margin: 14px 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: 15.5px; }
.prow { display: flex; align-items: center; gap: 13px; padding: 11px 0; border-bottom: 1px solid rgba(205, 214, 240, .1); }
.prow:last-child { border-bottom: none; }
.prow .pic { display: inline-flex; font-size: 26px; color: var(--ember-hi); flex: none; width: 30px; justify-content: center; }
.prow .pmain { flex: 1; min-width: 0; }
.prow .ptitle { font-size: 16px; line-height: 1.3; }
.prow .psub { margin-top: 3px; font-size: 13px; color: var(--dim); }
.prow .pbar { margin-top: 7px; height: 3px; background: rgba(205, 214, 240, .16); }
.prow .pbar i { display: block; height: 100%; background: var(--ember); }
.prow .pside { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 16px; }
.prow.done .ptitle { color: var(--ember-hi); }
.prow.sel { background: linear-gradient(90deg, rgba(255, 159, 77, .1), transparent); }
.pnote { margin: 4px 0 0; font-size: 14px; font-style: italic; color: var(--dim); text-align: center; }
.jgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; }
.jgrid .srow { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; font-size: 15px; color: var(--dim); }
.jgrid .srow .dots { flex: 1; border-bottom: 1px dotted rgba(205, 214, 240, .28); transform: translateY(-4px); }
.jgrid .srow b { font-weight: 400; color: var(--text); }
.jhead { margin: 16px 0 6px; }
/* the journal's two pages: the chronicle and the records */
.jtabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line); }
.jtab { position: relative; display: inline-flex; align-items: center; gap: 9px; padding: 3px 12px 10px; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--dim); }
.jtab:hover { color: var(--text); }
.jtab.on { color: var(--text); }
.jtab.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 1px; background: var(--text); }
.jnew { width: 6px; height: 6px; transform: rotate(45deg); background: var(--ember); box-shadow: 0 0 7px var(--ember); }
.chron { padding: 2px 0 15px; }
.chron + .chron { padding-top: 14px; border-top: 1px solid rgba(205, 214, 240, .1); }
.chron h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 7px; font-weight: 400; font-size: 12.5px; letter-spacing: .22em; color: var(--text); }
.chron h3 .cap { color: var(--ember-hi); font-size: 10px; }
.chron h3 .cap::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 8px; transform: rotate(45deg) translateY(-1px); background: var(--ember); box-shadow: 0 0 6px var(--ember); }
.chron p { margin: 0; font-size: 15px; line-height: 1.6; font-style: italic; color: #cfd6ea; }
.chron.new p { color: var(--text); }

#fade { position: fixed; inset: 0; background: var(--ink-0); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 4; }
#fade.on { opacity: 1; }
#fade.white { background: #fff8e8; transition: opacity 1.4s; }

/* between scenes: the veil is drawn by ui.js over everything, the overlays too; while a change of scene holds
   the input it takes the clicks, so none lands on what is appearing */
#veil { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 6; pointer-events: none; }
#veil.block { pointer-events: auto; cursor: default; }
/* where a journey leads, on the closed veil (opacity and drift set by ui.js) */
#journey { position: fixed; left: 0; right: 0; top: 41%; z-index: 7; pointer-events: none; text-align: center; }
#journey h2 { margin: 0; font-weight: 400; font-size: clamp(24px, 4.2vw, 40px); letter-spacing: .34em; text-indent: .34em; color: var(--text); text-shadow: 0 0 30px rgba(255, 190, 110, .25); }
#journey .rule { margin: 14px 0 12px; }
#journey p { margin: 0; font-style: italic; color: var(--dim); font-size: 16px; }
/* the summary arrives under ui.js's hand (fade, rise, numbers counting in) */
#summary .sbox { animation: none; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  #purse { font-size: 21px; top: 12px; left: 12px; gap: 16px; }
  #gain { font-size: 22px; top: 12px; left: 12px; }
  #tracker { top: 72px; left: 12px; font-size: 12px; }
  #wickBox { top: 62px; width: 62vw; }
  #prog { top: 112px; }
  #zoneName { top: 22px; right: 60px; }
  #btnPause, #btnSettings, #skyBack { top: 10px; right: 10px; }
  #ruler { right: 22px; top: 30%; height: 34%; }
  #hint { font-size: 14.5px; bottom: 16%; }
  #toasts { top: 132px; left: 12px; }
  .jgrid { grid-template-columns: 1fr; }
}
