:root {
  --emerald-deep: #0b2417;
  --emerald: #13422b;
  --crimson-deep: #5b1016;
  --crimson: #8b1e24;
  --gold: #d4a64a;
  --gold-light: #f6dc99;
  --cream: #fcf7ee;
  --cream-soft: #f4ebd9;
  --ink: #241814;
  --ink-muted: #5d4a40;
  --radius-pill: 999px;
  --radius-card: 24px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(circle at 20% 15%, rgba(139, 30, 36, 0.45), transparent 45%),
    radial-gradient(circle at 80% 12%, rgba(212, 166, 74, 0.2), transparent 40%),
    linear-gradient(165deg, #071910 0%, #0f3120 46%, #2c0d12 100%);
  background-attachment: fixed;
}

.hidden {
  display: none !important;
}

/* Gentle snowfall backdrop */
.snowfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.snowflake {
  position: absolute;
  top: -12px;
  color: rgba(255, 250, 240, 0.72);
  user-select: none;
  animation: fall linear infinite;
}

@keyframes fall {
  0% {
    transform: translateY(-10px) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.85;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(105vh) translateX(24px) rotate(360deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .snowflake {
    animation: none;
    display: none;
  }
}

/* Desktop stage centers a mobile-sized Linktree app frame; mobile fills screen */
.desktop-stage {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px 14px 36px;
}

.linktree-shell {
  width: 100%;
  max-width: 430px;
  min-height: calc(100dvh - 56px);
  background:
    linear-gradient(180deg, rgba(125, 25, 32, 0.94) 0%, rgba(19, 66, 43, 0.96) 36%, rgba(11, 36, 23, 0.98) 100%);
  border: 1.5px solid rgba(212, 166, 74, 0.55);
  border-radius: 32px;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 244, 214, 0.25);
  padding: 16px 18px 22px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

@media (max-width: 500px) {
  .desktop-stage {
    padding: 0;
  }
  .linktree-shell {
    max-width: 100%;
    min-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    padding: max(14px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  }
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  position: relative;
  z-index: 2;
}

.brand-chip {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gold-light);
  background: rgba(11, 36, 23, 0.55);
  border: 1px solid rgba(212, 166, 74, 0.35);
  padding: 6px 11px;
  border-radius: var(--radius-pill);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-pill {
  appearance: none;
  border: 1px solid rgba(246, 220, 153, 0.45);
  background: rgba(255, 248, 235, 0.14);
  backdrop-filter: blur(8px);
  color: #fff9ee;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform 0.14s ease, background 0.16s ease;
}

.icon-pill:hover {
  background: rgba(212, 166, 74, 0.28);
}

.icon-pill:active {
  transform: scale(0.96);
}

.icon-pill.subtle {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.22);
}

/* Hero Profile Section (Linktree signature centered avatar + bio) */
.profile-hero {
  text-align: center;
  padding: 4px 6px 16px;
  position: relative;
}

.medallion-ring {
  width: 122px;
  height: 122px;
  margin: 0 auto 12px;
  padding: 4px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f8e2a2, #b88428, #f8e2a2);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 24px rgba(246, 220, 153, 0.22);
}

.medallion-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  border: 2px solid #5b1016;
}

.profile-title {
  margin: 0 0 3px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 700;
  color: #fffaf0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.profile-handle {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.02em;
}

.profile-bio {
  margin: 0 auto;
  max-width: 320px;
  font-size: 13.5px;
  line-height: 1.45;
  color: rgba(252, 247, 238, 0.88);
}

/* Banners */
.notice-banner {
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.4;
  margin-bottom: 12px;
}

.notice-banner.warning {
  background: rgba(246, 220, 153, 0.16);
  border: 1px solid rgba(246, 220, 153, 0.55);
  color: #fff3d1;
}

/* Auth / Card Panel */
.card-panel {
  background: var(--cream);
  color: var(--ink);
  border-radius: var(--radius-card);
  border: 2px solid rgba(212, 166, 74, 0.85);
  padding: 20px 18px 18px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.35);
}

.center-text {
  text-align: center;
  padding: 28px 18px;
}

.muted {
  color: var(--ink-muted);
  font-size: 13.5px;
  margin: 10px 0 0;
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(139, 30, 36, 0.2);
  border-top-color: var(--crimson);
  animation: spin 0.8s linear infinite;
}

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

.step-badge, .welcome-ribbon {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
}

.step-badge {
  background: #f2e5cb;
  color: var(--crimson);
  border: 1px solid #dfc594;
}

.welcome-ribbon {
  background: linear-gradient(135deg, #13422b, #1d5d3d);
  color: #fbe5a8;
  border: 1px solid var(--gold);
}

.step-title {
  margin: 0 0 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  color: var(--crimson-deep);
}

.step-desc {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-muted);
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--emerald);
  margin-bottom: 5px;
}

