/* Apni Nagri: warm limewashed plaster panels, enamel-blue street signs, indigo, terracotta and marigold,
   floating over the 3D city. */
:root {
  --bg: #1a1430;
  --panel: rgba(250, 243, 230, 0.96);
  --panel-2: #efe0c4;
  --ink: #2b1d24;
  --ink-soft: #6a575a;
  --line: rgba(90, 50, 30, 0.15);
  --indigo: #23408e;
  --indigo-2: #1a3172;
  --terracotta: #c45a2a;
  --marigold: #f2b134;
  --saffron: #e0862a;
  --rani: #b8336a;
  --teal: #1c9a8c;
  --gold: #ffd27a;
  --good: #2e8b57;
  --bad: #b84a42;
  --radius: 18px;
  --display: "Baloo 2", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
  font-family: var(--body);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }
input, textarea { font: inherit; }

#app { display: flex; flex-direction: column; height: 100%; }
#stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.admin-only { display: none !important; }
body.admin-on .admin-only { display: revert !important; }
body.admin-on #toolbar.admin-only { display: flex !important; }
body.admin-on .round.admin-only { display: grid !important; }
body.admin-on #admin-panel[hidden] { display: none !important; }

/* ---------- Name tags ---------- */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tag {
  position: absolute; left: 0; top: 0;
  pointer-events: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(251, 244, 230, 0.93);
  color: var(--ink);
  font: 800 11px var(--body);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  will-change: transform;
}
.tag::after { content: ""; position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); border: 4px solid transparent; border-top-color: rgba(251, 244, 230, 0.93); border-bottom: 0; }
.tag.keeper { background: #ffe1a8; }
.tag.keeper::after { border-top-color: #ffe1a8; }
.tag.kid { background: #d9f2e6; font-size: 10.5px; padding: 1px 7px; }
.tag.kid::after { border-top-color: #d9f2e6; }
.tag.bus { background: #c8302c; color: #fff; }
.tag.bus::after { border-top-color: #c8302c; }
.tag.chant { background: #fff; color: #b8336a; font-style: italic; pointer-events: none; }
.tag.chant::after { border-top-color: #fff; }
.tag.me, .tag.sel { background: var(--gold); font-size: 12.5px; padding: 3px 10px; }
.tag.me::after, .tag.sel::after { border-top-color: var(--gold); }

#flash { position: absolute; inset: 0; pointer-events: none; background: #e8eeff; opacity: 0; }
#flash.on { animation: flash 0.5s ease-out; }
@keyframes flash { 0% { opacity: 0.3; } 40% { opacity: 0.06; } 55% { opacity: 0.18; } 100% { opacity: 0; } }

/* ---------- Floating chrome ---------- */
.chip, #hud-card, .round, .panel, #find-bar { background: var(--panel); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }

.live-pill {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  z-index: 4;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 14px;
}
.live-pill b { font-family: var(--display); font-weight: 700; letter-spacing: 0.06em; }
.live-pill #live-count { color: var(--ink-soft); font-weight: 800; font-size: 13px; }
.live-pill .chev { color: var(--ink-soft); font-size: 12px; }
.live-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--terracotta); }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(214, 51, 108, 0.55); } 70%, 100% { box-shadow: 0 0 0 8px rgba(214, 51, 108, 0); } }

#hud {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
#hud > * { pointer-events: auto; }
#hud-card { border-radius: 16px; padding: 8px 16px 9px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
/* the district name as an enamel street sign */
.hud-title { font-family: var(--display); font-weight: 700; font-size: 12.5px; letter-spacing: 0.16em; text-transform: uppercase; color: #fff; background: var(--indigo); padding: 2px 12px; border-radius: 6px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55); }
.hud-row { display: flex; align-items: center; gap: 14px; }
.hud-col { display: flex; flex-direction: column; align-items: flex-start; font-weight: 800; font-size: 14px; line-height: 1.35; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hud-sep { width: 1px; align-self: stretch; background: var(--line); }
.muted { color: var(--ink-soft); font-weight: 700; font-size: 12.5px; }
#hud-btns { display: flex; gap: 8px; }
.round { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 17px; font-weight: 800; color: var(--ink); }
.round:hover { background: #fffaf0; }
.phone-only { display: none; }
body.find-open #btn-find { background: var(--indigo); color: #fff; border-color: var(--indigo); }

/* ---------- Buttons ---------- */
.primary, .secondary, .ghost { border-radius: 12px; padding: 11px 18px; font-weight: 800; font-size: 15px; text-align: center; text-decoration: none; }
.primary { background: var(--indigo); color: #fff; }
.primary:hover { background: var(--indigo-2); }
.primary:disabled, .secondary:disabled { opacity: 0.5; cursor: not-allowed; }
button:active:not(:disabled) { transform: translateY(1px); }
.primary.big { padding: 14px 22px; font-size: 17px; background: linear-gradient(135deg, var(--saffron), var(--rani)); box-shadow: 0 8px 24px rgba(214, 51, 108, 0.35); }
.secondary { background: var(--panel-2); color: var(--ink); }
.secondary:hover { background: #e9d6b3; }
.ghost { color: var(--ink-soft); }
.ghost:hover { color: var(--ink); }
.wide { width: 100%; display: block; margin-top: 8px; }
.center { display: block; }
.link { min-height: 28px; color: var(--indigo); font-weight: 800; text-decoration: underline; text-underline-offset: 2px; padding: 0; text-align: right; }
.filebtn { cursor: pointer; }

/* ---------- Find bar + night progress ---------- */
#find-bar {
  position: absolute;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  display: flex; align-items: center; gap: 8px;
  padding: 7px 7px 7px 14px;
  border-radius: 18px;
  z-index: 5;
  color: var(--ink-soft);
}
#find-bar input { flex: 1; min-width: 0; border: 0; background: transparent; font: 800 16px var(--body); color: var(--ink); outline: none; padding: 9px 2px; }
#find-bar input::placeholder { color: var(--ink-soft); }
/* suggestions open upwards from the search bar */
#find-sugg { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); margin: 0; padding: 6px; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3); max-height: 50vh; overflow: auto; }
#find-sugg li.empty { padding: 10px 12px; font-weight: 700; font-size: 14px; color: var(--ink-soft); }
#find-sugg button { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; text-align: left; font-size: 15px; }
#find-sugg button:hover, #find-sugg button:focus-visible { background: var(--panel-2); }
#find-sugg button span { color: var(--ink-soft); font-weight: 800; font-size: 12.5px; flex: none; }
#find-sugg b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ghost-btn { padding: 10px 14px; border-radius: 12px; background: var(--panel-2); font-weight: 800; color: var(--ink); }
.primary.small { padding: 10px 16px; }
#night-bar { position: absolute; left: 50%; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(240px, 50vw); height: 5px; border-radius: 99px; background: rgba(0, 0, 0, 0.35); overflow: hidden; z-index: 2; }
#night-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--saffron), var(--rani)); }
body.admin-on #find-bar { bottom: 12px; }
body.admin-on #night-bar { display: none; }

/* ---------- Panels ---------- */
.panel { position: absolute; z-index: 5; border-radius: var(--radius); padding: 16px; color: var(--ink); }
.panel h3 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.2; padding-right: 36px; }
.panel { border-top: 3px solid var(--terracotta); }
.panel p { margin: 4px 0 0; }
.panel .close { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border-radius: 10px; color: var(--ink-soft); font-size: 16px; }
.panel .close:hover { background: var(--panel-2); }
.panel .row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.panel .row > span:first-child { color: var(--ink-soft); font-weight: 700; flex: none; }
.panel .row > span:last-child { font-weight: 800; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.handle { display: none; }

.side { top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); width: min(360px, calc(100% - 28px)); max-height: calc(100% - 110px); overflow: auto; }
#inspect .price { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 6px; background: var(--panel-2); border-radius: 12px; padding: 6px; }
#inspect .price b { font-size: 22px; font-family: var(--display); font-weight: 700; }
#inspect .price button { width: 40px; height: 40px; border-radius: 10px; background: var(--panel); font-size: 18px; font-weight: 800; }
.per-head { display: flex; align-items: center; gap: 12px; padding-right: 34px; margin-bottom: 8px; }
.per-head h3 { font-size: 22px; overflow-wrap: anywhere; }
.per-head h3 small { font-size: 13px; color: #c47a1a; font-family: var(--body); font-weight: 800; }
.per-head p { color: var(--ink-soft); font-weight: 700; font-size: 14px; }
.per-av { width: 46px; height: 46px; border-radius: 50%; flex: none; box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.14); border: 3px solid var(--gold); }
.acts { display: flex; gap: 8px; margin-top: 12px; }
.acts > button { flex: 1; padding: 12px; }
.acts.wrap { flex-wrap: wrap; }
.acts.wrap > button { flex: 1 1 calc(33% - 8px); min-width: 92px; padding: 10px 8px; font-size: 14px; }
.badge { font-weight: 800; font-size: 12.5px; color: var(--ink-soft); }
.badge.community { color: #1d6f8c; }
.badge.generated, .badge.visitor { color: #8a6a3a; }
.note { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin: 10px 0 0; line-height: 1.45; }
.tag.home-label { background: var(--gold); font-size: 12.5px; padding: 3px 10px; pointer-events: none; }
.tag.home-label::after { border-top-color: var(--gold); }

#people { top: calc(64px + env(safe-area-inset-top, 0px)); left: calc(12px + env(safe-area-inset-left, 0px)); width: min(330px, calc(100% - 24px)); max-height: calc(100% - 160px); display: flex; flex-direction: column; gap: 8px; }
#people-q, #res-q, #login-code, #res-input, #res-random {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  font: 700 15px var(--body);
  color: var(--ink);
}
#res-input { resize: vertical; margin: 8px 0 0; }
#admin-panel h4 { margin: 16px 0 6px; font-family: var(--display); font-size: 16px; }
#admin-panel input[type="date"], #admin-panel select, #nt-title, #nt-body, #ft-title, #ft-note { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 8px 10px; font: 700 14px var(--body); color: var(--ink); min-height: 40px; }
#nt-title, #nt-body, #ft-title, #ft-note { width: 100%; margin-top: 6px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.res-preview { margin-top: 10px; background: var(--panel-2); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.res-preview ul { margin: 4px 0 8px; padding-left: 18px; }
.res-preview small, .rrow small { color: var(--ink-soft); font-weight: 700; display: block; font-size: 12px; }
.res-housing { margin-top: 10px; }
.row.warn > span:last-child { color: var(--bad); }
.rbtns { display: flex; gap: 10px; flex: none; }
.look-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px; background: var(--panel-2); border-radius: 10px; font-size: 13px; font-weight: 700; }
.look-edit label { display: flex; align-items: center; gap: 4px; }
#res-random { width: 90px; text-align: right; padding: 6px 8px; }
#people-list, #res-list { overflow: auto; min-height: 0; flex: 1; }
#res-list { max-height: 240px; margin-top: 8px; }
.prow { display: grid; grid-template-columns: 10px 1fr; column-gap: 9px; width: 100%; text-align: left; padding: 8px 6px; border-radius: 10px; border-top: 1px solid var(--line); }
.prow:hover { background: var(--panel-2); }
.pdot { width: 9px; height: 9px; border-radius: 50%; background: #d6c7ae; margin-top: 5px; grid-row: span 2; }
.pdot.on { background: var(--good); }
.prow small { color: var(--ink-soft); font-weight: 700; }
.empty { padding: 10px 4px; }
.pn { font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.rrow { display: flex; justify-content: space-between; gap: 8px; padding: 7px 2px; border-top: 1px solid var(--line); font-weight: 800; font-size: 14px; }
.rrow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.pop { top: calc(140px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(340px, calc(100% - 24px)); }
#admin-panel { top: calc(140px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); width: min(420px, calc(100% - 24px)); max-height: calc(100% - 240px); overflow: auto; }
.tabs { display: flex; gap: 6px; margin: 12px 0; background: var(--panel-2); padding: 4px; border-radius: 12px; }
.tab { flex: 1; padding: 8px; border-radius: 9px; font-weight: 800; font-size: 14px; color: var(--ink-soft); }
.tab.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); }
#wx-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.wx { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px; border-radius: 12px; background: var(--panel-2); font-weight: 800; font-size: 12.5px; border: 2px solid transparent; }
.wx span { font-size: 22px; }
.wx.on { border-color: var(--rani); background: #fff7ea; }
#wx-note { margin-top: 8px; }
.wx-time { margin: 12px 0 4px; }
.wx-time .row { border-top: 0; padding: 0 0 6px; }
#wx-time { width: 100%; accent-color: var(--saffron); }
#wx-time:disabled { opacity: 0.45; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; margin-top: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--rani); }

/* ---------- Admin toolbar ---------- */
#toolbar {
  gap: 6px;
  padding: 8px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  overflow-x: auto;
  background: #241a35;
  border-top: 2px solid var(--saffron);
  scrollbar-width: thin;
}
.tool { flex: 0 0 auto; width: 64px; padding: 6px 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 214, 160, 0.16); color: #f8ecd8; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tool .ico { font-size: 22px; line-height: 1.15; }
.tool .lbl { font-size: 11.5px; font-weight: 800; }
.tool.active { border-color: var(--saffron); background: rgba(242, 140, 40, 0.25); }

/* ---------- Toasts ---------- */
#toasts { position: absolute; top: calc(150px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; width: max-content; max-width: calc(100% - 24px); z-index: 6; }
.toast { background: rgba(45, 31, 51, 0.93); color: #fbf3e6; border-radius: 12px; padding: 8px 16px; font-size: 14px; font-weight: 800; text-align: center; animation: toast 3.2s ease forwards; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-6px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at 50% 30%, rgba(90, 30, 60, 0.3), rgba(10, 6, 20, 0.62)); z-index: 10; }
.card { background: var(--panel); border-radius: 24px; padding: 26px; width: min(400px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); color: var(--ink); border-top: 4px solid var(--saffron); }
/* ---------- Welcome screen: text over the live city ---------- */
.splash {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center;
  padding: 32px max(24px, env(safe-area-inset-right, 0px)) 32px max(24px, 6vw, env(safe-area-inset-left, 0px));
  background: linear-gradient(90deg, rgba(18, 11, 28, 0.88) 0%, rgba(18, 11, 28, 0.62) 38%, rgba(18, 11, 28, 0.08) 72%, rgba(18, 11, 28, 0) 100%);
  color: #f8efe2;
}
.splash[hidden] { display: none; }
.splash-inner { max-width: 470px; display: flex; flex-direction: column; align-items: flex-start; }
.splash .mark { color: var(--gold); margin-bottom: 18px; }
.eyebrow { margin: 0 0 6px; font-size: 12.5px; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.splash h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(48px, 7vw, 76px); line-height: 0.95; letter-spacing: -0.01em; color: #fffaf2; }
.devanagari { margin: 6px 0 18px; font-family: var(--display); font-size: 22px; font-weight: 600; color: rgba(248, 239, 226, 0.7); }
.lede { margin: 0 0 26px; font-size: 16.5px; line-height: 1.55; font-weight: 600; color: rgba(248, 239, 226, 0.86); max-width: 42ch; }
.enter {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 15px 26px; border-radius: 999px;
  background: var(--saffron); color: #1d1208;
  font-family: var(--body); font-weight: 800; font-size: 16px;
  box-shadow: 0 10px 30px rgba(242, 140, 40, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}
.enter span { font-size: 18px; transition: transform 0.15s ease; }
.enter:hover { background: #ffa04a; }
.enter:hover span { transform: translateX(3px); }
.enter:active { transform: scale(0.98); }
.stats-row { display: flex; gap: 28px; margin: 30px 0 0; padding-top: 18px; border-top: 1px solid rgba(248, 239, 226, 0.18); }
.stats-row div { display: flex; flex-direction: column-reverse; gap: 2px; }
.stats-row dt { font-size: 11.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(248, 239, 226, 0.55); }
.stats-row dd { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 600; color: #fffaf2; font-variant-numeric: tabular-nums; }
.splash .tip { color: rgba(248, 239, 226, 0.6); margin-top: 18px; min-height: 0; }
body.splash-on #hud, body.splash-on .live-pill, body.splash-on #find-bar, body.splash-on #night-bar, body.splash-on #labels { display: none !important; }
.tip { color: var(--ink-soft); font-size: 13px; font-weight: 700; margin: 6px 0 0; min-height: 2.6em; }
.dialog-card h2 { margin: 0 0 8px; font-family: var(--display); font-weight: 700; font-size: 26px; }
.dialog-card p { color: var(--ink-soft); font-weight: 700; margin: 0 0 14px; }
#login-err { min-height: 1.2em; margin: 6px 0 0; font-weight: 800; }
.bad { color: var(--bad); }

body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .live-pill .dot { animation: none; }
  .enter, .enter span { transition: none; }
  #flash.on { animation: none; }
}

/* ---------- Sponsored spaces (off unless the admin turns them on) ---------- */
.ad-slot { margin-top: 14px; min-height: 104px; border: 1px dashed rgba(90, 50, 30, 0.35); border-radius: 12px; padding: 10px 12px; background: rgba(255, 255, 255, 0.45); position: relative; }
.ad-slot .ad-label { position: absolute; top: 6px; right: 10px; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.ad-slot b { display: block; font-family: var(--display); font-size: 17px; margin-top: 8px; }
.ad-slot p { margin: 2px 0 0; font-size: 13px; font-weight: 600; }
.ad-slot a { color: var(--indigo); font-weight: 800; font-size: 13px; }

/* ---------- Minimap ---------- */
#minimap { position: absolute; left: calc(12px + env(safe-area-inset-left, 0px)); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); width: 220px; z-index: 3; border-radius: 12px; border: 3px solid var(--panel); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); cursor: crosshair; background: #e9dcbf; }
body.splash-on #minimap, body.creator-on #minimap { display: none; }
/* compass, bottom right */
#compass { position: absolute; right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 4; display: flex; align-items: center; gap: 4px; color: var(--ink); }
#cmp-dial { width: 60px; height: 60px; padding: 2px; border-radius: 50%; display: grid; place-items: center; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.3)); }
#cmp-dial text { font-family: var(--body); }
#cmp-rose { transform-origin: 32px 32px; transform-box: view-box; }
.cmp-turn { width: 34px; height: 34px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25); font-size: 17px; font-weight: 800; color: var(--ink); display: grid; place-items: center; }
.cmp-turn:hover, #cmp-dial:hover circle { filter: brightness(1.04); }
body.splash-on #compass, body.creator-on #compass { display: none; }
body.admin-on #compass { bottom: 74px; }

/* ---------- Noticeboard ---------- */
#btn-notices { position: relative; }
#btn-notices.unread::after { content: ""; position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--rani); box-shadow: 0 0 0 2px var(--panel); }
.nb-sec { margin-top: 14px; }
.nb-sec h4 { margin: 0 0 6px; font-family: var(--display); font-size: 16px; color: #8a3a1e; letter-spacing: 0.02em; }
.nb-item { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.nb-item b { font-weight: 800; }
.nb-item span, .nb-date { color: var(--ink-soft); font-weight: 700; font-size: 13px; }
.nb-item p { margin: 2px 0 0; font-size: 13.5px; font-weight: 600; line-height: 1.45; }
.nb-item .link { align-self: flex-start; text-align: left; font-size: 13.5px; min-height: 32px; }
.nb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { background: var(--panel-2); border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 13px; min-height: 36px; }
.chip-btn small { color: var(--ink-soft); }

/* ---------- Creator mode ---------- */
#creator-bar, #cr-show { display: none; }
body.creator-on #creator-bar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center;
  position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(980px, calc(100% - 24px)); padding: 8px; border-radius: 16px; z-index: 6;
  background: rgba(36, 26, 53, 0.9); border: 1px solid rgba(255, 214, 160, 0.2); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
#creator-bar button { color: #f8ecd8; background: rgba(255, 255, 255, 0.07); border-radius: 10px; padding: 8px 11px; font-weight: 800; font-size: 13px; min-height: 40px; }
#creator-bar button[aria-pressed="true"] { background: var(--saffron); color: #1d1208; }
#creator-bar button.unsupported { opacity: 0.5; }
#creator-bar .sep { width: 1px; align-self: stretch; background: rgba(255, 214, 160, 0.2); }
body.creator-on #find-bar, body.creator-on #night-bar, body.creator-on .live-pill, body.creator-on #toolbar { display: none !important; }
body.creator-hide #hud, body.creator-hide #creator-bar, body.creator-hide .panel, body.creator-hide #labels, body.creator-hide #toasts { display: none !important; }
body.creator-hide #cr-show { display: grid; position: absolute; right: 12px; bottom: 12px; z-index: 7; opacity: 0.35; }
body.creator-hide #cr-show:hover, body.creator-hide #cr-show:focus-visible { opacity: 1; }
#story-guide { position: absolute; inset: 0; pointer-events: none; z-index: 2; display: grid; place-items: center; }
#story-guide .frame { height: 92%; aspect-ratio: 9 / 16; max-width: 92%; border: 2px dashed rgba(255, 255, 255, 0.85); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(10, 6, 20, 0.45); position: relative; }
#story-guide .frame span { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); color: #fff; font-weight: 800; font-size: 12px; background: rgba(0, 0, 0, 0.4); padding: 2px 8px; border-radius: 99px; }
.gl-lost { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9; background: var(--panel); padding: 14px 18px; border-radius: 14px; font-weight: 800; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); }

/* ---------- Barber: the token slip ---------- */
.barber .muted { margin-top: 2px; }
.bb-slip { position: relative; margin-top: 12px; padding: 14px 14px 12px; background: var(--panel-2); border-radius: 14px; border: 2px dashed rgba(196, 90, 42, 0.45); }
.bb-title { display: flex; align-items: center; justify-content: center; gap: 14px; font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 1; color: var(--terracotta); }
.bb-pole { width: 12px; height: 34px; border-radius: 6px; background: repeating-linear-gradient(135deg, #d9302c 0 6px, #fff 6px 12px, #23408e 12px 18px, #fff 18px 24px); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.bb-tag { text-align: center; font-weight: 800; font-size: 12.5px; letter-spacing: 0.06em; color: var(--ink-soft); margin: 6px 0 10px !important; }
.bb-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid rgba(35, 64, 142, 0.35); border-radius: 10px; overflow: hidden; }
.bb-grid div { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-right: 1.5px solid rgba(35, 64, 142, 0.2); border-bottom: 1.5px solid rgba(35, 64, 142, 0.2); }
.bb-grid div:nth-child(2n) { border-right: 0; }
.bb-grid div:nth-last-child(-n+2) { border-bottom: 0; }
.bb-grid span { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--indigo); }
.bb-grid b { font-family: var(--display); font-size: 18px; font-weight: 700; color: var(--ink); }
.bb-services { border: 0; margin: 10px 0 0; padding: 0; }
.bb-services legend { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--indigo); padding: 0; margin-bottom: 4px; }
.bb-services label { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 6px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14.5px; }
.bb-services label:hover { background: rgba(255, 255, 255, 0.5); }
.bb-services input { width: 20px; height: 20px; accent-color: var(--terracotta); flex: none; }
.bb-services label span { flex: 1; }
.bb-services label i { font-style: normal; color: var(--ink-soft); font-size: 13px; margin-left: 4px; }
.bb-services[disabled] label { opacity: 0.75; cursor: default; }
.bb-total { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 6px 2px; border-top: 1.5px dashed rgba(90, 50, 30, 0.25); margin-top: 6px; font-weight: 800; }
.bb-total b { font-family: var(--display); font-size: 22px; }
.bb-note { position: relative; margin: 12px 56px 10px 2px !important; padding: 10px 12px; background: #fff6d6; border-radius: 6px; transform: rotate(-1.2deg); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12); font-family: var(--display); font-size: 15.5px; line-height: 1.3; color: #26336b; }
.bb-note::before { content: ""; position: absolute; top: -7px; left: 50%; width: 52px; height: 14px; transform: translateX(-50%) rotate(2deg); background: rgba(196, 90, 42, 0.75); border-radius: 2px; }
.bb-notewrap { position: relative; }
.bb-stamp { position: absolute; right: 0; top: 50%; margin-top: -32px; width: 64px; height: 64px; border-radius: 50%; border: 2.5px solid rgba(110, 60, 160, 0.65); color: rgba(110, 60, 160, 0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; transform: rotate(-14deg); text-align: center; line-height: 1.05; }
.bb-stamp span { font-family: var(--display); font-weight: 700; font-size: 14px; }
.bb-stamp small { font-size: 9px; font-weight: 800; }
.bb-done { margin: 8px 0 0 !important; padding: 10px 12px; border-radius: 12px; background: rgba(46, 139, 87, 0.14); color: #1d5c39; font-weight: 700; font-size: 14.5px; }
.bb-slip .primary.wide, .bb-slip .ghost-btn.wide { width: 100%; display: block; margin-top: 8px; }
.bb-bye { text-align: center; font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--rani); margin: 10px 0 0 !important; }
.bb-closed { text-align: center; padding: 22px 16px 18px; }
.bb-shut { height: 70px; margin: 0 auto 12px; width: 78%; border-radius: 6px 6px 2px 2px; background: repeating-linear-gradient(180deg, #9aa3a8 0 7px, #7f888d 7px 9px); box-shadow: inset 0 -6px 0 #5d7580; }
.bb-big { font-family: var(--display); font-weight: 700; font-size: 32px; color: var(--terracotta); margin: 0 !important; }
.bb-sub { font-weight: 700; color: var(--ink-soft); }

/* ---------- Nagri Radio (the barber shop's radio) ---------- */
.radio { position: absolute; z-index: 6; left: calc(14px + env(safe-area-inset-left, 0px)); top: calc(64px + env(safe-area-inset-top, 0px)); width: min(380px, calc(100% - 28px));
  display: flex; gap: 12px; align-items: stretch; padding: 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--rani); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3); color: var(--ink); }
.rd-art { position: relative; flex: none; width: 128px; aspect-ratio: 8 / 5; align-self: center; border-radius: 10px; overflow: hidden; background: var(--panel); }
.rd-art #rd-video, .rd-art iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.rd-cassette { position: absolute; inset: 0; width: 100%; height: 100%; background: var(--panel); pointer-events: none; }
.rd-reel { transform-box: view-box; }
.radio.is-playing .rd-reel { animation: rdSpin 2.4s linear infinite; }
@keyframes rdSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .radio.is-playing .rd-reel { animation: none; } }
.rd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rd-head { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 15px; }
.rd-head b { flex: 1; }
.rd-x { width: 28px; height: 28px; border-radius: 8px; color: var(--ink-soft); }
.rd-x:hover { background: var(--panel-2); }
.rd-eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.rd-eq i { width: 3px; height: 4px; background: var(--rani); border-radius: 1px; }
.radio.is-playing .rd-eq i { animation: rdEq 0.9s ease-in-out infinite; }
.radio.is-playing .rd-eq i:nth-child(2) { animation-delay: -0.3s; }
.radio.is-playing .rd-eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes rdEq { 0%, 100% { height: 3px; } 50% { height: 12px; } }
.rd-title { margin: 4px 0 0; font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-artist { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-bar { height: 6px; margin-top: 8px; border-radius: 99px; background: var(--panel-2); cursor: pointer; overflow: hidden; }
.rd-bar div { height: 100%; width: 0; background: linear-gradient(90deg, var(--saffron), var(--rani)); }
.rd-bar:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.rd-times { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; color: var(--ink-soft); margin-top: 2px; font-variant-numeric: tabular-nums; }
.rd-ctrls { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.rd-ctrls button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); }
.rd-ctrls button svg { width: 18px; height: 18px; }
.rd-ctrls button:hover { background: var(--panel-2); }
.rd-ctrls .rd-primary { width: 40px; height: 40px; background: var(--indigo); color: #fff; }
.rd-ctrls .rd-primary:hover { background: var(--indigo-2); }
#rd-shuffle.is-on { color: var(--rani); background: rgba(184, 51, 106, 0.12); }
#rd-vol { flex: 1; min-width: 50px; accent-color: var(--rani); }
.radio.is-empty .rd-ctrls, .radio.is-empty .rd-bar, .radio.is-empty .rd-times { opacity: 0.4; pointer-events: none; }
body.splash-on .radio, body.creator-on .radio { display: none !important; }
.rd-mini-btn { display: none; }
.radio.is-min { width: 52px; height: 52px; padding: 0; border-radius: 50%; border-top-width: 1px; background: var(--panel); }
.radio.is-min .rd-art, .radio.is-min .rd-main { display: none; }
.radio.is-min .rd-mini-btn { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; font-size: 24px; position: relative; }
.rd-mini-eq { position: absolute; top: 6px; right: 7px; display: inline-flex; gap: 2px; align-items: flex-end; height: 11px; }
.rd-mini-eq i { width: 3px; height: 3px; background: var(--rani); border-radius: 1px; }
.radio.is-min.is-playing .rd-mini-eq i { animation: rdEq 0.9s ease-in-out infinite; }
.radio.is-min.is-playing .rd-mini-eq i:nth-child(2) { animation-delay: -0.3s; }
.radio.is-min.is-playing .rd-mini-eq i:nth-child(3) { animation-delay: -0.6s; }
body.radio-on:has(.radio.is-min) .side { max-height: calc(100% - 110px); }
@media (max-width: 700px) { .radio.is-min { left: 10px; right: auto; width: 52px; top: auto; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }
@media (max-width: 700px) {
  .radio { left: 10px; right: 10px; width: auto; top: calc(128px + env(safe-area-inset-top, 0px)); }
  body.find-open .radio { top: calc(196px + env(safe-area-inset-top, 0px)); }
  body.radio-on .side { max-height: calc(100% - 290px - env(safe-area-inset-top, 0px)); }
  .rd-art { width: 96px; }
}

/* ---------- Admin: arrival hall ---------- */
.hall-list { max-height: 190px; overflow: auto; margin: 8px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.hall-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; min-height: 44px; cursor: pointer; border-bottom: 1px solid var(--line); font-weight: 700; }
.hall-row:last-child { border-bottom: 0; }
.hall-row input { width: 20px; height: 20px; accent-color: var(--terracotta); flex: none; }
.hall-row small { color: var(--ink-soft); font-weight: 700; }
.hall-list .muted { padding: 10px 12px; margin: 0; }
#hall-input { width: 100%; margin-top: 4px; }
[data-pane="residents"] hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* ---------- Weather picker (View panel) ---------- */
.wx-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0 10px; }
.wx-pick button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px; min-height: 52px; border-radius: 12px; background: var(--panel-2); font-weight: 800; font-size: 11.5px; line-height: 1.15; color: var(--ink); text-align: center; border: 2px solid transparent; }
.wx-pick button span { font-size: 19px; }
.wx-pick button:hover { border-color: var(--line); }
.wx-pick button[aria-checked="true"] { border-color: var(--indigo); background: #fff; }

/* ---------- Postcards ---------- */
.pc-card { width: min(560px, 100%); max-height: calc(100% - 24px); overflow: auto; padding: 20px; }
.pc-head { display: flex; justify-content: space-between; align-items: center; }
.pc-head h2 { margin: 0; font-family: var(--display); font-size: 24px; }
.pc-head .close { width: 40px; height: 40px; border-radius: 12px; color: var(--ink-soft); font-size: 18px; }
.seg { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 12px; margin: 12px 0; }
.seg button { flex: 1; padding: 9px; border-radius: 9px; font-weight: 800; font-size: 14px; color: var(--ink-soft); min-height: 40px; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); }
.pc-preview { display: grid; place-items: center; min-height: 240px; background: var(--panel-2); border-radius: 14px; padding: 10px; }
.pc-preview img { max-width: 100%; max-height: 52vh; border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); }

/* ---------- Phones ---------- */
@media (max-width: 700px) {
  #hud { top: calc(8px + env(safe-area-inset-top, 0px)); left: auto; right: 8px; transform: none; align-items: flex-end; }
  #hud-card { padding: 5px 12px 7px; }
  .hud-title { font-size: 11px; }
  .hud-col { font-size: 12.5px; }
  .hud-row { gap: 10px; }
  #hud-earned { display: none; }
  .round { width: 40px; height: 40px; font-size: 16px; }
  .live-pill { top: auto; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); left: 12px; padding: 7px 12px; }
  #minimap { width: 150px; top: calc(70px + env(safe-area-inset-top, 0px)); bottom: auto; left: 8px; }
  body.admin-on .live-pill { bottom: 74px; }
  /* cards become bottom sheets */
  .side, #people, .pop, #admin-panel {
    top: auto; left: 0; right: 0; bottom: 0; transform: none;
    width: auto;
    border-radius: 22px 22px 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    max-height: 62%;
    overflow: auto;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
  }
  #people { max-height: 70%; }
  #admin-panel { max-height: 72%; }
  .handle { display: block; width: 44px; height: 5px; border-radius: 99px; background: rgba(0, 0, 0, 0.15); margin: -6px auto 10px; }
  #toasts { top: calc(118px + env(safe-area-inset-top, 0px)); }
  #find-bar input { font-size: 16px; }
  #compass { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); right: 10px; }
  #cmp-dial { width: 52px; height: 52px; }
  .cmp-turn { width: 32px; height: 32px; }
  /* search lives up with the buttons: the icon opens the bar under the city card, suggestions drop down */
  .phone-only { display: grid; }
  body:not(.find-open) #find-bar { display: none; }
  #find-bar { top: calc(134px + env(safe-area-inset-top, 0px)); bottom: auto; width: calc(100% - 16px); }
  body.admin-on #find-bar { bottom: auto; }
  #find-sugg { top: calc(100% + 8px); bottom: auto; }
  .live-pill { bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
  body.admin-on .live-pill { bottom: 74px; }
  .tool { width: 58px; }
  .splash { align-items: flex-end; padding: 24px 20px calc(28px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(0deg, rgba(18, 11, 28, 0.92) 0%, rgba(18, 11, 28, 0.7) 45%, rgba(18, 11, 28, 0) 80%); }
  .splash .mark { width: 34px; height: 40px; margin-bottom: 12px; }
  .lede { font-size: 15px; margin-bottom: 20px; }
  .enter { width: 100%; justify-content: center; }
  .stats-row { gap: 0; justify-content: space-between; width: 100%; margin-top: 22px; }
  .stats-row dd { font-size: 19px; }
  .stats-row dt { font-size: 10px; letter-spacing: 0.06em; }
}
