.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: env(safe-area-inset-top, 0px) 16px 0;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.topbar__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 0 6px var(--parch), 0 0 12px var(--parch);
  white-space: nowrap;
}

.seal-btn {
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: radial-gradient(circle at 35% 30%, #b04a43, var(--wax) 60%, #5f1d1b);
  color: #f6e7c6;
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 2px 6px var(--shadow), inset 0 0 0 3px rgba(246, 231, 198, 0.25);
}

.seal-btn:active {
  transform: translateY(1px);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.seal-btn.is-spinning {
  animation: spin 0.9s linear infinite;
}

.zoom {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: right 0.25s ease;
}

body.panel-open .zoom {
  right: calc(var(--panel-w) + 32px);
}

@media (max-width: 760px) {
  .topbar {
    gap: 8px;
    padding: env(safe-area-inset-top, 0px) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  }

  .topbar__title {
    display: none;
  }

  body.panel-open .zoom {
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(var(--sheet-h, 52vh) + 20px);
    transition: bottom 0.22s ease;
  }

  /* Bigger, easier thumb targets. */
  .zoom {
    gap: 12px;
  }

  .seal-btn {
    width: 48px;
    height: 48px;
  }
}

/* A phone held sideways: a narrow side panel instead of a bottom sheet. */
@media (max-height: 520px) and (orientation: landscape) {
  :root {
    --panel-w: min(380px, 46vw);
  }

  .zoom {
    flex-direction: row;
  }
}

.seal-btn.is-on {
  box-shadow: 0 2px 6px var(--shadow), inset 0 0 0 3px rgba(246, 231, 198, 0.55);
}

.filter {
  position: fixed;
  z-index: 16;
  top: calc(var(--topbar-h) + 4px);
  right: 16px;
  width: min(300px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--parch-light);
  color: var(--ink);
  box-shadow: 0 6px 18px var(--shadow);
}

.filter[hidden] {
  display: none;
}

.filter__title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.filter__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  cursor: pointer;
}

.filter__row input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--wax);
}

.filter__row strong {
  display: block;
  font-size: 15px;
}

.filter__row small {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
}