input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 12px 13px;
  margin-bottom: 12px;
  border-radius: 14px;
  border: 1.5px solid #d7c39d;
  background: #ffffff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input:focus, textarea:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px rgba(139, 30, 36, 0.14);
}

.primary-btn {
  width: 100%;
  appearance: none;
  border: none;
  border-radius: var(--radius-pill);
  padding: 13px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fffaf0;
  background: linear-gradient(135deg, var(--crimson) 0%, #a8242b 55%, var(--crimson-deep) 100%);
  box-shadow: 0 6px 16px rgba(139, 30, 36, 0.34);
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.16s ease;
}

.primary-btn:hover {
  filter: brightness(1.06);
}

.primary-btn:active {
  transform: scale(0.98);
}

.primary-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.primary-btn.compact {
  padding: 10px 14px;
  font-size: 14px;
}

.text-link-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--emerald);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px;
}

.text-link-btn.inline {
  display: inline;
  width: auto;
  margin: 0;
  padding: 2px 6px;
}

.auth-feedback {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.auth-feedback.error {
  background: #fdeceb;
  border: 1px solid #eab5b1;
  color: #7e191f;
}

.auth-feedback.success {
  background: #e9f6ee;
  border: 1px solid #a9d6ba;
  color: #13422b;
}

.locked-teaser {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px dashed #d8c39b;
  text-align: center;
}

.teaser-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7c624d;
  margin-bottom: 8px;
}

.teaser-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.teaser-pills span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--emerald);
  background: #efe6d4;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
}

/* Signed-in Linktree Links Stack */
.links-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.signed-in-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 248, 235, 0.12);
  border: 1px solid rgba(246, 220, 153, 0.35);
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 12.5px;
  color: #f8edd9;
}

.signed-in-bar strong {
  color: #fff;
  word-break: break-all;
}

.role-badge {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--gold);
  color: #2c140e;
  flex-shrink: 0;
}

.links-stack {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

/* Signature Linktree Pill Button */
.linktree-btn {
  width: 100%;
  appearance: none;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 10px 14px 10px 10px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  border: 2px solid rgba(212, 166, 74, 0.9);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.25),
    0 2px 0 rgba(212, 166, 74, 0.45);
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.16s ease, background 0.16s ease;
}

.linktree-btn:hover {
  transform: translateY(-2px) scale(1.01);
  background: #ffffff;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.34),
    0 0 0 3px rgba(246, 220, 153, 0.28);
}

.linktree-btn:active {
  transform: scale(0.98);
}

.link-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--crimson), #5f1117);
  color: var(--gold-light);
  border: 1.5px solid var(--gold);
  font-size: 20px;
}

.link-icon-circle.emerald {
  background: linear-gradient(135deg, var(--emerald), #0b2618);
}

.link-text {
  flex: 1;
  min-width: 0;
}

.link-title {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--crimson-deep);
  line-height: 1.25;
  margin-bottom: 2px;
}

