@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@500&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #142e4a;
  --muted: #708094;
  --paper: #f7f9fd;
  --line: #dfe7f1;
  --mint: #a9d8ff;
  --deep-mint: #2568ab;
  --coral: #ff836b;
  --navy: #112f50;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overscroll-behavior: none;
  background: #d9e8f5;
}

body {
  margin: 0;
  min-width: 320px;
  background: #d9e8f5;
  color: var(--ink);
  font-family: Manrope, Arial, sans-serif;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  /* Pinned, not vh-sized: dvh mis-measures in the PWA webview and leaves
   * a body strip below the shell. Fixed inset always fills the window. */
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  display: block;
}

.map-panel {
  position: relative;
  height: 100%;
  background: #d9e8f5;
  isolation: isolate;
  overflow: hidden;
}

.live-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.map-topbar,
.content-header {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.map-topbar {
  padding: calc(28px + env(safe-area-inset-top, 0px)) 30px 28px;
}

/* Top-right cluster: Areas -> Tiles -> User, pinned right of the map */
.top-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.map-topbar .header-counts {
  align-items: center;
  padding: 5px 8px;
  background: rgba(248, 247, 242, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(21, 73, 60, 0.12);
}

.map-topbar .count-panel { padding: 0 5px; gap: 3px; }

.map-topbar .count-box {
  min-width: 30px;
  height: 27px;
  padding: 0 7px;
  font-size: 13px;
  border-radius: 8px;
}

.map-topbar .box-sublabel { display: none; }

.map-topbar .count-divider { margin: 1px 2px; }

.brand {
  color: var(--navy);
  font: 700 22px Manrope, sans-serif;
  text-decoration: none;
  letter-spacing: -0.04em;
  display: flex;
  align-items: center;
  gap: 7px;
}

.brand-logo {
  display: block;
  object-fit: contain;
}

.map-topbar .brand-logo { height: 64px; width: auto; }

.auth-brand {
  display: block;
  margin-bottom: 18px;
}

.auth-brand .brand-logo { width: 168px; height: auto; }



.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(16, 54, 54, 0.35);
  background: #f5c76a;
  color: #153434;
  font-size: 12px;
  font-weight: 800;
}

.map-controls {
  position: absolute;
  z-index: 3;
  right: 24px;
  top: calc(140px + env(safe-area-inset-top, 0px));
  display: grid;
  gap: 9px;
}

.map-control {
  border: 0;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: rgba(248, 247, 242, 0.92);
  color: var(--navy);
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(21, 73, 60, 0.12);
  display: grid;
  place-items: center;
}

.map-legend {
  position: absolute;
  z-index: 3;
  left: 24px;
  top: 88px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Diagnostic readouts (V0 transient tuning). Top-left stack.
 * Superadmin gets both; admin gets zoom only. */
.zoom-level {
  position: absolute;
  z-index: 3;
  left: 24px;
  top: calc(88px + env(safe-area-inset-top, 0px));
  background: rgba(23, 54, 104, 0.85);
  color: #fff;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.tilt-level {
  position: absolute;
  z-index: 3;
  left: 24px;
  top: calc(118px + env(safe-area-inset-top, 0px));
  background: rgba(23, 54, 104, 0.85);
  color: #fff;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* Superadmin only (tilt pill exists): the diagnostics button stacks under
 * the zoom + tilt pills on the left instead of the right edge. */
.map-panel:has(#tiltLevel) .map-controls {
  left: 24px;
  right: auto;
  top: calc(152px + env(safe-area-inset-top, 0px));
}

/* Quest maker dock: admin+ only, left column. Default (admin) sits under
 * the logo/pills; superadmin (tilt pill present, diagnostics at 152px)
 * stacks below the diagnostics button. */
.quest-dock {
  position: absolute;
  z-index: 3;
  left: 24px;
  top: calc(152px + env(safe-area-inset-top, 0px));
  display: grid;
  gap: 9px;
}

.quest-dock[hidden] { display: none !important; }

.map-panel:has(#tiltLevel) .quest-dock {
  top: calc(204px + env(safe-area-inset-top, 0px));
}

.quest-dock .map-control.armed {
  background: var(--navy);
  color: #fff;
}

/* Quest mode card: caption, muted pill, blank expanded detail. */
.quest-caption {
  position: absolute;
  top: 10px;
  left: 14px;
  z-index: 2;
  font: 700 9px "DM Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
  line-height: 1;
}

.quest-caption[hidden] { display: none !important; }

.tile-state-pill.muted {
  opacity: 0.45;
  filter: grayscale(0.6);
}

/* Quest builder: the expanded quest card shows only the quest list —
 * every regular section stays buried no matter the rule order. */
.bottom-card.quest-mode.expanded .detail-content {
  display: block;
  flex: 1;
  min-height: 0;
}

.bottom-card.quest-mode.expanded .detail-content > :not(.quest-build-block) {
  display: none !important;
}

.quest-build-block { min-width: 0; }

.quest-build-block[hidden] { display: none !important; }

.quest-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.quest-list > * { min-width: 0; }

.qempty {
  font-size: 12px;
  font-weight: 600;
  color: #8a9aa8;
  padding: 4px 2px;
}

.qrow {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.qrow-main {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  min-width: 0;
}

.qrow-main > * { min-width: 0; }

.qrow-main > .qpill,
.qrow-main > .qrow-nameedit { min-width: auto; }

.qrow-toggle {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
}

.qrow-toggle[hidden] { display: none !important; }

/* Name Edit sits left of the status pill on open rows. */
.qrow-nameedit {
  flex: none;
  border: 1px solid #8fd0f2;
  background: #fff;
  color: #2a69aa;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 800;
}

.qrow-nameedit[hidden] { display: none !important; }

/* Name-editing: the status pill collapses to a same-color dot. */
.qpill.dot {
  font-size: 0;
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
}

.qname-row[hidden] { display: none !important; }

.qname-cancel {
  flex: none;
  border: 1px solid #cfd8de;
  background: #fff;
  color: var(--navy);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 800;
}

.qrow-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.qpill {
  flex: none;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 4px 10px;
}

.qpill.launched { background: #5cc581; color: #fff; }
.qpill.draft { background: #8fd0f2; color: #3a4b5e; }
.qpill.finished { background: #e8a33d; color: #3a4b5e; }

.qrow-detail {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.qrow-detail > * { min-width: 0; }

.qrow-detail[hidden] { display: none !important; }

.qmean {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: #5b6b7a;
}

.qactions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  min-width: 0;
}

.qactions > * { min-width: 0; }

.qact {
  flex: 1;
  min-width: 0;
  border-radius: 10px;
  padding: 9px 8px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--navy);
  background: #fff;
  color: var(--navy);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.qact.primary {
  background: var(--navy);
  color: #fff;
}

.qact.danger {
  border-color: #e53935;
  color: #b0322b;
}

.obj-del {
  flex: none;
  border: 1px solid #e53935;
  background: #fff;
  color: #b0322b;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 800;
}

.obj-del:disabled { opacity: 0.5; }

/* Quest objectives: entry card (field + tool pick + save), then the
 * radio list of saved objective cards. */
.obj-sec-label {
  margin-top: 4px;
  font: 700 9px "DM Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6e8278;
  line-height: 1;
}

.obj-entry {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  background: #f7f9fd;
  border-radius: 12px;
  padding: 10px;
  min-width: 0;
}

.obj-entry > * { min-width: 0; }

.obj-entry[hidden] { display: none !important; }

/* Quest row name editor (drafts + Edit-toggled rows). */
.qname-row {
  display: flex;
  gap: 8px;
}

.qname-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d8e3ee;
  background: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  outline-color: #4c8fcf;
}

.qname-save {
  flex: none;
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.qname-save:disabled { opacity: 0.5; }

/* Read-only objective lists: entry + row edits hide, radios stay live. */
.obj-locked .obj-entry,
.obj-locked .obj-edit,
.obj-locked .obj-del,
.obj-locked .obj-roles { display: none !important; }

/* Quest card breathing room: status clears the chevron corner. */
.bottom-card.quest-mode .tile-sub-row {
  padding-right: 48px;
}

.obj-entry input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid #d8e3ee;
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  outline-color: #4c8fcf;
}

.obj-entry input::placeholder {
  color: #9fb0c3;
  font-weight: 600;
}

.obj-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  min-width: 0;
}

.obj-tools > * { min-width: 0; }

.obj-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 4px;
  color: #2a69aa;
  font-size: 11px;
  font-weight: 800;
  min-width: 0;
  overflow-wrap: anywhere;
}

.obj-tool.selected {
  border-color: var(--navy);
  background: #e0effd;
  color: var(--navy);
}

.obj-entry-foot {
  display: flex;
  gap: 8px;
}

.obj-cancel {
  flex: 1;
  border: 1px solid #cfd8de;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--navy);
}

.obj-cancel[hidden] { display: none !important; }

.obj-save {
  flex: 2;
  border: 0;
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  font-weight: 800;
  background: var(--navy);
  color: #fff;
}

.obj-save:disabled { opacity: 0.5; }

.obj-list {
  display: grid;
  gap: 8px;
}

.obj-row {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
  max-width: 100%;
}

.obj-row > * { min-width: 0; }

.obj-row > .obj-radio,
.obj-row > .obj-tool-tag,
.obj-row > .obj-pin,
.obj-row > .obj-edit,
.obj-row > .obj-del,
.obj-row > .obj-role,
.obj-row > .obj-roles { min-width: auto; }

.obj-radio {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--navy);
  background: #fff;
  padding: 0;
}

.obj-radio.on {
  background: var(--navy);
  box-shadow: inset 0 0 0 3px #fff;
}

.obj-text {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.obj-tool-tag {
  flex: none;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 9px;
  background: #e2effb;
  color: #2a69aa;
}

.obj-edit {
  flex: none;
  border: 1px solid #8fd0f2;
  background: #fff;
  color: #2a69aa;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 800;
}

/* Quest search: separate floating container riding the quest card top. */
.search-bar {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  display: flex;
  gap: 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
  pointer-events: none;
}

.search-bar[hidden] { display: none !important; }

.search-bar > * { pointer-events: auto; }

.search-bar input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  outline-color: #4c8fcf;
  box-shadow: 0 4px 16px rgba(21, 73, 60, 0.12);
}

.search-bar input::placeholder {
  color: #9fb0c3;
  font-weight: 600;
}

.search-bar button {
  flex: none;
  border: 0;
  border-radius: 12px;
  padding: 10px 18px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(21, 73, 60, 0.12);
}

/* Live Explore pill: lives in the toolbar, above the card. */
.map-tracking {
  box-shadow: 0 4px 16px rgba(21, 73, 60, 0.12);
}

.legend-chip {
  background: rgba(248, 247, 242, 0.9);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.swatch.fog {
  background: #3a4b5e;
}
.swatch.activated {
  background: #8fd0f2;
}
.swatch.cleared {
  background: #5cc581;
}

.map-control svg {
  display: block;
}

.map-control.active {
  background: var(--navy);
  color: #fff;
}

/* Sandbox joystick pad: bottom-left, above the summary card. */
.joystick {
  position: absolute;
  z-index: 3;
  left: 24px;
  bottom: calc(210px + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 8px;
  justify-items: center;
}

.joystick[hidden] {
  display: none;
}

.joy-base {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(248, 247, 242, 0.92);
  box-shadow: 0 4px 16px rgba(21, 73, 60, 0.12);
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: pointer;
}

.joy-nub {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 2px 8px rgba(17, 47, 80, 0.35);
}

.joy-tag {
  margin: 0;
  font: 700 9px "DM Mono", monospace;
  letter-spacing: 0.08em;
  color: #fff;
  background: rgba(23, 54, 104, 0.8);
  padding: 3px 8px;
  border-radius: 999px;
}

/* Card dock: bottom-anchored column. The float stack (recenter + Explore
 * Live) rides directly above the card and follows it as it expands. */
.card-dock {
  position: absolute;
  z-index: 4;
  left: 12px;
  right: 12px;
  /* Floor: average phone is 360–430 CSS px wide — the card never
   * collapses below 320px no matter how small the card gets. */
  min-width: 320px;
  /* Flush to the edge over live map: the home indicator floats over the
   * card instead of a solid bar sitting below it. */
  bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  pointer-events: none;
}

.card-dock > * { pointer-events: auto; }

/* Toolbar: media + Live Explore + recenter in one transparent container,
 * pinned above the collapsed card. The card layers above it, so an
 * expanding card slides over and covers it. */
.tool-bar {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  box-shadow: none;
  pointer-events: none;
}

.tool-bar > * { pointer-events: auto; }

.tool-bar[hidden] { display: none !important; }

/* Floating voice recorder: pinned above the toolbar, never inside or
 * under the card. The card neither opens nor covers it. */
.voice-panel {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  pointer-events: auto;
}

.voice-panel[hidden] { display: none !important; }

.voice-panel .capture-area {
  margin-top: 0;
  box-shadow: 0 10px 30px rgba(15, 64, 54, 0.22);
}

.tool-bar .capture-rail {
  align-items: flex-start;
}

.tool-bar .tool-recenter {
  margin-left: auto;
}

.bottom-card {
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(248, 247, 242, 0.94);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 64, 54, 0.16);
  backdrop-filter: blur(8px);
  max-height: calc(100% - 170px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* No scope for horizontal scrolling anywhere in the card: content
   * resizes to the card, never bleeds past its right edge. */
  overflow-x: clip;
  min-width: 0;
}

.card-handle {
  display: flex;
  justify-content: center;
  padding: 8px 0 0;
  flex: none;
}

.card-handle span {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: #d9e2ee;
}

.map-summary {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 17px 16px;
  cursor: pointer;
  flex: none;
}

.summary-text {
  flex: 1;
  min-width: 0;
}

.detail-content {
  display: none;
  overflow-y: auto;
  overflow-x: clip;
  overscroll-behavior: contain;
  padding: 4px 17px 20px;
  border-top: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

.bottom-card.expanded .detail-content {
  display: block;
}

@media (min-width: 700px) {
  .card-dock {
    left: 25px;
    right: auto;
    width: min(430px, calc(100vw - 50px));
  }
}

.eyebrow {
  margin: 0 0 5px;
  color: #6e8278;
  font: 500 10px "DM Mono", monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.territory-title {
  margin: 0;
  font: 800 18px Manrope, sans-serif;
  letter-spacing: -0.02em;
}

.title-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

/* My City header: title stack top-left, counts flush right */
.city-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.city-header .header-counts {
  margin-left: auto;
}

.header-counts {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex: none;
  background: transparent;
  border: none;
  border-radius: 12px;
  padding: 7px 6px;
  box-shadow: none;
}

.count-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
}

.panel-title {
  font: 700 9px "DM Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6e8278;
  line-height: 1;
}

.count-divider {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  margin: 2px 4px;
}

.count-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.count-boxes {
  display: flex;
  gap: 6px;
}

.count-box {
  position: relative;
  min-width: 38px;
  height: 34px;
  padding: 0 10px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: 800 15px "DM Mono", monospace;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(16, 46, 74, 0.06);
}

.count-box.activated b {
  color: #8fd0f2;
}

.count-box.unlocked b {
  color: #5cc581;
}

.count-box.neutral b {
  color: var(--navy);
}

.box-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid rgba(248, 247, 242, 0.94);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04);
}

.box-dot.blue {
  background: #8fd0f2;
}

.box-dot.green {
  background: #5cc581;
}

.box-sublabel {
  font: 600 8px "DM Mono", monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6e8278;
  line-height: 1;
}

.count-label {
  font: 600 9px "DM Mono", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6e8278;
  line-height: 1;
}

.area-name {
  margin: 0;
  color: #667874;
  font: 600 12px Manrope, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.hex-line {
  margin: 1px 0 0;
  color: #8a9aa8;
  font: 500 10px "DM Mono", monospace;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Row 1: tile name + Save/Edit, clear of the chevron corner. */
.tile-info-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 0;
  /* Chevron occupies the card's top-right corner — keep the row short
   * of it so nothing runs underneath. */
  padding-right: 48px;
}

/* Row 2: info left (aligned to the name above), status hard right. */
.tile-sub-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.tile-sub-row .title-stack {
  min-width: 0;
  flex: 1;
}

/* Status rides the card's right edge: label right-aligned over the pill. */
.tile-sub-row .tile-status-block {
  margin-left: auto;
  align-items: flex-end;
}

.tile-sub-row .status-label {
  text-align: right;
}

.title-save[hidden] { display: none !important; }

/* Floating quest entry: anchored over the tapped tile (positioned from JS
 * by projecting the tile center). Visible in quest mode only, while the
 * card is collapsed. */
.quest-create-float {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -130%);
  border: 0;
  border-radius: 999px;
  padding: 10px 20px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(17, 47, 80, 0.35);
}

.quest-create-float[hidden] { display: none !important; }

/* Row 2: tile name field shares the row with the status block + button. */
.tile-info-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  outline-color: #4c8fcf;
}

.tile-info-row input::placeholder {
  color: #9fb0c3;
  font-weight: 600;
}

.title-save {
  flex: none;
  border: 1px solid var(--navy);
  border-radius: 10px;
  padding: 6px 12px;
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

/* Edit variant: sky blue border and text. */
.title-save.is-edit {
  background: #fff;
  border-color: #8fd0f2;
  color: #8fd0f2;
}

/* Saved title: title font in place of the field. */
.tile-title-display {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 9px 2px;
  font: 800 17px Manrope, sans-serif;
  letter-spacing: -0.02em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-title-display[hidden],
.tile-info-row input[hidden] { display: none !important; }

/* Locked/Activated stand-in: title font, lighter dark grey. */
.tile-title-message {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 9px 2px;
  font: 800 17px Manrope, sans-serif;
  letter-spacing: -0.02em;
  color: #6b7c8f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-title-message[hidden] { display: none !important; }

/* Persistent small-caps label over the state pill. */
.tile-status-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: none;
}

.status-label {
  font: 700 9px "DM Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6e8278;
  line-height: 1;
}

.title-dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.title-dialog-btn {
  flex: 1;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  font-weight: 800;
}

.title-dialog-btn.solid {
  border: 0;
  background: var(--navy);
  color: #fff;
}

.title-dialog-btn.ghost {
  border: 1px solid #cfd8de;
  background: #fff;
  color: var(--navy);
}

.tile-info-row .title-stack {
  min-width: 0;
  /* Don't grow: the pill clusters directly beside the tile info text
   * instead of being shoved to the card's right edge. */
  flex: 0 1 auto;
}

.tile-state-pill {
  flex: none;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 800;
}

.tile-state-pill[hidden] { display: none !important; }

.tile-state-pill.is-locked {
  background: #3a4b5e;
  color: #fff;
}

.tile-state-pill.is-active {
  background: #8fd0f2;
  color: #3a4b5e;
}

.tile-state-pill.is-open {
  background: #5cc581;
  color: #fff;
  border: 1px solid #5cc581;
}

/* Quest tile states: quest count in amber. */
.tile-state-pill.is-quests {
  background: #e8a33d;
  color: #3a4b5e;
  border: 1px solid #e8a33d;
}

/* Author display rules beat the UA [hidden] style — re-assert it so
 * Open tiles truly hide the countdown row + progress track. */
.countdown-row[hidden],
.progress-track[hidden] { display: none !important; }

.countdown-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  font-size: 11px;
  color: #667874;
  margin-bottom: 8px;
}

.countdown-text {
  flex: none;
  min-width: 0;
}

.countdown-text b {
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.countdown-row.unlocked .countdown-text {
  color: #1f8a4c;
  font-weight: 800;
}

.lock-icon {
  display: grid;
  place-items: center;
  flex: none;
  color: var(--navy);
}

.lock-icon svg {
  display: block;
}

.countdown-row.unlocked .lock-icon {
  color: #1f8a4c;
}

/* Legacy progress-row kept for expanded detail blocks (not the summary card) */
.progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #667874;
  margin-bottom: 8px;
}

.progress-track {
  height: 6px;
  background: #e4ece5;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

#tileProgressTrack {
  margin-top: 10px;
  width: 100%;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--deep-mint);
  transition: width 0.5s ease;
}

.progress-track.unlocked span {
  background: #5cc581;
}

.user-puck {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2a69aa;
  border: 3px solid #fff;
  box-shadow: 0 0 0 8px rgba(42, 105, 170, 0.18);
}

.content-header {
  gap: 20px;
  padding-top: 18px;
}

.content-header h1 {
  font: 600 clamp(33px, 4vw, 50px) / 1.04 Manrope, sans-serif;
  letter-spacing: -0.045em;
  margin: 0;
}

.status-pill {
  flex: none;
  display: flex;
  gap: 8px;
  align-items: center;
  color: #2568ab;
  background: #dceeff;
  border: 0;
  border-radius: 999px;
  padding: 10px 13px;
  font-size: 11px;
  font-weight: 700;
}

.status-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1f8a4c;
}

.status-pill.live i {
  background: #2ed67c;
  box-shadow: 0 0 10px 2px rgba(46, 214, 124, 0.9);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 38px 0 42px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line);
  background: #fffefa;
  border-radius: 15px;
  padding: 15px 13px;
}

.streak-card {
  background: #173d68;
  color: #fff;
  border-color: #173d68;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: #e4fff5;
  background: #2b5f94;
  font-size: 17px;
}

.stat-icon.mint {
  background: #deefff;
  color: #2a69aa;
}

.stat-icon.coral {
  background: #ffe2d9;
  color: #dc6755;
}

.stat-value {
  margin: 0;
  font-weight: 800;
  font-size: 17px;
  white-space: nowrap;
}

.stat-label {
  margin: 1px 0 0;
  color: #73817b;
  font-size: 10px;
  white-space: nowrap;
}

.streak-card .stat-label {
  color: #b3ccc1;
}

.section-block {
  border-top: 1px solid var(--line);
  padding: 29px 0;
}

#unlockingSection {
  border-top: none;
  padding-top: 8px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-heading h2 {
  font: 600 23px Manrope, sans-serif;
  letter-spacing: -0.035em;
  margin: 0;
}

.text-button {
  border: 0;
  background: transparent;
  color: #2568ab;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 0;
}

.next-unlock-card {
  display: flex;
  align-items: center;
  gap: 17px;
  padding: 17px;
  border-radius: 16px;
  background: #e4f0fb;
}

.mini-hex {
  width: 45px;
  height: 45px;
  clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%);
  display: grid;
  place-items: center;
  flex: none;
  color: #173d68;
  font-size: 18px;
  background: #9bdaff;
}

