:root {
  --bg: #151513;
  --ink: #f5f1e8;
  --muted: rgba(245, 241, 232, 0.56);
  --line: rgba(245, 241, 232, 0.14);
  --panel: rgba(20, 20, 18, 0.7);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(245,241,232,0.018) 1px, transparent 1px),
    linear-gradient(rgba(245,241,232,0.016) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,0.032), transparent 22%, transparent 70%, rgba(0,0,0,0.26)),
    linear-gradient(135deg, #181817, #11110f 58%, #171613);
  background-size: 104px 104px, 104px 104px, auto, auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  isolation: isolate;
  --depth-scale: 1;
  --depth-shift: 0px;
  --depth-opacity: 0.18;
}

@supports (height: 100dvh) {
  .app {
    height: 100dvh;
  }
}

.app.is-dragging {
  cursor: grabbing;
}

.app.is-pinching {
  cursor: zoom-in;
}

.app.is-focused {
  cursor: grab;
}

.field {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  perspective: 1000px;
  touch-action: none;
}

.field::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 0;
  width: 140vmax;
  height: 140vmax;
  pointer-events: none;
  opacity: var(--depth-opacity);
  background:
    radial-gradient(circle, transparent 0 28%, rgba(244, 240, 232, 0.08) 28.4%, transparent 29.2%),
    repeating-radial-gradient(circle, rgba(244, 240, 232, 0.085) 0 1px, transparent 1px 72px);
  transform: translate(-50%, -50%) translateY(var(--depth-shift)) scale(var(--depth-scale));
  transition: opacity 160ms linear;
}

.field::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 200000;
  pointer-events: none;
  opacity: 0.86;
  background:
    radial-gradient(ellipse at center, transparent 50%, rgba(17, 17, 15, 0.2) 74%, rgba(17, 17, 15, 0.56) 100%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  mask-image: radial-gradient(ellipse at center, transparent 52%, black 78%);
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 52%, black 78%);
}

.shot {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--w);
  padding: 0;
  border: 1px solid rgba(245, 241, 232, 0.13);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(245, 241, 232, 0.035);
  box-shadow:
    0 var(--shadow-y, 14px) var(--shadow-blur, 42px) rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(255, 255, 255, var(--edge, 0.12));
  cursor: zoom-in;
  filter: blur(var(--edge-blur, 0px)) saturate(var(--edge-sat, 1));
  transform:
    translate3d(var(--sx), var(--sy), var(--lift, 0px))
    translate(-50%, -50%)
    rotate(var(--r))
    scale(var(--scale))
    scale(var(--intro-scale, 1));
  transform-origin: center center;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
  contain: layout paint style;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: var(--mx, 50%) var(--my, 50%);
  transition: transform 180ms ease;
}

.shot::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.13), transparent 34%),
    radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(245,241,232,0.12), transparent 28%);
  transition: opacity 180ms ease;
}

.shot:hover,
.shot.is-focused,
.shot.is-inspect,
.shot.is-priority {
  border-color: rgba(245, 241, 232, 0.36);
  box-shadow:
    0 calc(var(--shadow-y, 14px) + 8px) calc(var(--shadow-blur, 42px) + 18px) rgba(0, 0, 0, 0.54),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

.shot:hover::after,
.shot.is-focused::after,
.shot.is-inspect::after,
.shot.is-priority::after {
  opacity: 0.62;
}

.shot:hover img {
  transform: scale(1.018);
}

.shot.is-priority {
  filter: none;
  border-color: rgba(245, 241, 232, 0.58);
  box-shadow:
    0 34px 92px rgba(0, 0, 0, 0.64),
    0 0 0 1px rgba(255, 255, 255, 0.18);
}

.shot.is-muted {
  opacity: 0.28;
}

.shot.is-inspect {
  cursor: zoom-out;
  border-color: rgba(244, 240, 232, 0.78);
  box-shadow:
    0 34px 110px rgba(0, 0, 0, 0.78),
    0 0 0 1px rgba(255, 255, 255, 0.13);
}

.shot.is-hidden {
  visibility: hidden;
  filter: none;
}

/* 聚焦飞行中临时关闭动态 filter，降低每帧 paint 成本，保留 transform/opacity 空间感 */
.app.is-travelling .shot:not(.is-hidden) {
  filter: none;
}

.app.has-priority .field::after {
  opacity: 0.28;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.hud {
  position: fixed;
  z-index: 10;
  left: 22px;
  right: 22px;
  top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  pointer-events: none;
}

.brand,
.actions,
.z-meter {
  pointer-events: auto;
}

.brand {
  display: grid;
  gap: 5px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(20px, 2.8vw, 34px);
  line-height: 0.98;
  letter-spacing: 0;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.tag-filter {
  width: min(34vw, 340px);
  display: grid;
  gap: 7px;
}

.tag-filter input,
.tag-form input,
.comment-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(20, 20, 18, 0.72);
  backdrop-filter: blur(16px);
  outline: none;
}

.tag-filter input {
  height: 38px;
  padding: 0 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.24);
}

.tag-filter input::placeholder,
.tag-form input::placeholder,
.comment-form textarea::placeholder {
  color: rgba(245, 241, 232, 0.4);
}

.tag-suggestions,
.active-filters,
.tag-list,
.panel-tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-chip,
.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 26px;
  max-width: 150px;
  border: 1px solid rgba(245, 241, 232, 0.14);
  border-radius: 999px;
  padding: 0 9px;
  color: rgba(245, 241, 232, 0.82);
  background: rgba(20, 20, 18, 0.58);
  backdrop-filter: blur(12px);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-chip-editable {
  cursor: default;
  padding-right: 4px;
}

.tag-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-remove {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: rgba(245, 241, 232, 0.78);
  background: rgba(245, 241, 232, 0.1);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.tag-remove:hover {
  color: var(--ink);
  background: rgba(240, 111, 95, 0.42);
}

.tag-chip:hover,
.filter-chip:hover,
.tag-chip.is-active {
  border-color: rgba(105, 208, 195, 0.56);
  color: var(--ink);
}

.icon-button,
.text-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.28);
  cursor: pointer;
}