.link-sub {
  display: block;
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-type-tag {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: #f1e4c9;
  color: var(--emerald);
  border: 1px solid #d9c08e;
  flex-shrink: 0;
}

.holiday-card-footer {
  margin-top: 6px;
  background: rgba(255, 248, 235, 0.1);
  border: 1px solid rgba(212, 166, 74, 0.4);
  border-radius: 20px;
  padding: 10px;
  text-align: center;
}

.footer-vignette {
  width: 100%;
  height: auto;
  border-radius: 13px;
  display: block;
  border: 1px solid rgba(212, 166, 74, 0.6);
}

.footer-caption {
  margin: 8px 0 2px;
  font-size: 12px;
  color: rgba(252, 247, 238, 0.85);
}

.linktree-footer {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(246, 220, 153, 0.8);
}

.footer-mark {
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* Modal Sheets */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 16, 10, 0.78);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 12px;
}

@media (min-width: 540px) {
  .modal-backdrop {
    align-items: center;
  }
}

.modal-sheet {
  width: 100%;
  max-width: 440px;
  background: var(--cream);
  color: var(--ink);
  border-radius: 24px;
  border: 2px solid var(--gold);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.doc-sheet {
  height: min(88dvh, 760px);
}

.admin-sheet {
  max-height: min(86dvh, 720px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--crimson-deep), var(--emerald));
  color: #fffaf0;
  border-bottom: 2px solid var(--gold);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.modal-title-wrap h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.16);
  color: var(--gold-light);
  flex-shrink: 0;
}

.modal-badge.gold {
  background: var(--gold);
  color: #2c140e;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mini-action-btn {
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.mini-action-btn.gold {
  background: var(--gold);
  color: #2b150e;
  border-color: var(--gold-light);
}

.mini-close-btn {
  appearance: none;
  border: none;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.doc-frame-wrap {
  flex: 1;
  background: #182b20;
}

.doc-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Admin Panel */
.admin-body {
  padding: 14px 16px 18px;
  overflow-y: auto;
}

.admin-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--crimson-deep);
}

.guest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guest-row {
  background: #ffffff;
  border: 1px solid #e2d1b2;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.guest-meta {
  flex: 1 1 170px;
  min-width: 0;
}

.guest-email {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
}

.guest-status {
  display: inline-block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.guest-status.active {
  background: #e7f5ec;
  color: #13422b;
}

.guest-status.pending {
  background: #fdf3dc;
  color: #845911;
}

.guest-status.admin {
  background: #f8e4e5;
  color: #8b1e24;
}

.guest-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.row-btn {
  appearance: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid #d7c39d;
  background: #faf3e4;
  color: var(--ink);
  cursor: pointer;
}

.row-btn.admin-pill {
  border-color: #d4a64a;
  background: #fdf3dc;
  color: #7c520d;
}

.row-btn.danger {
  border-color: #e4b5b2;
  background: #fdeceb;
  color: #8b1e24;
}

/* Admin Tabs & Document Manager */
.admin-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 10px 14px 0;
  background: var(--cream-soft);
  border-bottom: 1px solid #e2d1b2;
}

.admin-tab {
  appearance: none;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 12px 12px 0 0;
  cursor: pointer;
}

.admin-tab.active {
  background: var(--cream);
  color: var(--crimson-deep);
  border-color: #e2d1b2;
}

.admin-inline-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-inline-controls select {
  flex: 1.4;
  margin-bottom: 0;
}

.admin-inline-controls button {
  flex: 0.7;
}

.admin-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.admin-body input[type="text"],
.admin-body select,
.admin-body input[type="file"] {
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  padding: 9px 11px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1.5px solid #d7c39d;
  background: #ffffff;
  color: var(--ink);
}

.admin-body .auth-feedback {
  margin-top: 0;
  margin-bottom: 10px;
}

.doc-edit-box {
  width: 100%;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed #e2d1b2;
}

.doc-edit-box input[type="text"] {
  margin-bottom: 6px;
  padding: 7px 9px;
  font-size: 12.5px;
}

.doc-edit-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
