:root {
  --void: #070a18;
  --abyss: #0d1330;
  --halo: #7cf5ff;
  --ember: #ff7ae0;
  --gold: #ffd166;
  --mist: #93a0c9;
  --paper: #eaf2ff;

  --display: "Space Grotesk", "Avenir Next", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --pane: rgba(13, 19, 48, 0.72);
  --edge: rgba(124, 245, 255, 0.22);
  --safe: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--paper);
  font-family: var(--display);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------------------------------------------------------------- chrome */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--pane);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mist);
  pointer-events: auto;
}

#topbar {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 1rem;
  pointer-events: none;
  z-index: 5;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--halo);
  box-shadow: 0 0 10px var(--halo);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: 0.35; } }

.nameplate {
  position: fixed;
  left: 1rem;
  bottom: calc(1rem + var(--safe));
  z-index: 5;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--halo);
  box-shadow: 0 0 12px currentColor;
}

#self-name {
  width: 11ch;
  border: none;
  background: none;
  color: var(--paper);
  font: inherit;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0;
}
#self-name:focus { outline: none; color: var(--halo); }

/* ------------------------------------------------------------- proximity */

#prompt {
  position: fixed;
  left: 50%;
  bottom: calc(1.75rem + var(--safe));
  transform: translateX(-50%);
  z-index: 6;
  text-align: center;
  animation: rise 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 12px); }
}

#prompt-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.62rem 1.15rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--pane);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
#prompt-card:hover {
  background: rgba(20, 30, 68, 0.86);
  border-color: rgba(124, 245, 255, 0.5);
}
#prompt-card:active { transform: scale(0.985); }

.prompt-go {
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  background: var(--halo);
  color: #041019;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 0 24px rgba(124, 245, 255, 0.3);
}

/* Still linking: the card stays clickable — pick a file now and it goes out
   the moment the connection is up. */
#prompt-card[data-ready="0"] .prompt-go {
  background: rgba(124, 245, 255, 0.18);
  color: var(--paper);
  box-shadow: none;
}

.prompt-who {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.prompt-state {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mist);
}
.prompt-state[data-ready="1"] { color: var(--halo); }

.prompt-hint {
  margin: 0.6rem 0 0;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(147, 160, 201, 0.55);
}

@media (max-width: 560px) {
  .prompt-hint { display: none; }
}

/* Mower prompt — same slot and look as the send-files prompt above, just a
   plain button instead of a label (there's no file input to point at). */
#mow-prompt {
  position: fixed;
  left: 50%;
  bottom: calc(1.75rem + var(--safe));
  transform: translateX(-50%);
  z-index: 6;
  text-align: center;
  animation: rise 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

#mow-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.62rem 1.15rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--pane);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
#mow-card:hover { background: rgba(20, 30, 68, 0.86); border-color: rgba(124, 245, 255, 0.5); }
#mow-card:active { transform: scale(0.985); }

/* Nudge — the prompt look, shown when nobody has turned up on this Wi-Fi.
   Sits a little higher than the prompts so a nearby mower's "Drive" never
   lands on top of it. The hint lives inside the card (not below it, like
   .prompt-hint) so it stays readable, and it isn't hidden on phones because
   phones are exactly where Private Relay bites. On touch screens the whole
   thing rides above the thumbstick and the Jump/Laser buttons. */
#nudge {
  position: fixed;
  left: 50%;
  bottom: calc(5.2rem + var(--safe));
  transform: translateX(-50%);
  z-index: 6;
  width: max-content;
  max-width: min(26rem, calc(100vw - 2rem));
  animation: rise 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
#nudge[hidden] { display: none; }
@media (pointer: coarse) { #nudge { bottom: calc(14rem + var(--safe)); } }

#nudge-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem 0.9rem;
  padding: 0.7rem 0.8rem 0.7rem 1.15rem;
  border: 1px solid var(--edge);
  border-radius: 1.4rem;
  background: var(--pane);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
}
#nudge-copy { border: 0; cursor: pointer; font: inherit; font-size: 0.8rem; font-weight: 500; }
/* On a phone the dismiss button would wrap onto a row of its own; keep it in the corner. */
@media (max-width: 480px) {
  #nudge-card { position: relative; padding: 1.15rem 1rem 0.8rem; }
  #nudge-close { position: absolute; top: 0.35rem; right: 0.45rem; }
}
#nudge-copy[hidden], #nudge-hint[hidden] { display: none; }