.unlock-copy {
  flex: 1;
}

.unlock-copy h3 {
  margin: 0 0 3px;
  font: 600 18px Manrope, sans-serif;
}

.unlock-copy p {
  margin: 0;
  color: #5d736b;
  font-size: 11px;
  line-height: 1.45;
}

.understood-button {
  margin-top: 16px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

.collapsed-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}

.collapsed-bar[hidden] { display: none !important; }

.collapsed-bar .info-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
}

.unlocking-content[hidden] { display: none !important; }

.dark {
  background: #cbdcec;
}

.dark span {
  background: #9bdaff;
}

.arrow-button {
  width: 33px;
  height: 33px;
  border: 0;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  font-size: 21px;
  display: grid;
  place-items: center;
}

.section-subtitle {
  margin: -8px 0 14px;
  color: #6e8278;
  font-size: 11px;
  line-height: 1.4;
}

.activity-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.activity-choice {
  aspect-ratio: 1;
  padding: 12px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.activity-choice:hover {
  transform: translateY(-2px);
  border-color: #a8caea;
  box-shadow: 0 6px 15px rgba(30, 80, 69, 0.08);
}

.activity-choice.muted,
.activity-choice:disabled {
  opacity: 0.35;
  filter: grayscale(0.6);
  cursor: not-allowed;
}

.activity-choice.muted:hover,
.activity-choice:disabled:hover {
  transform: none;
  border-color: var(--line);
  box-shadow: none;
}

.activity-choice b {
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.choice-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #e2effb;
  color: #2a69aa;
  font-weight: 800;
  flex: none;
}

.capture-area {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.capture-area[hidden] { display: none !important; }

.capture-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.capture-tab {
  border: 1px solid var(--line);
  background: #f7f9fd;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
}

.capture-tab.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.capture-close {
  margin-left: auto;
  border: 0;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
}

#photoPreview {
  width: 100%;
  max-height: 220px;
  background: #000;
  border-radius: 10px;
  object-fit: cover;
}

#photoThumb {
  width: 100%;
  max-height: 220px;
  border-radius: 10px;
  object-fit: cover;
}

