    :root {
      --bg-1: #eef6ff;
      --bg-2: #e6f0ff;
      --bg-3: #f7fbff;
      --surface: rgba(255,255,255,0.82);
      --surface-strong: rgba(255,255,255,0.94);
      --text: #31465f;
      --muted: #6c86a1;
      --line: rgba(115, 152, 196, 0.18);
      --accent: #8bb8e8;
      --accent-2: #a8cfff;
      --accent-dark: #5f8fbe;
      --shadow: 0 18px 50px rgba(86, 121, 159, 0.16);
      --shadow-soft: 0 10px 24px rgba(86, 121, 159, 0.08);
    }

    * { box-sizing: border-box; }

    html, body {
      margin: 0;
      min-height: 100%;
      font-family: "Inter", sans-serif;
      color: var(--text);
      background:
        radial-gradient(circle at top left, rgba(255,255,255,0.82), transparent 28%),
        radial-gradient(circle at bottom right, rgba(168,207,255,0.28), transparent 36%),
        linear-gradient(135deg, var(--bg-1), var(--bg-2) 45%, var(--bg-3));
    }

    .page {
      min-height: 100vh;
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px 16px 36px;
    }

    .hidden { display: none !important; }

    .stack {
      width: min(100%, 980px);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 14px;
    }

    .eyebrow {
      margin: 0;
      text-transform: uppercase;
      letter-spacing: 0.28em;
      font-size: 0.74rem;
      color: var(--muted);
      font-weight: 700;
      text-align: center;
    }

    .hero-title {
      margin: 0;
      font-family: "Cormorant Garamond", serif;
      font-size: clamp(3.3rem, 11vw, 6.7rem);
      line-height: 0.92;
      color: var(--accent-dark);
      text-align: center;
    }

    .hero-title.soft {
      color: var(--accent);
      margin-bottom: 10px;
    }

    .title {
      margin: 0;
      font-family: "Cormorant Garamond", serif;
      font-size: clamp(2.2rem, 7vw, 3.6rem);
      line-height: 0.95;
      color: var(--accent-dark);
      text-align: center;
    }

    .subtitle {
      margin: 0;
      color: var(--muted);
      text-align: center;
      line-height: 1.58;
      max-width: 42ch;
    }

    .button-row,
    .card-grid,
    .result-actions {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      justify-content: center;
      width: 100%;
    }

    .btn {
      appearance: none;
      border: 1px solid var(--line);
      background: var(--surface-strong);
      color: var(--text);
      border-radius: 999px;
      padding: 13px 20px;
      font-size: 0.95rem;
      font-weight: 700;
      cursor: pointer;
      box-shadow: var(--shadow-soft);
      transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
    }

    .btn:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow);
      border-color: rgba(95, 143, 190, 0.28);
    }

    .btn:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      transform: none;
      box-shadow: var(--shadow-soft);
    }

    .btn.primary {
      background: linear-gradient(135deg, var(--accent), var(--accent-2));
      color: white;
      border-color: transparent;
    }

    .btn.ghost {
      background: rgba(255,255,255,0.72);
    }

    .mode-card,
    .layout-card,
    .frame-card {
      background: var(--surface);
      border: 1px solid var(--line);
      border-radius: 22px;
      box-shadow: var(--shadow-soft);
      transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
      cursor: pointer;
      backdrop-filter: blur(12px);
    }

    .mode-card:hover,
    .layout-card:hover,
    .frame-card:hover,
    .mode-card.selected,
    .layout-card.selected,
    .frame-card.selected {
      transform: translateY(-3px);
      box-shadow: var(--shadow);
      border-color: rgba(95, 143, 190, 0.28);
    }

    .mode-card {
      width: min(270px, 88vw);
      min-height: 208px;
      padding: 24px 20px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 10px;
      text-align: center;
    }

    .mode-card .icon { font-size: 2rem; }

    .mode-card .label {
      text-transform: uppercase;
      letter-spacing: 0.08em;
      font-weight: 700;
      color: var(--accent-dark);
      font-size: 0.95rem;
    }

    .mode-card .desc {
      color: var(--muted);
      font-size: 0.92rem;
      line-height: 1.5;
    }

    .layout-card {
      width: min(180px, 80vw);
      min-height: 170px;
      padding: 22px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      align-items: center;
      justify-content: center;
      text-align: center;
    }

    .layout-icon {
      font-size: 1.7rem;
      line-height: 1.08;
      color: var(--accent-dark);
    }

    .layout-name {
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--muted);
      font-size: 0.9rem;
      font-weight: 700;
    }

    .frame-card {
      width: min(190px, 42vw);
      padding: 8px;
    }

    .frame-card img {
      display: block;
      width: 100%;
      border-radius: 14px;
    }

    .code-input {
      width: min(300px, 88vw);
      padding: 16px 18px;
      border-radius: 18px;
      border: 1.5px solid rgba(115,152,196,0.24);
      background: rgba(255,255,255,0.92);
      box-shadow: var(--shadow-soft);
      text-align: center;
      letter-spacing: 0.26em;
      text-transform: uppercase;
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--text);
      outline: none;
    }

    .capture-shell {
      width: min(100%, 920px);
      display: grid;
      gap: 16px;
      justify-items: center;
    }

    .frame-stage {
      position: relative;
      width: min(66vw, 270px);
      aspect-ratio: 4 / 9;
      border-radius: 24px;
      overflow: hidden;
      background: rgba(255,255,255,0.4);
      box-shadow: var(--shadow);
    }

    .slots-layer {
      position: absolute;
      inset: 0;
      z-index: 1;
      pointer-events: none;
    }

    .slot-box {
      position: absolute;
      overflow: hidden;
      background: rgba(255,255,255,0.08);
    }

    .slot-left,
    .slot-right {
      position: absolute;
      top: 0;
      width: 50%;
      height: 100%;
      overflow: hidden;
    }

    .slot-left { left: 0; }
    .slot-right { right: 0; background: rgba(255,255,255,0.06); }

    .slot-guide {
      position: absolute;
      inset: 0;
      border: 2px solid rgba(255,255,255,0.92);
      box-shadow: inset 0 0 0 1px rgba(95,143,190,0.18);
      opacity: 0;
      transition: opacity 0.18s ease;
      z-index: 3;
    }

    .slot-box.active .slot-guide {
      opacity: 1;
    }

    .preview-half {
      position: absolute;
      top: 0;
      width: 200%;
      height: 100%;
      object-fit: cover;
      display: block;
      transform: scaleX(-1);
      transform-origin: center;
    }

    .preview-left { left: 0; }
    .preview-right { right: 0; }

    .cropped-half {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .countdown-overlay {
      position: absolute;
      inset: 0;
      z-index: 6;
      display: flex;
      align-items: center;
      justify-content: center;
      pointer-events: none;
      font-family: "Cormorant Garamond", serif;
      font-size: clamp(5.2rem, 18vw, 7.2rem);
      line-height: 1;
      font-weight: 700;
      color: rgba(255, 255, 255, 0.98);
      letter-spacing: 0.02em;
      opacity: 0;
      transform: scale(0.82);
      transition: opacity 0.18s ease, transform 0.18s ease;
    }

    .countdown-overlay::before {
      content: "";
      position: absolute;
      width: 42%;
      aspect-ratio: 1 / 1;
      border-radius: 999px;
      background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.22) 0%,
        rgba(168, 207, 255, 0.18) 38%,
        rgba(139, 184, 232, 0.10) 58%,
        transparent 74%
      );
      filter: blur(10px);
      opacity: 0;
      transform: scale(0.86);
      transition: opacity 0.18s ease, transform 0.18s ease;
    }

    .countdown-overlay.active {
      opacity: 1;
      transform: scale(1);
      text-shadow:
        0 0 10px rgba(255, 255, 255, 0.96),
        0 0 20px rgba(255, 255, 255, 0.82),
        0 0 34px rgba(168, 207, 255, 0.72),
        0 0 54px rgba(139, 184, 232, 0.42),
        0 8px 24px rgba(49, 70, 95, 0.20);
    }

    .countdown-overlay.active::before {
      opacity: 1;
      transform: scale(1);
    }

    .frame-overlay {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: contain;
      z-index: 5;
      pointer-events: none;
    }

    .capture-panel {
      width: min(100%, 520px);
      padding: 14px 16px 12px;
      border-radius: 24px;
      background: rgba(255,255,255,0.76);
      border: 1px solid rgba(115,152,196,0.14);
      box-shadow: var(--shadow-soft);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      backdrop-filter: blur(12px);
    }

    .shot-pill {
      padding: 6px 12px;
      border-radius: 999px;
      background: rgba(255,255,255,0.84);
      border: 1px solid rgba(115,152,196,0.14);
      font-size: 0.84rem;
      font-weight: 700;
      color: var(--text);
    }

    .capture-copy {
      text-align: center;
      color: var(--muted);
      line-height: 1.4;
      margin: 0;
      max-width: 34ch;
      min-height: 20px;
    }

    .code-display {
      min-width: min(320px, 88vw);
      padding: 18px 20px;
      border-radius: 24px;
      background: rgba(255,255,255,0.94);
      border: 1px solid rgba(115,152,196,0.18);
      box-shadow: var(--shadow);
      font-size: clamp(2rem, 8vw, 3.4rem);
      font-weight: 800;
      letter-spacing: 0.22em;
      color: var(--accent-dark);
      text-align: center;
    }

    .code-preview-img {
      width: min(220px, 60vw);
      max-height: 45vh;
      object-fit: contain;
      border-radius: 16px;
      box-shadow: var(--shadow-soft);
      margin: 4px 0;
    }

    .status-text {
      min-height: 24px;
      margin: 0;
      color: var(--muted);
      text-align: center;
      font-size: 0.92rem;
      line-height: 1.45;
      max-width: 42ch;
    }

    .result-wrap {
      position: relative;
      width: min(320px, 84vw);
    }

    .result-wrap img.main-result {
      width: 100%;
      display: block;
      border-radius: 20px;
      box-shadow: var(--shadow);
    }

    .hidden-media {
      position: absolute;
      opacity: 0;
      pointer-events: none;
      width: 1px;
      height: 1px;
    }

    @media (max-width: 640px) {
      .frame-stage { width: min(70vw, 255px); }

      .capture-panel {
        width: min(100%, 350px);
        padding: 12px 14px 10px;
        gap: 7px;
      }

      .btn {
        padding: 11px 16px;
        font-size: 0.9rem;
      }

      .countdown-overlay {
        font-size: clamp(4.4rem, 20vw, 6rem);
      }

      .countdown-overlay::before {
        width: 52%;
      }
    }

