* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 42%, #15142d 0%, #090919 52%, #04040c 100%);
  color: #f9f6fb;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  user-select: none;
}

#canvas-container {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.hidden {
  display: none !important;
}

/* Editable copy subtle hover cue */
.editable-text {
  user-select: text;
  cursor: text;
  border-radius: 6px;
  padding: 2px 6px;
  margin: -2px -6px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.editable-text:hover {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 1px rgba(255, 220, 240, 0.28) dashed;
}

.editable-text:focus {
  background: rgba(20, 18, 38, 0.78);
  box-shadow: 0 0 0 1.5px rgba(255, 214, 235, 0.75);
}

/* Top HUD */
.hud-top {
  position: fixed;
  top: 26px;
  left: 34px;
  right: 34px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.top-badge,
.countdown-badge,
.gesture-hud {
  pointer-events: auto;
}

.top-badge {
  font-size: 13px;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: rgba(255, 246, 250, 0.88);
  text-shadow: 0 0 14px rgba(255, 210, 235, 0.45);
}

.top-right-area {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

.countdown-badge {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(255, 246, 252, 0.92);
  text-shadow: 0 0 12px rgba(255, 215, 235, 0.4);
}

/* Hand Tracking Box matching Douyin screenshot */
.gesture-hud {
  width: 222px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-box {
  position: relative;
  width: 222px;
  height: 152px;
  border-radius: 14px;
  background: rgba(8, 9, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

#skeleton-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.gesture-status {
  position: absolute;
  bottom: 7px;
  left: 10px;
  right: 10px;
  font-size: 11px;
  color: rgba(255, 232, 244, 0.72);
  text-align: center;
  pointer-events: none;
}

.gesture-legend {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 2px 4px;
  font-size: 12.5px;
  color: rgba(255, 248, 252, 0.86);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.gesture-legend li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.gesture-legend li span:first-child {
  font-weight: 600;
  color: #ffffff;
}

.gesture-legend li span:last-child {
  color: rgba(245, 236, 248, 0.78);
}

/* Bottom Left Greeting */
.hud-bottom-left {
  position: fixed;
  left: 36px;
  bottom: 34px;
  z-index: 10;
  max-width: min(520px, 52vw);
  pointer-events: auto;
  transition: opacity 0.95s ease, transform 0.95s cubic-bezier(0.2, 0.85, 0.25, 1);
}

body.intro-playing .hud-bottom-left {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

.title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.script-title {
  font-family: "Snell Roundhand", "Brush Script MT", "Segoe Script", "Lucida Handwriting", "Georgia", cursive, "STKaiti", serif;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(38px, 4.7vw, 66px);
  line-height: 1.08;
  color: #ffffff;
  text-shadow:
    0 0 22px rgba(255, 215, 238, 0.68),
    0 4px 18px rgba(0, 0, 0, 0.55);
  margin-bottom: 8px;
}

.quick-edit-chip {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 240, 248, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.quick-edit-chip:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
}

.subtitle {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: rgba(255, 248, 252, 0.95);
  margin-bottom: 6px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
}

.interaction-hint {
  font-size: 12px;
  color: rgba(244, 236, 250, 0.78);
  letter-spacing: 0.03em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.88);
}

/* Bottom Right 6-Pill Toolbar */
.hud-toolbar {
  position: fixed;
  right: 34px;
  bottom: 30px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
  transition: opacity 0.95s ease 0.18s, transform 0.95s cubic-bezier(0.2, 0.85, 0.25, 1) 0.18s;
}

body.intro-playing .hud-toolbar {
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(14, 15, 30, 0.66);
  color: rgba(255, 248, 252, 0.92);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(14px);
  transition: all 0.22s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 230, 242, 0.45);
  transform: translateY(-1.5px);
}

.pill-btn.active {
  background: #ffffff;
  color: #151326;
  border-color: #ffffff;
  font-weight: 600;
  box-shadow: 0 0 22px rgba(255, 232, 244, 0.72);
}

.pill-icon {
  font-size: 13px;
  line-height: 1;
}

/* Polaroid Zoom Modal */
.polaroid-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaroid-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 8, 18, 0.66);
  backdrop-filter: blur(12px);
}

.polaroid-focus-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: popIn 0.28s cubic-bezier(0.2, 0.9, 0.25, 1);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.84) translateY(18px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.polaroid-card-large {
  width: min(360px, 84vw);
  background: #fcfaf8;
  border-radius: 14px;
  padding: 18px 18px 20px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.65),
    0 0 38px rgba(255, 214, 235, 0.26);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.polaroid-media-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #141522;
  border-radius: 7px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.polaroid-media-box img,
.polaroid-media-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.polaroid-caption-input {
  width: 100%;
  border: none;
  border-bottom: 1px dashed rgba(110, 90, 102, 0.28);
  background: transparent;
  text-align: center;
  font-size: 18px;
  font-family: "STKaiti", "KaiTi", "Segoe Script", sans-serif;
  color: #3a3037;
  padding: 4px 8px;
  outline: none;
}

.polaroid-caption-input:focus {
  border-bottom-color: #d46a96;
}

.polaroid-action-pill {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 10px 8px 18px;
  border-radius: 999px;
  background: rgba(16, 17, 32, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(14px);
}

.polaroid-caption-preview {
  font-size: 12.5px;
  color: rgba(245, 236, 246, 0.8);
}

.polaroid-action-btns {
  display: flex;
  gap: 8px;
}

.mini-pill {
  height: 32px;
  padding: 0 15px;
  border-radius: 999px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.mini-pill.primary {
  background: #ffffff;
  color: #171528;
}

.mini-pill.danger {
  background: rgba(255, 105, 130, 0.22);
  color: #ff9fb0;
  border: 1px solid rgba(255, 120, 145, 0.36);
}

.mini-pill:hover {
  opacity: 0.88;
}

/* Settings Drawer */
.settings-drawer {
  position: fixed;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: min(410px, calc(100vw - 36px));
  z-index: 50;
  background: rgba(13, 14, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  backdrop-filter: blur(22px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.drawer-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: #fff6fb;
}

.icon-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
}

.drawer-body {
  padding: 18px 22px 26px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.setting-section {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.section-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #ffcce4;
  letter-spacing: 0.04em;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 245, 250, 0.9);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.chip-btn:hover,
.chip-btn.active {
  background: rgba(255, 214, 235, 0.92);
  color: #181326;
  border-color: transparent;
  font-weight: 600;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group span {
  font-size: 12px;
  color: rgba(235, 226, 242, 0.72);
}

.field-group input[type="text"],
.field-group input[type="date"] {
  height: 36px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-size: 13px;
  outline: none;
}

.field-group input:focus {
  border-color: #ffb8d9;
  background: rgba(255, 255, 255, 0.1);
}

.slider-group input[type="range"] {
  accent-color: #ffc2de;
  cursor: pointer;
}

.drawer-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.action-btn {
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.action-btn.subtle {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(245, 236, 246, 0.82);
}

.action-btn.danger-outline {
  background: rgba(255, 95, 120, 0.12);
  border-color: rgba(255, 110, 135, 0.35);
  color: #ffa5b5;
}

/* Save Modal */
.save-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(6, 7, 16, 0.68);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.save-card {
  width: min(440px, 100%);
  background: rgba(15, 16, 32, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.save-desc {
  padding: 14px 22px 6px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(238, 230, 245, 0.78);
}

.save-actions {
  padding: 14px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.save-option-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 13px 16px;
  border-radius: 13px;
  border: 1px solid rgba(255, 214, 235, 0.28);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.save-option-btn:hover {
  background: rgba(255, 214, 235, 0.18);
  transform: translateY(-1px);
}

.save-option-btn strong {
  font-size: 14px;
}

.save-option-btn span {
  font-size: 12px;
  color: rgba(235, 226, 242, 0.72);
}

/* Toast */
.toast {
  position: fixed;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  padding: 9px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #171428;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

@media (max-width: 768px) {
  .hud-top {
    top: 16px;
    left: 18px;
    right: 18px;
  }
  .hud-bottom-left {
    left: 18px;
    right: 18px;
    bottom: 92px;
    max-width: none;
  }
  .hud-toolbar {
    left: 14px;
    right: 14px;
    bottom: 16px;
    justify-content: center;
  }
  .pill-btn {
    height: 34px;
    padding: 0 12px;
    font-size: 12.5px;
  }
}