.nudge-hint {
  flex-basis: 100%;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.62rem;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mist);
  text-wrap: balance;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}
.btn:hover:not(:disabled) { background: rgba(124, 245, 255, 0.1); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--halo); outline-offset: 3px; }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn-primary {
  background: var(--halo);
  border-color: var(--halo);
  color: #041019;
  box-shadow: 0 0 28px rgba(124, 245, 255, 0.35);
}
.btn-primary:hover:not(:disabled) { background: #a5f9ff; }

/* ------------------------------------------------------------------ veils */

.veil {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: radial-gradient(120% 100% at 50% 40%, rgba(7, 10, 24, 0.72), rgba(7, 10, 24, 0.96));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.veil[hidden] { display: none; }

.veil-card {
  width: min(30rem, 100%);
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.9rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--halo);
}

.lockup {
  margin: 0;
  font-size: clamp(2.4rem, 9vw, 3.6rem);
  font-weight: 700;
  line-height: 0.94;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.drop-lockup { color: var(--gold); text-shadow: 0 0 44px rgba(255, 209, 102, 0.4); }

.veil-note {
  margin: 1.1rem 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mist);
}

/* ------------------------------------------------------------------ offer */

.offer-card {
  padding: 1.6rem;
  border: 1px solid var(--edge);
  border-radius: 22px;
  background: var(--pane);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  text-align: left;
}

.offer-card .eyebrow { color: var(--ember); }

.offer-title {
  margin: 0 0 1.1rem;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.manifest {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 34vh;
  overflow-y: auto;
  border-top: 1px solid rgba(124, 245, 255, 0.12);
}

.manifest li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(124, 245, 255, 0.1);
  font-family: var(--mono);
  font-size: 0.78rem;
}
.manifest li span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.manifest li span:last-child { color: var(--mist); flex: none; }

.offer-total {
  margin: 0.9rem 0 1.3rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mist);
}

.mono { font-family: var(--mono); }

.offer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* -------------------------------------------------------------------- log */

#log {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + var(--safe));
  z-index: 5;
  list-style: none;
  margin: 0;
  padding: 0;
  width: min(19rem, 62vw);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
}

#log li {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--pane);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--mist);
  animation: rise-log 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes rise-log { from { opacity: 0; transform: translateY(8px); } }

#log li b {
  display: block;
  color: var(--paper);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#log .bar {
  margin-top: 0.45rem;
  height: 2px;
  background: rgba(124, 245, 255, 0.16);
  border-radius: 2px;
  overflow: hidden;
}
#log .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--halo);
  box-shadow: 0 0 10px var(--halo);
  transition: width 120ms linear;
}
#log li[data-done="1"] .bar i { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
#log li[data-failed="1"] { border-color: rgba(255, 122, 224, 0.4); }
#log li[data-paused="1"] { border-color: rgba(255, 209, 102, 0.4); }
#log li[data-paused="1"] span { color: var(--gold); }
#log li[data-paused="1"] .bar i { opacity: 0.45; }

/* ------------------------------------------------------------ mobile stick */

#stick {
  position: fixed;
  left: 1.5rem;
  bottom: calc(5.5rem + var(--safe));
  width: 118px;
  height: 118px;
  border-radius: 50%;
  border: 1px solid rgba(124, 245, 255, 0.18);
  background: rgba(13, 19, 48, 0.4);
  z-index: 4;
  touch-action: none;
}

#stick-nub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: rgba(124, 245, 255, 0.75);
  box-shadow: 0 0 26px rgba(124, 245, 255, 0.55);
}

/* Rendered, but nowhere anyone can see it. `display: none` inputs can't
   always be opened programmatically. */
.offscreen {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

#jump {
  position: fixed;
  right: 1.5rem;
  bottom: calc(5.5rem + var(--safe));
  z-index: 4;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1px solid rgba(124, 245, 255, 0.28);
  background: rgba(13, 19, 48, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--halo);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  touch-action: none;
}
#jump:active { background: rgba(124, 245, 255, 0.2); transform: scale(0.94); }
#jump[hidden] { display: none; }
/* Jetpack equipped (double-tap to get here) — the same button now holds to
   ascend instead of jumping, so it gets its own colour to say so. */