/* ===================== Admin backend ===================== */

.admin-gear-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.admin-gear-btn:hover {
  opacity: 1;
  transform: rotate(25deg);
}

.admin-text-input {
  width: 100%;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: 0.95rem;
  margin: 6px 0;
}

.admin-text-input:focus {
  outline: none;
  border-color: var(--accent-dark);
}

.admin-error {
  color: #d1546b;
  font-size: 0.85rem;
  margin: 4px 0 0;
}

.admin-stack {
  width: min(100%, 560px);
}

.admin-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 4px 0 10px;
}

.admin-section {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--surface);
}

.admin-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: transparent;
  border: none;
  font-family: "Inter", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.admin-section-header:hover {
  background: rgba(139, 184, 232, 0.1);
}

.admin-section-header .accordion-chevron {
  transition: transform 0.2s ease;
  color: var(--muted);
}

.admin-section-header.open .accordion-chevron {
  transform: rotate(90deg);
}

.admin-section-body {
  padding: 4px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.admin-frame-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-frame-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
}

.admin-frame-item.disabled {
  opacity: 0.45;
}

.admin-frame-item img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.admin-frame-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--bg-2);
  flex-shrink: 0;
}

.admin-frame-label {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.3;
}

.admin-frame-label small {
  color: var(--muted);
}

.admin-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.admin-reorder-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-mini-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

.admin-mini-btn:hover {
  background: rgba(139, 184, 232, 0.15);
}

.admin-mini-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.admin-vault-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.admin-vault-page-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.admin-session-detail {
  width: 100%;
  padding: 10px 12px 14px;
  margin-top: -6px;
  border: 1px dashed var(--line);
  border-top: none;
  border-radius: 0 0 12px 12px;
  background: rgba(255,255,255,0.5);
}

.admin-version-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.admin-version-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 96px;
  text-align: center;
}

.admin-version-thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.admin-version-caption {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.2;
}

.qr-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin: 4px 0;
}

.qr-box img {
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  background: #fff;
  padding: 8px;
}