.capture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.capture-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
}

.capture-btn.primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.capture-btn[hidden] { display: none !important; }

.capture-hint {
  color: #8a9aa8;
  font-size: 10px;
}

.voice-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-wave {
  flex: 1;
  height: 28px;
  border-radius: 8px;
  background: #e2effb;
  position: relative;
  overflow: hidden;
}

.voice-timer {
  font: 700 12px "DM Mono", monospace;
  font-variant-numeric: tabular-nums;
}

#voiceAudio { width: 100%; }

@media (max-width: 840px) {
  .activity-choices {
    grid-template-columns: repeat(3, 1fr);
  }
}

.outing-chip {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ffe2d9;
  color: #dc6755;
  font-size: 10px;
}

.outing-chip[hidden] {
  display: none;
}

.leaderboard {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 3px;
}

.leaderboard li {
  display: grid;
  grid-template-columns: 21px 27px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: 10px;
  font-size: 11px;
}

.leaderboard li.you {
  background: #e3f0fb;
}

.rank {
  color: #82908a;
  font: 500 10px "DM Mono", monospace;
}

.avatar {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
}

.violet {
  background: #6e66a9;
}
.gold {
  background: #cd9f42;
}
.user {
  background: #2a69aa;
}
.person {
  font-weight: 700;
}
.person small {
  display: inline;
  margin-left: 5px;
  color: #82908a;
  font-size: 9px;
  font-weight: 500;
}
.leaderboard li b {
  font: 700 12px "DM Mono", monospace;
}