#jump.jetpack-active {
  border-color: rgba(255, 138, 61, 0.55);
  color: #ff8a3d;
  background: rgba(255, 138, 61, 0.14);
}

/* Same chip as jump, one slot to its left when jump is also on screen (touch
   devices). On a mouse-and-keyboard device jump has no button (Space is
   well-known); laser still gets one, because there's no keyboard convention
   for it to lean on — this button IS the discoverability. */
#laser {
  position: fixed;
  right: calc(1.5rem + 74px + 0.75rem);
  bottom: calc(5.5rem + var(--safe));
  z-index: 4;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1px solid rgba(124, 245, 255, 0.28);
  background: rgba(13, 19, 48, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--halo);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  touch-action: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  line-height: 1.2;
}
#laser .btn-hint { font-size: 0.56rem; opacity: 0.65; letter-spacing: 0.08em; }
#laser:active { background: rgba(124, 245, 255, 0.2); transform: scale(0.94); }
#laser[hidden] { display: none; }
/* No touch stick/jump beside it on a mouse-and-keyboard device — sit in
   jump's usual corner instead of leaving an empty gap next to nothing. */
@media (pointer: fine) {
  #laser { right: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}


/* -------------------------------------------------------------- wardrobe */

.icon-btn {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: 0.15rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(124, 245, 255, 0.14);
  color: var(--halo);
  font-family: var(--display);
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  transition: background 140ms ease;
}
.icon-btn:hover { background: rgba(124, 245, 255, 0.3); }
.icon-btn:focus-visible { outline: 2px solid var(--halo); outline-offset: 2px; }

#wardrobe {
  position: fixed;
  left: 1rem;
  bottom: calc(4.2rem + var(--safe));
  z-index: 12;
  width: min(19rem, calc(100vw - 2rem));
  max-height: min(30rem, calc(100vh - 9rem));
  overflow-y: auto;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--edge);
  border-radius: 20px;
  background: var(--pane);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.6);
  animation: rise-panel 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
#wardrobe[hidden] { display: none; }

@keyframes rise-panel { from { opacity: 0; transform: translateY(14px); } }

.wardrobe-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}
.wardrobe-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.rack { margin-bottom: 0.95rem; }

.rack-label {
  margin: 0 0 0.45rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mist);
}

.swatches { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.swatch-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}
.swatch-btn:hover { transform: scale(1.12); }
.swatch-btn[aria-checked="true"] {
  border-color: var(--paper);
  box-shadow: 0 0 14px currentColor;
}
.swatch-btn:focus-visible { outline: 2px solid var(--halo); outline-offset: 2px; }

.options { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.option {
  padding: 0.34rem 0.66rem;
  border: 1px solid rgba(124, 245, 255, 0.16);
  border-radius: 999px;
  background: transparent;
  color: var(--mist);
  font-family: var(--display);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 130ms ease, color 130ms ease, border-color 130ms ease;
}
.option:hover { color: var(--paper); border-color: var(--edge); }
.option[aria-checked="true"] {
  background: rgba(124, 245, 255, 0.14);
  border-color: var(--halo);
  color: var(--paper);
}
.option:focus-visible { outline: 2px solid var(--halo); outline-offset: 2px; }

.wardrobe-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(124, 245, 255, 0.12);
}

.wardrobe-note {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(147, 160, 201, 0.6);
  text-align: right;
}

@media (max-height: 620px) {
  #wardrobe { max-height: calc(100vh - 6rem); bottom: 1rem; }
}

/* ------------------------------------------------------------------ store */

/* Same panel chrome as #wardrobe, parked on the opposite side so the two
   never fight for space if someone opens both in a row. */
#store {
  position: fixed;
  right: 1rem;
  bottom: calc(4.2rem + var(--safe));
  z-index: 12;
  width: min(20rem, calc(100vw - 2rem));
  max-height: min(32rem, calc(100vh - 9rem));
  overflow-y: auto;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--edge);
  border-radius: 20px;
  background: var(--pane);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.6);
  animation: rise-panel 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
#store[hidden] { display: none; }

