:root {
  --ink: rgba(10, 27, 30, .74); --ink2: rgba(10, 27, 30, .9); --line: rgba(255, 244, 225, .12); --tx: #f4efe6; --mut: #a9b8b4;
  --brass: #e9b872; --coral: #ff7d61; --foam: #9fdccf; --acc: var(--brass);
  --serif: "Fraunces", Georgia, serif; --sans: "DM Sans", system-ui, sans-serif; --ml: "Anek Malayalam", "Noto Sans Malayalam", sans-serif; --mono: "IBM Plex Mono", monospace;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; background: #081417; color: var(--tx); font: 13px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
body::before, body::after { content: ""; position: fixed; left: 0; right: 0; pointer-events: none; z-index: 1; }
body::before { top: 0; height: 210px; background: linear-gradient(rgba(6, 18, 22, .62), transparent); }
body::after { bottom: 0; height: 190px; background: linear-gradient(transparent, rgba(6, 18, 22, .5)); }
.panel { position: fixed; background: var(--ink); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); box-shadow: 0 14px 40px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .06); z-index: 5; }
body:not(.ready) .panel, body:not(.ready) #title, body:not(.ready) #hud, body:not(.ready) #hint, body:not(.ready) #labels { opacity: 0; pointer-events: none; }
.panel, #title, #hud, #hint, #labels { transition: opacity .9s .3s; }