.data-credit {
  margin: 18px 0 4px;
  color: #84908a;
  font-size: 9px;
  line-height: 1.5;
}

.dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 510px;
  width: calc(100% - 32px);
}

.dialog::backdrop {
  background: rgba(12, 38, 70, 0.48);
  backdrop-filter: blur(3px);
}

.dialog-card {
  position: relative;
  background: #fbfaf5;
  border-radius: 24px;
  padding: 31px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.25);
}

.dialog-card h2 {
  font: 600 32px Manrope, sans-serif;
  letter-spacing: -0.04em;
  margin: 0 0 6px;
}

.dialog-copy {
  color: #687b90;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 23px;
}

.dialog-close {
  position: absolute;
  right: 15px;
  top: 13px;
  border: 0;
  background: transparent;
  font-size: 25px;
  color: #6e8499;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin: 16px 0 8px;
}

.field-label small {
  font-weight: 500;
  color: #84908a;
}

.field-label input {
  display: block;
  width: 100%;
  border: 1px solid #d8e3ee;
  background: white;
  border-radius: 10px;
  padding: 12px;
  margin-top: 7px;
  outline-color: #4c8fcf;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.category {
  border: 1px solid #dde6f0;
  background: white;
  border-radius: 9px;
  padding: 10px 8px;
  color: #60758b;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
}

