/* SKAT map app: frame, header, dock, sheet, spot content, markers.
   Tokens, buttons, inputs, chips, toast and the confirm dialog live in ui.css. */

html { background: var(--wash); }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { background: var(--wash); }

/* one fixed frame sized by JS (--app-h) so nothing is cut off at the bottom of iPhones */
#app { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: var(--app-h, 100vh); overflow: hidden; }
#map { position: absolute; inset: 0; }
.maplibregl-ctrl-bottom-right { bottom: var(--sab); }
.maplibregl-canvas { outline: 0; }

/* floating controls over the map */
.glass {
  background: rgba(255, 255, 255, .8);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: var(--sh-float), inset 0 0 0 1px var(--line);
}
.ico.glass:hover { background: rgba(255, 255, 255, .96); }

/* ---------- header ---------- */
.top {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--sat) + 14px) var(--gutter) 0;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.top > .brand { align-self: flex-start; }
.logo { font-size: 28px; font-weight: var(--fw-semi); letter-spacing: -.05em; line-height: 1; }
.tick { margin-top: var(--s1); font-size: var(--fs-xs); color: var(--mute); font-variant-numeric: tabular-nums; }

.acct { position: absolute; top: calc(var(--sat) + 14px); right: var(--gutter); font-weight: var(--fw-semi); }

.chips {
  display: flex;
  gap: var(--s2);
  margin: 0 calc(var(--gutter) * -1);
  padding: var(--s3) var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}

/* shown while adding a spot, in place of the chips */
.hint {
  display: none;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: var(--s3);
  margin-top: var(--s3);
  padding: var(--s4);
  border-radius: var(--r-3);
}
.hint b { display: block; font-weight: var(--fw-semi); }
.hint p { font-size: var(--fs-s); color: var(--mute); line-height: 1.35; }
.hint .input { grid-column: 1 / -1; }
.adding .hint { display: grid; }
.adding .chips { display: none; }

/* ---------- dock ---------- */
.dock {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: calc(var(--sab) + 18px);
  width: max-content;
  display: flex;
  gap: var(--s2);
  padding: var(--s2);
  border-radius: var(--r-pill);
  transform: translateX(-50%);
  transition: transform var(--t-3) var(--ease);
}
.dock .btn { border-radius: var(--r-pill); } /* concentric with the capsule */
.sheet-open .dock, .adding .dock { transform: translate(-50%, 180%); }

/* ---------- bottom sheet (mobile) / side panel (desktop) ---------- */
.sheet {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  height: 92%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-radius: var(--r-3) var(--r-3) 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .12);
  transform: translateY(105%);
  transition: transform var(--t-3) var(--ease);
}
.sheet.open { transform: translateY(var(--y, 50%)); }
.sheet.drag { transition: none; }
.grab { flex: none; height: 28px; display: grid; place-items: center; touch-action: none; cursor: grab; }
.grab i { width: 36px; height: 5px; border-radius: var(--r-pill); background: var(--line-strong); }
.x {
  position: absolute;
  top: var(--s3);
  right: var(--s3);
  z-index: 2;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .16), inset 0 0 0 1px var(--line);
}
.sb { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 0 var(--gutter) calc(var(--sab) + var(--s6)); }

/* rhythm inside the sheet: sections 24px apart, related items 8-12px */
.sb .label { margin-top: var(--s5); }
.sb .input { margin-top: var(--s3); }
.sb .seg { margin-top: var(--s4); }
.sb > :first-child { margin-top: 0; }
.sb > .h2 { padding-right: var(--s7); } /* keep clear of the close button */
.sb > .h2 + .addr { margin-top: var(--s2); }
.sb summary { margin: var(--s4) 0 var(--s2); font-size: var(--fs-s); font-weight: var(--fw-medium); color: var(--mute); cursor: pointer; }
.addr { color: var(--mute); }
.actions { display: grid; gap: var(--s3); margin-top: var(--s5); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-top: var(--s3); }
.split .input { margin-top: 0; }