.coin-balance {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 1rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(255, 209, 102, 0.3);
  border-radius: 12px;
  background: rgba(255, 209, 102, 0.08);
}
.coin-icon { font-size: 1rem; }
#coin-count {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
}
.coin-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mist);
}

.quest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }

.quest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(124, 245, 255, 0.14);
  border-radius: 10px;
  font-size: 0.78rem;
}
.quest-item.done {
  border-color: rgba(255, 209, 102, 0.35);
  color: var(--mist);
}
.quest-item .quest-name { flex: 1; }
.quest-item .quest-reward {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--gold);
  white-space: nowrap;
}
.quest-item.done .quest-reward::before { content: '\2713\0020'; }

.item-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }

.item-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid rgba(124, 245, 255, 0.16);
  border-radius: 12px;
  background: rgba(124, 245, 255, 0.03);
}
.item-card .item-name { font-size: 0.82rem; }
.item-card .item-cost {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--gold);
}
.item-card button {
  margin-top: 0.15rem;
  padding: 0.32rem 0;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: transparent;
  color: var(--paper);
  font-family: var(--display);
  font-size: 0.74rem;
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease;
}
.item-card button:hover:not(:disabled) { background: rgba(124, 245, 255, 0.14); border-color: var(--halo); }
.item-card button:disabled { opacity: 0.5; cursor: default; }
.item-card.owned { border-color: rgba(255, 209, 102, 0.35); }
.item-card.owned .item-cost { color: var(--mist); }

.item-confirm-row { display: flex; gap: 0.4rem; }
.item-confirm-row button { flex: 1; margin-top: 0; }

.wardrobe-note.warn { color: var(--gold); }

@media (max-height: 620px) {
  #store { max-height: calc(100vh - 6rem); bottom: 1rem; }
}

/* ------------------------------------------------------------------ rooms */

/* The room chip is a button now, so it needs to opt back in to pointer
   events — #topbar turns them off so the HUD never blocks the world. */
#room-chip {
  pointer-events: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--paper);
  cursor: pointer;
}
#room-chip:hover { border-color: var(--halo); }
#room-chip:focus-visible { outline: 2px solid var(--halo); outline-offset: 3px; }

.chip-caret {
  font-size: 0.6rem;
  color: var(--mist);
  transition: transform 160ms ease;
}
#room-chip[aria-expanded="true"] .chip-caret { transform: rotate(180deg); }

#rooms {
  position: fixed;
  left: 1rem;
  top: calc(3.6rem + env(safe-area-inset-top, 0px));
  z-index: 12;
  width: min(20rem, calc(100vw - 2rem));
  max-height: min(32rem, calc(100vh - 6rem));
  overflow-y: auto;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--edge);
  border-radius: 20px;
  background: var(--pane);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.6);
  animation: rise-panel 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
#rooms[hidden] { display: none; }

.room-where {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--mist);
}

/* Big, spaced, and monospaced — this is a string people read out loud to
   someone on the phone, so legibility beats compactness. */
.room-code {
  margin: 0 0 0.85rem;
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  color: var(--halo);
  text-shadow: 0 0 24px rgba(124, 245, 255, 0.4);
}

.room-actions { display: flex; gap: 0.5rem; }
.room-actions .btn { flex: 1; padding: 0.5rem 0.6rem; font-size: 0.8rem; }

.room-wide { width: 100%; }

.room-join { display: flex; gap: 0.5rem; }

.room-input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: rgba(7, 10, 24, 0.5);
  color: var(--paper);
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.room-input::placeholder { color: rgba(147, 160, 201, 0.45); letter-spacing: 0.16em; }
.room-input:focus { outline: none; border-color: var(--halo); }

.room-note {
  margin: 0.6rem 0 0;
  font-family: var(--mono);
  font-size: 0.6rem;
  line-height: 1.5;
  letter-spacing: 0.05em;
  color: rgba(147, 160, 201, 0.72);
}
.room-note.warn { color: var(--gold); }

/* Accounts: the sign-in form that gates room creation. Usernames and
   passwords are not room codes, so drop the uppercasing and letter-spacing
   the .room-input default carries. */
.auth-form { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.6rem 0 0.2rem; }
.room-input.plain { text-transform: none; letter-spacing: normal; }
.room-input.plain::placeholder { letter-spacing: normal; }