.category.selected {
  border-color: #397fc3;
  background: #e0effd;
  color: #2568ab;
}

.primary-button {
  margin-top: 24px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  background: #173668;
  color: white;
  font-weight: 800;
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 25px;
  transform: translate(-50%, 130px);
  opacity: 0;
  transition: 0.35s;
  background: #173668;
  color: white;
  padding: 12px 17px;
  border-radius: 999px;
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
  font-size: 12px;
  font-weight: 700;
  max-width: min(520px, calc(100% - 24px));
}

.pwa-banner {
  position: fixed;
  z-index: 9;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  gap: 10px;
  background: #173668;
  color: #fff;
  padding: 10px 12px 10px 16px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15,64,54,0.22);
  font-size: 12px;
  font-weight: 700;
}

.pwa-banner[hidden] { display: none; }

.pwa-install {
  margin-left: auto;
  border: 0;
  background: #fff;
  color: #173668;
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 11px;
}

.pwa-dismiss {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  padding: 4px 6px;
}

/* Fullscreen camera */
.cam-sheet {
  border: 0;
  padding: 0;
  margin: 0;
  max-width: 100vw;
  max-height: 100%;
  width: 100vw;
  height: 100%;
  background: #000;
  color: #fff;
}

.cam-sheet::backdrop { background: #000; }

.cam-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: linear-gradient(rgba(0,0,0,0.5), transparent);
}

