:root {
  color-scheme: dark;
  --bg: #090b0d;
  --panel: rgba(17, 19, 22, 0.78);
  --panel-strong: rgba(20, 23, 27, 0.96);
  --line: rgba(255, 255, 255, 0.115);
  --line-strong: rgba(255, 255, 255, 0.2);
  --ink: #f5f6f2;
  --muted: #8f9894;
  --muted-strong: #c6cec9;
  --emerald: #31e29b;
  --blue: #72a7ff;
  font-family: Inter, ui-sans-serif, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

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

button {
  font: inherit;
}

body {
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(49, 226, 155, 0.09), transparent 34%),
    linear-gradient(250deg, rgba(114, 167, 255, 0.1), transparent 42%),
    #090b0d;
}

.viewer-shell {
  position: relative;
  background:
    linear-gradient(115deg, rgba(49, 226, 155, 0.09), transparent 34%),
    linear-gradient(250deg, rgba(114, 167, 255, 0.1), transparent 42%),
    #090b0d;
  cursor: grab;
  touch-action: none;
}

.viewer-shell::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  content: "";
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.032) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.82) 62%, transparent 100%);
}

.viewer-shell.is-active {
  background: #05080b;
}

.viewer-shell.is-active::before {
  opacity: 0;
}

.viewer-shell:active {
  cursor: grabbing;
}

#scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 220ms ease;
}

.viewer-shell.is-active #scene {
  opacity: 1;
}

.empty-state {
  position: fixed;
  left: 50%;
  top: 46%;
  z-index: 2;
  width: min(880px, calc(100vw - 40px));
  color: var(--ink);
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.empty-state.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.eyebrow {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  color: var(--emerald);
  border: 1px solid rgba(49, 226, 155, 0.28);
  border-radius: 999px;
  background: rgba(49, 226, 155, 0.08);
  font-size: 12px;
}

.empty-state h1 {
  margin: 18px 0 14px;
  font-size: clamp(42px, 7vw, 92px);
  line-height: 0.95;
  letter-spacing: 0;
}

.empty-state p {
  max-width: 670px;
  margin: 0;
  color: var(--muted-strong);
  font-size: 16px;
  line-height: 1.75;
}

.hud {
  position: fixed;
  left: 20px;
  bottom: 18px;
  z-index: 4;
  max-width: min(340px, calc(100vw - 40px));
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #f7fbff;
  background: rgba(4, 11, 17, 0.48);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px);
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.hud.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.controls {
  color: rgba(247, 251, 255, 0.78);
  font-size: 12px;
  line-height: 1.25;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(43, 137, 191, 0.24), transparent 34%),
    rgba(5, 8, 11, 0.86);
  transition:
    opacity 240ms ease,
    visibility 240ms ease;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.image-dock {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 8;
  min-width: 88px;
  max-width: calc(100vw - 32px);
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.07)),
    rgba(36, 52, 58, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 20px 60px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(22px) saturate(1.3);
  transform: translateX(-50%);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.image-dock.is-drag-over {
  border-color: rgba(49, 226, 155, 0.72);
  background:
    linear-gradient(180deg, rgba(49, 226, 155, 0.24), rgba(114, 167, 255, 0.1)),
    rgba(36, 52, 58, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 22px 70px rgba(49, 226, 155, 0.22);
}

.dock-images {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dock-item {
  position: relative;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

.upload-item {
  display: grid;
  place-items: center;
  color: #04110c;
  cursor: pointer;
  background:
    linear-gradient(135deg, rgba(49, 226, 155, 0.95), rgba(114, 167, 255, 0.78));
}

.share-item {
  display: grid;
  place-items: center;
  color: #04110c;
  cursor: pointer;
  background:
    linear-gradient(135deg, rgba(114, 167, 255, 0.94), rgba(49, 226, 155, 0.72));
}

.share-item:disabled {
  cursor: not-allowed;
  filter: grayscale(0.6);
  opacity: 0.48;
  transform: none;
}

.upload-item:hover,
.share-item:not(:disabled):hover,
.image-thumb:hover {
  transform: translateY(-4px) scale(1.04);
}

.upload-plus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid rgba(4, 17, 12, 0.82);
  border-radius: 9px;
  color: rgba(4, 17, 12, 0.9);
  font-size: 32px;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-1px);
}

.share-glyph {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(4, 17, 12, 0.82);
  border-radius: 9px;
  color: rgba(4, 17, 12, 0.9);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.image-thumb {
  padding: 0;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease;
}

.image-thumb.is-active {
  border-color: rgba(49, 226, 155, 0.86);
  box-shadow:
    0 0 0 2px rgba(49, 226, 155, 0.22),
    0 10px 26px rgba(0, 0, 0, 0.24);
}

.image-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.delete-thumb {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(6, 10, 12, 0.68);
  cursor: pointer;
}

.delete-thumb::before,
.delete-thumb::after {
  position: absolute;
  width: 9px;
  height: 1.5px;
  content: "";
  border-radius: 999px;
  background: currentColor;
}

.delete-thumb::before {
  transform: rotate(45deg);
}

.delete-thumb::after {
  transform: rotate(-45deg);
}

.image-hover-card {
  position: fixed;
  z-index: 20;
  width: 260px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(14, 18, 21, 0.92);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
  pointer-events: none;
  transform: translate(-50%, -112%);
  transition: opacity 120ms ease, visibility 120ms ease;
}

.image-hover-card.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.hover-preview {
  width: 100%;
  height: 130px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #05080b;
}

.hover-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.hover-meta {
  display: grid;
  gap: 4px;
  padding-top: 9px;
}

.hover-meta strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hover-meta span {
  color: var(--muted-strong);
  font-size: 11px;
  line-height: 1.35;
}

.toast {
  position: fixed;
  left: 50%;
  top: 92px;
  z-index: 21;
  max-width: min(520px, calc(100vw - 36px));
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.34);
  transform: translateX(-50%);
  transition: opacity 160ms ease, visibility 160ms ease;
}

.toast.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(8px);
}

.modal-backdrop.is-hidden {
  display: none;
}

.modal-card {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-strong);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.modal-card strong {
  font-size: 16px;
  line-height: 1.55;
}

.share-card {
  width: min(520px, 100%);
}

.share-url-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.primary-button,
.secondary-button {
  height: 36px;
  padding: 0 14px;
  border-radius: 7px;
  cursor: pointer;
}

.primary-button {
  color: #04110c;
  border: 0;
  background: var(--emerald);
}

.secondary-button {
  color: var(--muted-strong);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
}

@media (max-width: 760px) {
  .empty-state {
    top: 44%;
  }

  .image-dock {
    min-height: 74px;
    gap: 9px;
    padding: 10px;
    border-radius: 24px;
    overflow-x: auto;
  }

  .dock-images {
    gap: 9px;
  }

  .dock-item {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 13px;
  }

  .hud {
    left: 12px;
    right: 12px;
    bottom: 108px;
    max-width: none;
  }
}