.icon-button {
  width: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.text-button {
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
}

.z-meter {
  position: fixed;
  z-index: 10;
  right: 24px;
  bottom: 22px;
  width: 7px;
  height: 132px;
  border: 1px solid rgba(244, 240, 232, 0.18);
  border-radius: 999px;
  background: rgba(244, 240, 232, 0.08);
  overflow: hidden;
}

.annotation-panel {
  position: fixed;
  z-index: 300000;
  top: 82px;
  right: 22px;
  width: min(380px, calc(100vw - 28px));
  max-height: calc(100vh - 112px);
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(245, 241, 232, 0.15);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(18, 18, 16, 0.82);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
  overflow: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateX(18px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.annotation-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.annotation-panel.is-positioned,
.annotation-panel.is-positioned.is-open {
  right: auto;
  bottom: auto;
  transform: none;
}

.annotation-panel.is-dragging-panel {
  transition: none;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  cursor: grab;
  touch-action: none;
}

.annotation-panel.is-dragging-panel .panel-head {
  cursor: grabbing;
}

.panel-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.panel-close {
  flex: 0 0 auto;
  min-height: 32px;
  width: 32px;
}

.panel-section {
  display: grid;
  gap: 9px;
}

.panel-section label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tag-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.tag-form input {
  height: 36px;
  padding: 0 10px;
}

.comment-form {
  display: grid;
  gap: 8px;
}

.comment-form textarea {
  min-height: 82px;
  resize: vertical;
  padding: 10px;
  line-height: 1.45;
}

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

.comment-item {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(245, 241, 232, 0.11);
  border-radius: 6px;
  background: rgba(245, 241, 232, 0.045);
}

.comment-item p,
.empty-note {
  margin: 0;
  color: rgba(245, 241, 232, 0.76);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.comment-item time {
  color: rgba(245, 241, 232, 0.42);
  font-size: 11px;
}

.z-meter span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: linear-gradient(180deg, #f06f5f, #52c7b8);
}

.metrics-hud {
  position: fixed;
  z-index: 11;
  left: 22px;
  bottom: 22px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(20, 20, 18, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

body.show-metrics .metrics-hud {
  opacity: 1;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.38), transparent 24%, transparent 72%, rgba(0,0,0,0.46)),
    radial-gradient(ellipse at center, transparent 42%, rgba(0,0,0,0.58));
  transition: opacity 180ms ease;
}

.app.is-focused .scrim {
  opacity: 0;
}

@media (max-width: 700px) {
  .hud {
    left: 10px;
    right: 10px;
    top: 10px;
    gap: 10px;
  }

  .brand h1 {
    font-size: 19px;
    line-height: 1;
  }

  .brand p {
    display: none;
  }

  .actions {
    align-items: flex-end;
    flex-direction: column;
    gap: 6px;
  }

  .tag-filter {
    width: min(62vw, 240px);
  }

  .tag-filter input,
  .tag-form input,
  .comment-form textarea {
    font-size: 16px;
  }

  .tag-filter input {
    height: 36px;
    padding: 0 10px;
  }

  .icon-button,
  .text-button {
    min-height: 36px;
  }

  .icon-button {
    width: 38px;
  }

  .text-button {
    padding: 0 12px;
    font-size: 12px;
  }

  .tag-suggestions {
    display: none;
  }

  .annotation-panel {
    left: 50%;
    right: auto;
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: min(312px, calc(100vw - 44px));
    max-height: clamp(260px, 42vh, 380px);
    gap: 8px;
    padding: 9px;
    transform: translate(-50%, 10px);
  }

  .annotation-panel.is-open {
    transform: translate(-50%, -8px);
  }

  .annotation-panel.is-positioned,
  .annotation-panel.is-positioned.is-open {
    transform: none;
  }

  .panel-head {
    gap: 8px;
  }

  .panel-kicker {
    margin-bottom: 0;
    font-size: 10px;
  }

  .panel-close {
    min-height: 30px;
    width: 30px;
  }

  .panel-section {
    gap: 6px;
  }

  .panel-section label {
    font-size: 11px;
  }

  .tag-list,
  .panel-tag-suggestions {
    gap: 5px;
  }

  .tag-chip,
  .filter-chip {
    min-height: 24px;
    max-width: 132px;
    padding: 0 8px;
    font-size: 11px;
  }

  .tag-remove {
    width: 17px;
    height: 17px;
  }

  .tag-form {
    gap: 6px;
  }

  .tag-form input {
    height: 32px;
    padding: 0 8px;
  }

  .annotation-panel .text-button {
    min-height: 32px;
    padding: 0 10px;
  }

  .comment-form {
    gap: 6px;
  }

  .comment-form textarea {
    min-height: 52px;
    max-height: 86px;
    padding: 7px 8px;
  }

  .comment-list {
    max-height: 86px;
    overflow: auto;
    gap: 5px;
  }

  .comment-item {
    padding: 7px 8px;
  }

  .comment-item p,
  .empty-note {
    font-size: 12px;
    line-height: 1.38;
  }

  .z-meter {
    right: 10px;
    bottom: 10px;
    height: 96px;
  }
}