.cam-toggle {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.16);
  border-radius: 999px;
  padding: 3px;
}

.cam-tab {
  border: 0;
  background: transparent;
  color: #fff;
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 700;
}

.cam-tab.active { background: #fff; color: #000; }

.cam-close {
  position: absolute;
  right: 12px;
  top: calc(12px + env(safe-area-inset-top, 0px));
  border: 0;
  background: rgba(255,255,255,0.16);
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
}

#camPreview, #camReview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#camReview[hidden] { display: none !important; }

.cam-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 18px 16px calc(22px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
}

.cam-shutter {
  width: 68px; height: 68px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  flex: none;
}

.cam-shutter.recording { background: #e5484d; }

.cam-flip, .cam-retake {
  border: 0;
  background: rgba(255,255,255,0.16);
  color: #fff;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 800;
}

.cam-save {
  border: 0;
  background: #fff;
  color: #000;
  border-radius: 999px;
  padding: 12px 26px;
  font-weight: 800;
  font-size: 14px;
}

.cam-save[hidden], .cam-retake[hidden] { display: none !important; }

/* Tile gallery */
.tile-gallery {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tile-gallery[hidden] { display: none !important; }

.tile-gallery .g-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: #e4ece5;
  border: 0;
  padding: 0;
  overflow: hidden;
}

.tile-gallery .g-thumb.voice-thumb {
  display: grid;
  place-items: center;
  background: #e2effb;
  color: #2a69aa;
  cursor: pointer;
}

.tile-gallery .g-thumb.voice-thumb svg {
  display: block;
}

/* Gallery header + select/delete */
.gallery-bar {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gallery-bar[hidden] { display: none !important; }

.gallery-count {
  font-size: 12px;
  font-weight: 700;
  color: #5b6b7a;
}

.gallery-select {
  border: 1px solid #cfd8de;
  background: #fff;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 800;
  color: #173668;
}

/* Screen-fixed user puck: sky-blue dot, white border, dims on browse */
#userPuck {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: #4aa8dd;
  border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,0.45);
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#userPuck.dimmed { opacity: 0.3; }

/* Attention loop: 2s bounce then 2s pulse at full visibility */
#userPuck.bouncing { animation: puck-bounce 0.5s ease-in-out 4; }

#userPuck.pulsing { animation: puck-pulse 1s ease-in-out 2; }

/* Drop-blip mode: amber dot, rapid pulse while the maker pans the map. */
#userPuck.dropping {
  background: #e8a33d;
  animation: puck-drop 0.45s ease-in-out infinite;
}

@keyframes puck-drop {
  0%, 100% { transform: scale(1); box-shadow: 0 1px 6px rgba(0,0,0,0.45); }
  50% { transform: scale(1.45); box-shadow: 0 0 0 10px rgba(232,163,61,0.4); }
}

/* Drop Blip overlay: floats over the pulsing dot at screen center. */
#dropBlipWrap {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, 34px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  z-index: 60;
}

#dropBlipWrap[hidden] { display: none !important; }

#dropBlipBtn {
  border: 0;
  border-radius: 999px;
  padding: 12px 26px;
  background: #e8a33d;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

#dropBlipCancel {
  border: 0;
  background: rgba(20,30,45,0.65);
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
}

/* Navigation pin block inside the objective entry. */
.obj-navblock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  background: #fdf6ea;
  border: 1px dashed #e8a33d;
  border-radius: 12px;
  padding: 10px 12px;
}

.obj-navblock[hidden] { display: none !important; }

.obj-navhint {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #8a6a2b;
}

.obj-markbtn {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: #e8a33d;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.obj-pinchip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  background: #e8a33d;
  color: #fff;
  border-radius: 999px;
  padding: 5px 6px 5px 12px;
  font-size: 11px;
  font-weight: 800;
}

.obj-pinchip[hidden] { display: none !important; }