.linkish {
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  color: var(--halo);
  text-decoration: underline;
  cursor: pointer;
}
.linkish:hover { color: var(--paper); }
.linkish:focus-visible { outline: 2px solid var(--halo); outline-offset: 2px; }

/* ------------------------------------------------------ top-bar accounts */

/* The right end of the top bar: the account cluster and the population
   count share a row and wrap together when the viewport is tight. */
.topbar-right { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  justify-content: flex-end; pointer-events: none; }
.topbar-group { display: flex; align-items: center; gap: 0.5rem; }
/* A class-level `display` beats the [hidden] attribute's display:none, so
   restore it explicitly or both the signed-in and signed-out groups show. */
.topbar-group[hidden] { display: none; }

/* --------------------------------------------------------------- minimap */

#minimap {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1px solid var(--edge);
  background: var(--pane);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
#minimap[hidden] { display: none; }

/* A chip that acts like a button. Inherits the .chip pill; adds affordance. */
.chip-btn {
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 120ms ease;
}
.chip-btn:hover:not(:disabled) { border-color: var(--halo); color: var(--paper); }
.chip-btn:active:not(:disabled) { transform: scale(0.96); }
.chip-btn:focus-visible { outline: 2px solid var(--halo); outline-offset: 3px; }
.chip-btn:disabled { opacity: 0.5; cursor: default; }

/* The primary calls to action — Sign up, Create room — carry the accent. */
.chip-accent {
  background: var(--halo);
  border-color: var(--halo);
  color: #041019;
}
.chip-accent:hover:not(:disabled) { background: #a5f9ff; color: #041019; }

/* Popover that drops from the top-right for sign-in / account details. */
.pop {
  position: fixed;
  top: calc(max(1rem, env(safe-area-inset-top, 0px)) + 3rem);
  right: 1rem;
  z-index: 7;
  width: min(20rem, calc(100vw - 2rem));
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--edge);
  border-radius: 1.1rem;
  background: var(--pane);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  animation: rise-pop 160ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes rise-pop { from { opacity: 0; transform: translateY(-8px); } }

.pop-title {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--paper);
}
.pop .btn-primary, .pop .btn { margin-top: 0.4rem; }

/* ----------------------------------------------------------------- chat */

/* Toggle and panel share the bottom-left slot above the nameplate; only one
   shows at a time, so they never collide with the transfer log (bottom-right). */
#chat-toggle {
  position: fixed;
  left: 1rem;
  bottom: calc(4.25rem + var(--safe));
  z-index: 6;
}

/* Both carry a class-level `display`, which beats [hidden]'s display:none —
   restore it so the toggle and panel actually hide when told to. */
#chat-toggle[hidden], .chat-panel[hidden] { display: none; }

.chat-unread {
  min-width: 1.1rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--halo);
  color: #041019;
  font-size: 0.62rem;
  line-height: 1.35;
  text-align: center;
}

.chat-panel {
  position: fixed;
  left: 1rem;
  bottom: calc(4.25rem + var(--safe));
  z-index: 6;
  width: min(21rem, calc(100vw - 2rem));
  max-height: min(48vh, 26rem);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--edge);
  border-radius: 1.1rem;
  background: var(--pane);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  pointer-events: auto;
  animation: rise-pop 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.5rem 0.5rem 0.95rem;
}
.chat-head h2 { margin: 0; font-size: 0.95rem; color: var(--paper); }

.chat-log {
  list-style: none;
  margin: 0;
  padding: 0.2rem 0.95rem 0.4rem;
  flex: 1;
  min-height: 4rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chat-msg {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--paper);
  word-break: break-word;
}
.chat-msg b { color: var(--halo); font-weight: 600; margin-right: 0.4rem; }
.chat-msg.mine b { color: var(--gold); }

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0.95rem 0.8rem;
  border-top: 1px solid var(--edge);
}
.chat-form .room-input { flex: 1; }
.chat-form .btn { padding: 0.5rem 0.85rem; }

@media (max-width: 480px) {
  #rooms { left: 0.75rem; right: 0.75rem; width: auto; }
  .pop { left: 0.75rem; right: 0.75rem; width: auto; }
  .chat-panel { left: 0.75rem; right: 0.75rem; width: auto; }
}