/* ---------- spot ---------- */
.gal { display: flex; gap: var(--s2); margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gal img { flex: none; width: 86%; height: 240px; object-fit: cover; border-radius: var(--r-2); scroll-snap-align: center; background: var(--wash); }
.ph { display: flex; justify-content: space-between; align-items: flex-end; height: 200px; padding: var(--s4) var(--s5); overflow: hidden; border-radius: var(--r-2); background: var(--wash); }
.ph b { font-size: 96px; font-weight: var(--fw-semi); letter-spacing: -.04em; line-height: .8; }
.ph span { font-size: var(--fs-xs); color: var(--mute); text-align: right; font-variant-numeric: tabular-nums; }

.ttl { display: flex; align-items: flex-start; gap: var(--s3); margin-top: var(--s5); }
.ttl .h2 { flex: 1; min-width: 0; }
.rate-line { margin-top: var(--s2); font-weight: var(--fw-medium); }
.rate-line svg { margin: -2px var(--s1) 0 0; vertical-align: middle; }
.rate-line + .addr { margin-top: var(--s1); }
.tags { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.meta { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin-top: var(--s3); font-size: var(--fs-s); color: var(--mute); }
.meta .stat { display: inline-flex; align-items: center; gap: 6px; }
.desc { margin-top: var(--s5); line-height: 1.55; }
.coords { font-weight: var(--fw-medium); line-height: 1.55; font-variant-numeric: tabular-nums; }
.coords.big { margin: var(--s1) 0 var(--s3); font-size: var(--fs-xl); font-weight: var(--fw-semi); letter-spacing: -.03em; line-height: 1.2; }

.rate { margin-top: var(--s5); padding-top: var(--s1); border-top: 1px solid var(--line); }
.stars { display: flex; margin: var(--s1) 0 0 -6px; }
.rate button { display: grid; place-items: center; width: 40px; height: 40px; }
.rate svg { width: 28px; height: 28px; fill: none; stroke: var(--faint); stroke-width: 1.6; stroke-linejoin: round; transition: fill var(--t-1), stroke var(--t-1), transform var(--t-1) var(--ease); }
.rate button.on svg { fill: var(--ink); stroke: var(--ink); }
.rate button:active svg { transform: scale(1.15); }
@media (hover: hover) { .rate button:not(.on):hover svg { stroke: var(--ink); } }

#cm-list { margin-top: var(--s2); }
.cm { padding: var(--s3) 0; border-top: 1px solid var(--line); }
.cm-h { display: flex; align-items: center; gap: var(--s2); }
.cm-h b { font-size: var(--fs-s); font-weight: var(--fw-semi); }
.cm-h .mute { flex: 1; font-size: var(--fs-xs); }
.cm-del, .cm-flag { position: relative; flex: none; display: grid; place-items: center; width: 32px; height: 32px; margin: -6px -6px -6px 0; border-radius: 50%; color: var(--mute); transition: background-color var(--t-1), color var(--t-1); }
.cm-del::after, .cm-flag::after { content: ""; position: absolute; inset: -6px; } /* 44px hit area */
@media (hover: hover) { .cm-del:hover, .cm-flag:hover { background: var(--wash); color: var(--ink); } }
.cm p { margin-top: var(--s1); line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.cm-empty { margin: var(--s1) 0 var(--s4); color: var(--mute); }
.btn.more { margin: var(--s3) 0 var(--s4); }
.compose { display: grid; gap: var(--s3); margin-top: var(--s3); }
.compose .input { margin-top: 0; }

/* ---------- forms ---------- */
.agree { display: flex; align-items: flex-start; gap: var(--s3); margin-top: var(--s4); font-size: var(--fs-s); color: var(--mute); line-height: 1.4; cursor: pointer; }
.agree input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }
.agree a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.thumbs { display: flex; gap: var(--s2); overflow-x: auto; }
.thumbs:not(:empty) { margin-top: var(--s2); }
.thumbs img { flex: none; width: 72px; height: 72px; object-fit: cover; border-radius: var(--r-1); animation: pop var(--t-3) var(--ease); }

/* ---------- playground: red pin, warning badge with tooltip ---------- */
.pgw { position: relative; flex: none; margin-top: -2px; }
.pgw-b { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-1); background: var(--red-wash); box-shadow: inset 0 0 0 1px var(--red-line); color: var(--red); cursor: help; }
.pgw-t {
  position: absolute;
  z-index: 5;
  top: calc(100% + var(--s2));
  right: 0;
  width: 240px;
  padding: var(--s3);
  border-radius: var(--r-1);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--fs-s);
  font-weight: var(--fw-medium);
  line-height: 1.4;
  letter-spacing: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity var(--t-1), transform var(--t-1), visibility var(--t-1);
}
.pgw.open .pgw-t, .pgw-b:focus-visible + .pgw-t { opacity: 1; visibility: visible; transform: none; }
@media (hover: hover) { .pgw:hover .pgw-t { opacity: 1; visibility: visible; transform: none; } }

/* ---------- map markers ---------- */
.sel { width: 24px; height: 24px; }
.sel i { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--ink); border: 4px solid var(--paper); box-shadow: 0 0 0 5px rgba(47, 43, 255, .22), 0 2px 8px rgba(0, 0, 0, .28); animation: pop var(--t-3) var(--ease); }
.sel.pg i { background: var(--red); box-shadow: 0 0 0 5px var(--red-line), 0 2px 8px rgba(0, 0, 0, .28); }
.me { width: 16px; height: 16px; border-radius: 50%; background: var(--signal); border: 3px solid var(--paper); box-shadow: 0 0 0 8px rgba(47, 43, 255, .16); }

/* ---------- splash ---------- */
#splash { position: absolute; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--ink); color: var(--paper); transition: opacity var(--t-3) .1s, visibility var(--t-3); }
#splash b { font-size: clamp(72px, 24vw, 160px); font-weight: var(--fw-semi); letter-spacing: -.06em; animation: fade-in .6s var(--ease) both; }
#splash.off { opacity: 0; visibility: hidden; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  :root { --gutter: 28px; }
  .top { flex-direction: row; align-items: center; gap: 40px; padding-top: calc(var(--sat) + 22px); }
  .acct { top: calc(var(--sat) + 22px); }
  .logo { font-size: 32px; }
  .chips { margin: 0; padding: 0; }
  .mid { flex: 1; min-width: 0; max-width: 680px; }
  .hint { grid-template-columns: auto 1fr auto; align-items: center; margin-top: 0; }
  .hint .input { grid-column: auto; margin-top: 0; order: 1; }
  .hint .ico { order: 2; }
  .grab { display: none; }
  .sb { padding-top: var(--s4); }
  .sheet { left: auto; right: var(--gutter); top: 96px; bottom: 44px; width: 420px; height: auto; border-radius: var(--r-3); box-shadow: var(--sh-surface); transform: translateX(calc(100% + var(--gutter) + 20px)); }
  .sheet.open { transform: none; }
  .dock { left: var(--gutter); transform: none; }
  .sheet-open .dock, .adding .dock { transform: translateY(180%); }
}