/* loader */
#loader { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: radial-gradient(90% 70% at 50% 105%, #7a3d2c 0%, #2b3a3c 38%, #0c1c20 72%, #071114 100%); transition: opacity 1.4s, visibility 1.4s; }
.ready #loader { opacity: 0; visibility: hidden; }
.lin { text-align: center; width: min(380px, 82vw); }
#loader h1 { font: 400 64px/1 var(--serif); letter-spacing: -.02em; font-variation-settings: "opsz" 144; }
.mlh { font: 500 18px var(--ml); color: var(--brass); margin-bottom: 2px; }
.tag { font: italic 400 15px var(--serif); color: #d8cfc0; margin-top: 10px; }
#stage { color: var(--mut); min-height: 1.5em; font-size: 12px; margin-top: 12px; font-variant-numeric: tabular-nums; }
#bar { height: 2px; background: rgba(255, 255, 255, .14); margin-top: 26px; border-radius: 2px; overflow: hidden; }
#bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--coral), var(--brass)); transition: width .25s; }

/* title, unboxed */
#title { position: fixed; top: 18px; left: 22px; z-index: 5; text-shadow: 0 2px 18px rgba(0, 0, 0, .55); }
#title .ml { font: 500 15px var(--ml); color: var(--brass); margin-bottom: -2px; }
#title .brand, #loader .brand { font: 600 10px/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--coral); }
#title .brand { margin-bottom: 8px; }
#loader .brand { margin-bottom: 10px; }
#title h1 { font: 400 46px/1.02 var(--serif); letter-spacing: -.02em; font-variation-settings: "opsz" 144; }
#title .sub { color: #dbe3df; font-size: 12.5px; margin-top: 5px; }
#title .sub b { font-weight: 600; color: #fff; }
#actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; width: 206px; text-shadow: none; }
#actions button { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 14px; text-align: left; background: var(--ink); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); transition: transform .2s, border-color .2s, background .2s; }
#actions button:hover { transform: translateX(3px); border-color: rgba(233, 184, 114, .5); }
#actions svg { width: 30px; height: 30px; padding: 6px; border-radius: 10px; background: rgba(233, 184, 114, .14); fill: none; stroke: var(--brass); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#bCard svg { background: rgba(159, 220, 207, .13); stroke: var(--foam); }
#actions span { display: flex; flex-direction: column; line-height: 1.25; }
#actions b { font: 500 15px var(--serif); }
#actions i { font-style: normal; font-size: 11px; color: var(--mut); }

/* tools */
#tools { top: 18px; right: 18px; display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 99px; }
#tools button, #tools select { height: 30px; padding: 0 13px; border-radius: 99px; border: 1px solid transparent; font-size: 12.5px; }
#tools .tg { color: #d5ddd9; }
#tools .tg:hover { background: rgba(255, 255, 255, .08); }
#tools .tg.on { background: var(--tx); color: #10262a; font-weight: 500; }
#tMl { font-family: var(--ml); }
#tools select { background: transparent; appearance: none; -webkit-appearance: none; padding-right: 24px; color: #d5ddd9; background-image: linear-gradient(45deg, transparent 50%, var(--mut) 50%), linear-gradient(135deg, var(--mut) 50%, transparent 50%); background-position: calc(100% - 13px) 13px, calc(100% - 8px) 13px; background-size: 5px 5px; background-repeat: no-repeat; }
#tools select option { color: #111; }
#compass { width: 30px; padding: 0 !important; display: grid; place-items: center; background: rgba(255, 255, 255, .07); }
#compass svg { width: 20px; height: 20px; }
#compass path:first-child { fill: var(--coral); }

#hint { position: fixed; left: 50%; top: 46%; transform: translate(-50%, -50%); padding: 8px 16px; border-radius: 99px; background: var(--ink2); border: 1px solid var(--line); color: #dfe6e2; z-index: 4; pointer-events: none; white-space: nowrap; font-size: 12.5px; }
#hint.gone { opacity: 0 !important; }

#hud { position: fixed; right: 22px; bottom: 20px; z-index: 4; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-shadow: 0 1px 10px rgba(0, 0, 0, .8); pointer-events: none; }
#hud b { font: 500 17px var(--serif); }
#hud span { font: 10.5px var(--mono); color: #c9d4d0; }

#about a { color: var(--foam); }
#streamNote { display: none; font: 10.5px var(--sans); font-style: normal; color: var(--brass); }
body.streaming #streamNote { display: block; animation: pulse 1.2s infinite alternate; }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }

/* dock */
#dock { left: 50%; bottom: 18px; transform: translateX(-50%); padding: 10px 12px 11px; width: min(700px, calc(100vw - 36px)); border-radius: 22px; }
#chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 10px; mask-image: linear-gradient(90deg, #000 92%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); }
#chips::-webkit-scrollbar { display: none; }
#chips button { padding: 5px 12px; border-radius: 99px; background: rgba(255, 255, 255, .07); white-space: nowrap; font-size: 12.5px; transition: background .2s, color .2s; }
#chips button:hover { background: var(--brass); color: #1b1a14; }
#timeRow { display: flex; align-items: center; gap: 9px; }
#clock { font: 500 19px var(--serif); white-space: nowrap; min-width: 96px; font-variant-numeric: tabular-nums; }
.ic { width: 15px; height: 15px; fill: none; stroke: var(--mut); stroke-width: 1.7; stroke-linecap: round; flex: none; }
#presets { display: flex; background: rgba(0, 0, 0, .25); border-radius: 99px; padding: 3px; }
#presets button { padding: 4px 11px; border-radius: 99px; white-space: nowrap; font-size: 12px; color: #cfd8d4; }
#presets button:hover { color: #fff; }
#presets button.on { background: var(--brass); color: #1b1a14; font-weight: 500; }
#time { flex: 1; min-width: 60px; appearance: none; -webkit-appearance: none; height: 5px; border-radius: 5px; background: linear-gradient(90deg, #1c2a52, #f08d5a 11%, #f6e3b4 22%, #cfe6f5 44%, #f6e3b4 66%, #f08d5a 76%, #1c2a52 88%); outline: none; }
#time::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid var(--brass); box-shadow: 0 2px 8px rgba(0, 0, 0, .5); cursor: grab; }
#time::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 4px solid var(--brass); cursor: grab; }

/* labels */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.lb { position: absolute; left: 0; top: 0; display: none; align-items: center; gap: 6px; height: 20px; white-space: nowrap; will-change: transform; text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 10px rgba(0, 0, 0, .6); }
.lb span { font-family: var(--sans), var(--ml); }
.lb.click { pointer-events: auto; cursor: pointer; }
.lb i { width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(233, 184, 114, .55); flex: none; }
.lb.lm { font: 500 13.5px var(--serif); color: #fff; }
.lb.lm span { font-family: var(--serif), var(--ml); }
.lb.lm:hover span { color: var(--brass); }
.lb.loc { font-size: 11px; color: rgba(255, 255, 255, .85); letter-spacing: .02em; }
.lb.water { font: italic 400 13px var(--serif); letter-spacing: .14em; color: var(--foam); }
.lb.ward { font: 500 10px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: #ffd9a0; }

.pcb { display: flex; gap: 6px; }
.pcb button, .ah button, #pcStyles button { padding: 7px 14px; border-radius: 99px; background: rgba(255, 255, 255, .08); font-size: 12.5px; }
.pcb button:hover, .ah button:hover { background: rgba(255, 255, 255, .16); }
.pcb .pri { margin-left: auto; background: var(--acc); color: #1b1a14; font-weight: 600; }
.pcb .pri:hover { filter: brightness(1.08); background: var(--acc); }

/* about */
#about { top: 0; right: 0; bottom: 0; width: min(420px, 100vw); border-radius: 0; border-width: 0 0 0 1px; background: var(--ink2); padding: 20px 22px 34px; overflow-y: auto; transform: translateX(102%); transition: transform .4s cubic-bezier(.2, .8, .2, 1); z-index: 9; }
#about.open { transform: none; }
.ah { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ah h2 { font: 500 22px var(--serif); letter-spacing: -.01em; text-transform: lowercase; }
.ah h2::first-letter { text-transform: uppercase; }
#about p { color: #d5ddd9; margin-bottom: 10px; line-height: 1.6; }
#about h3 { font: italic 500 15px var(--serif); color: var(--brass); margin: 18px 0 8px; }
#about ul { padding-left: 17px; color: #d5ddd9; }
#about li { margin-bottom: 5px; }
#about .src { font-size: 12px; color: var(--mut); }
.row { display: grid; grid-template-columns: 1fr 90px 46px; gap: 9px; align-items: center; margin-bottom: 6px; font-size: 12px; }
.row .m { height: 4px; background: rgba(255, 255, 255, .1); border-radius: 3px; overflow: hidden; }
.row .m i { display: block; height: 100%; background: var(--brass); }
.row b { font: 11px var(--mono); text-align: right; color: var(--mut); }

/* postcard */
#postcard { position: fixed; inset: 0; z-index: 12; display: grid; place-items: center; background: rgba(5, 14, 16, .66); opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; padding: 14px; }
#postcard.open { opacity: 1; visibility: visible; }
.pc { position: relative; width: min(780px, 100%); padding: 18px 20px; max-height: 100%; overflow-y: auto; opacity: 1 !important; background: var(--ink2); }
#pcCanvas { width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 16px 50px rgba(0, 0, 0, .55); background: #222; transform: rotate(-.6deg); margin: 6px 0 4px; }
.pcf { display: flex; gap: 6px; margin: 16px 0 10px; flex-wrap: wrap; }
.pcf input { flex: 1; min-width: 120px; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: rgba(0, 0, 0, .25); outline: none; }
.pcf input:focus { border-color: var(--brass); }
#pcFrom { flex: 0 1 150px; }
#pcStyles { display: flex; gap: 4px; }
#pcStyles button.on { background: var(--tx); color: #10262a; font-weight: 500; }

@media (max-width: 820px) {
  body::before { height: 150px; }
  #title { left: 14px; top: 12px; }
  #title h1 { font-size: 32px; }
  #title .sub { display: none; }
  #actions { position: fixed; left: 10px; right: 10px; top: 76px; width: auto; flex-direction: row; margin: 0; }
  #actions button { flex: 0 0 calc((100% - 16px) / 3); margin-inline-start: auto; padding: 7px 8px; gap: 7px; }
  #actions svg { width: 24px; height: 24px; padding: 4px; }
  #actions i { display: none; }
  #actions b { font-size: 13px; }
  #tools { top: 12px; right: 10px; max-width: calc(100vw - 190px); overflow-x: auto; scrollbar-width: none; }
  #tools #quality { display: none; }
  #hud { display: none; }
  #dock { left: 10px; right: 10px; bottom: 10px; width: auto; transform: none; }
  #clock { font-size: 15px; min-width: 76px; }
  #presets button { padding: 4px 7px; font-size: 11px; }
  .ic { display: none; }
  #hint { white-space: normal; text-align: center; width: 80vw; border-radius: 16px; }
}