.obj-pinclear {
  border: 0;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  background: rgba(255,255,255,0.3);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

/* Amber blip marker on objective rows carrying an exact location. */
.obj-pin {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e8a33d;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.obj-pin.main { background: #e8a33d; }
.obj-pin.trail { background: #2fbf71; }
.obj-pin.end { background: #e53935; }
/* True half-amber / half-red for the combined Main+End dot. */
.obj-pin.main_end {
  background: linear-gradient(90deg, #e8a33d 0 50%, #e53935 50% 100%);
}

/* Blip role chips (editable rows) + tags (read-only rows). */
.obj-roles {
  flex: none;
  display: inline-flex;
  gap: 6px;
}

.obj-role {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 800;
  background: #fff;
  min-width: 0;
}

.obj-role.main { border: 1px solid #e8a33d; color: #9a6b1d; }
.obj-role.main.on { background: #e8a33d; color: #fff; }
.obj-role.end { border: 1px solid #e53935; color: #b0322b; }
.obj-role.end.on { background: #e53935; color: #fff; }

.blip-tag.main { background: #fbeed3; color: #9a6b1d; }
.blip-tag.trail { background: #dcf3e5; color: #1e7a45; }
.blip-tag.end { background: #fbdcdc; color: #b0322b; }
.blip-tag.main_end {
  background: linear-gradient(90deg, #fbeed3 0 50%, #fbdcdc 50% 100%);
  color: #6b4a1f;
}

@keyframes puck-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes puck-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 1px 6px rgba(0,0,0,0.45); }
  50% { transform: scale(1.3); box-shadow: 0 0 0 8px rgba(74,168,221,0.35); }
}

/* Sheet arrow: top-right of the card. Up = collapsed, down = open. */
.sheet-arrow {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  display: grid;
  place-items: center;
  padding: 0;
}

.sheet-arrow svg { transition: transform 0.2s ease; }

.bottom-card.expanded .sheet-arrow svg { transform: rotate(180deg); }

/* Capture rail: compact buttons left of the tile info */
.capture-rail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  flex: none;
}

/* Title row: buttons only (tile info lives inside the card) */
.city-header {
  align-items: flex-start;
  padding-right: 36px;
}

.detail-titles { margin: 2px 0 12px; }

.city-header .title-stack {
  margin-left: 0;
  text-align: left;
  align-items: flex-start;
  min-width: 0;
}

.capture-rail .outing-chip { margin-left: 0; }

.capture-rail .activity-choices {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

/* Icon containers equal-sized; labels sit outside, below each button */
.capture-rail .choice-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 64px;
}

.capture-rail .choice-item > b {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
}

.capture-rail .activity-choice {
  width: 52px;
  height: 52px;
  aspect-ratio: auto;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* White containers, blue glyphs */
.capture-rail .choice-icon {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  background: #fff;
  border: 1px solid var(--line);
  color: #2a69aa;
}

.capture-rail .choice-icon svg {
  width: 20px;
  height: 20px;
}

/* Voice + gallery fill the collapsed card under the title row */
.memory-block { margin-top: 10px; }

.memory-block .capture-area { margin-top: 0; }
.memory-block .tile-gallery { margin-top: 10px; }

.tile-gallery .g-item { position: relative; }

.tile-gallery .g-item .g-thumb { display: block; }

.tile-gallery .g-item.selected .g-thumb {
  outline: 3px solid #2a69aa;
  outline-offset: -3px;
}

.g-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.g-play svg {
  background: rgba(0,0,0,0.45);
  border-radius: 50%;
  padding: 7px;
  box-sizing: content-box;
}

.g-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  font-weight: 800;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
}

.g-del.armed { background: #c0392b; }

/* Missing-file references: honest placeholder, not a spinner. */
.g-item.missing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  background: #f3ede2;
  border: 1px dashed #c9bfae;
  border-radius: 12px;
}

.g-missing-label {
  font-size: 11px;
  font-weight: 800;
  color: #8a7a5f;
}

.vslab.missing { opacity: 0.75; }

.g-item.selecting .g-del { display: none; }

.g-check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(0,0,0,0.35);
  display: none;
  place-items: center;
}

.g-item.selecting .g-check { display: grid; }

.g-item.selected .g-check {
  background: #2a69aa;
  border-color: #2a69aa;
}

.gallery-deletebar {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.gallery-deletebar[hidden] { display: none !important; }

.gallery-cancel {
  flex: 1;
  border: 1px solid #cfd8de;
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  font-size: 13px;
  font-weight: 800;
  color: #173668;
}

.gallery-delete {
  flex: 2;
  border: 0;
  border-radius: 10px;
  padding: 8px;
  font-size: 13px;
  font-weight: 800;
  background: #f3d7d2;
  color: #a93226;
}

.gallery-delete:disabled { opacity: 0.45; }

.gallery-delete.armed {
  background: #c0392b;
  color: #fff;
}

/* Voice gallery: one long slab per note with its waveform on it. */
.voice-gallery {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.voice-gallery[hidden] { display: none !important; }

.vsec-head {
  font: 700 9px "DM Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6e8278;
  line-height: 1;
  padding: 2px 2px 0;
}

.vslab {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.vslab-main {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 12px 40px 12px 12px;
  text-align: left;
}

.vslab-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 13px;
  background: #e2effb;
  color: #2a69aa;
}

.vslab-meta {
  flex: none;
  min-width: 0;
  max-width: 96px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vslab-meta b {
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vslab-meta small {
  font: 500 10px "DM Mono", monospace;
  color: #8a9aa8;
}

.vslab-wave {
  flex: 1;
  min-width: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}

.vslab-wave span {
  width: 3px;
  min-height: 3px;
  height: 4px;
  border-radius: 2px;
  background: #2a69aa;
  opacity: 0.55;
  flex: none;
}

.vslab-dur {
  flex: none;
  font: 700 11px "DM Mono", monospace;
  font-variant-numeric: tabular-nums;
  color: #5b6b7a;
}

.vslab-del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  font-weight: 800;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
}

.vslab-del.armed { background: #c0392b; }

/* Inline player: attached right under its slab. */
.vslab-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #f7f9fd;
}

.vslab-player[hidden] { display: none !important; }

.vslab-pbtn {
  flex: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 11px;
  font-weight: 800;
  color: var(--navy);
}

.vslab-pbtn.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.vslab-track {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: #e4ece5;
  overflow: hidden;
  cursor: pointer;
}

.vslab-track span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--deep-mint);
  border-radius: inherit;
}

.vslab-time {
  flex: none;
  font: 700 11px "DM Mono", monospace;
  font-variant-numeric: tabular-nums;
  color: #5b6b7a;
}

/* Media viewer */
.viewer {
  border: 0;
  padding: 0;
  margin: 0;
  max-width: 100vw;
  max-height: 100%;
  width: 100vw;
  height: 100%;
  background: #000;
}

.viewer::backdrop { background: rgba(0,0,0,0.92); }

.viewer-close { z-index: 2; }

.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  border: 0;
  background: rgba(255,255,255,0.16);
  color: #fff;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  font-weight: 800;
}

.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
.viewer-nav[hidden] { display: none !important; }

.voice-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
}

.voice-wave span {
  width: 3px;
  min-height: 3px;
  height: 4px;
  border-radius: 2px;
  background: #2a69aa;
  flex: none;
}

#viewerImg, #viewerVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

#viewerImg[hidden], #viewerVideo[hidden] { display: none !important; }

/* Custom video player: center transport, seek ~26% from bottom,
   vertical volume at the right edge. Chrome fades as one group. */
.viewer-video-wrap {
  position: absolute;
  inset: 0;
  background: #000;
}

.viewer-video-wrap[hidden] { display: none !important; }

.v-chrome {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.viewer-video-wrap.visible .v-chrome { opacity: 1; }

.v-chrome button,
.v-chrome input { pointer-events: auto; }

.v-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 20px;
}

.v-btn {
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 0;
}

.v-btn.play {
  width: 68px;
  height: 68px;
  background: rgba(255,255,255,0.24);
}

.v-seek {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 26%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.v-seek input[type="range"] {
  flex: 1;
  accent-color: #fff;
}

.v-time {
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  min-width: 36px;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.v-vol {
  position: absolute;
  right: 14px;
  bottom: 8%;
}

.v-vol input[type="range"] {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 30px;
  height: 120px;
  accent-color: #fff;
}

#viewerAudio[hidden] { display: none !important; }

.audio-player {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, 86vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.audio-player[hidden] { display: none !important; }

.audio-wave {
  position: relative;
  width: 100%;
  height: 96px;
  border-radius: 12px;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 12px;
  overflow: hidden;
}

.audio-wave span.bar {
  width: 3px;
  min-height: 3px;
  height: 4px;
  border-radius: 2px;
  background: #fff;
  flex: none;
}

.audio-remain {
  position: absolute;
  right: 8px;
  bottom: 6px;
  color: #fff;
  font: 700 11px "DM Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.audio-controls {
  display: flex;
  gap: 8px;
}

.audio-btn {
  border: 1px solid rgba(255,255,255,0.4);
  background: transparent;
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.audio-btn svg { display: block; }

.voice-wave span {
  opacity: 0.3;
}

.voice-wave span.played {
  opacity: 1;
}

.audio-wave span.bar {
  opacity: 0.35;
}

.audio-wave span.bar.played {
  opacity: 1;
}

.audio-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.25);
  overflow: hidden;
  cursor: pointer;
}

.audio-track span {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
  border-radius: inherit;
}

.audio-time {
  color: #fff;
  font: 700 12px "DM Mono", monospace;
  font-variant-numeric: tabular-nums;
}

/* Location gate */
.gate-dialog {
  max-width: 420px;
  width: calc(100% - 32px);
}

.gate-card {
  text-align: center;
  padding: 28px 24px 22px;
}

.gate-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #e2effb;
  color: #2a69aa;
}

.gate-state h2 {
  text-align: center;
}

.gate-privacy {
  margin: 12px 0 0;
  color: #8a9aa8;
  font-size: 10px;
  line-height: 1.4;
}

.gate-error {
  margin: 10px 0 0;
  color: #a93226;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.gate-error[hidden] { display: none !important; }

.gate-secondary {
  margin-top: 10px;
  width: 100%;
  text-align: center;
  padding: 10px;
}

.gate-cards {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  text-align: left;
}

.city-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
}

.city-card b { font-size: 14px; }
.city-card small { display: block; color: #8a9aa8; font-size: 11px; margin-top: 2px; }
.city-card span:last-child { color: var(--navy); font-weight: 800; font-size: 12px; }

.toast.visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.stat-icon svg,
.choice-icon svg,
.mini-hex svg,
.arrow-button svg,
.primary-button svg {
  display: block;
}

.primary-button svg {
  flex: none;
}

@media (max-width: 840px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 22px 0 26px;
  }
  .stat-card {
    padding: 12px 10px;
  }
}
