
:root {
  --bg: #FFF9F2;
  --surface: #FFFFFF;
  --soft: #F7EFE4;
  --ink: #231815;
  --ink-2: #574843;
  --muted: #85746E;
  --line: #E9DDD0;
  --accent: #C8283F;
  --accent-d: #9E1B2F;
  --accent-soft: #FEF1F3;
  --pine: #1E6B45;
  --pine-soft: #ECF8F1;
  --gold: #D49423;
  --gold-soft: #FFF8E6;
  --frame-bg: linear-gradient(155deg, #6E3E22 0%, #4C2815 100%);
  --frame-border: #8F5632;
  --door-empty-bg: rgba(255, 249, 240, 0.12);
  --door-empty-border: rgba(255, 232, 200, 0.34);
  --door-empty-text: #FFF3DF;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 28px rgba(45, 24, 16, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="snowy"] {
  --bg: #F3F8FC;
  --soft: #E6F0F8;
  --ink: #132234;
  --ink-2: #40556B;
  --muted: #6C8299;
  --line: #D4E2EE;
  --accent: #1D63B8;
  --accent-d: #154A8C;
  --accent-soft: #EBF4FF;
  --frame-bg: linear-gradient(155deg, #1E3A5F 0%, #11233B 100%);
  --frame-border: #4D77A8;
  --door-empty-bg: rgba(235, 246, 255, 0.12);
  --door-empty-border: rgba(190, 224, 255, 0.36);
  --door-empty-text: #EBF6FF;
}

[data-theme="candycane"] {
  --bg: #FFF7F8;
  --soft: #FDECEF;
  --ink: #2A141A;
  --ink-2: #613942;
  --muted: #8F646E;
  --line: #F2D6DC;
  --accent: #D9264A;
  --accent-d: #AE1836;
  --accent-soft: #FFEBEF;
  --frame-bg: repeating-linear-gradient(135deg, #B91C3B 0 18px, #981530 18px 36px);
  --frame-border: #F5C2CC;
  --door-empty-bg: rgba(255, 255, 255, 0.16);
  --door-empty-border: rgba(255, 240, 243, 0.45);
  --door-empty-text: #FFFFFF;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea { font-family: inherit; font-size: inherit; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 18px; }
.wrap-sm { max-width: 680px; margin: 0 auto; padding: 0 18px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 249, 242, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
[data-theme="snowy"] .site-header { background: rgba(243, 248, 252, 0.9); }
[data-theme="candycane"] .site-header { background: rgba(255, 247, 248, 0.9); }
.hdr-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.logo:hover { text-decoration: none; }
.hdr-nav { display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 600; }
.hdr-nav a { color: var(--ink-2); }
.hdr-pill {
  background: var(--accent-soft);
  color: var(--accent-d) !important;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(200, 40, 63, 0.2);
}

/* Hero */
.hero { padding: 34px 0 28px; text-align: center; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--pine);
  background: var(--pine-soft);
  border: 1px solid rgba(30, 107, 69, 0.2);
  padding: 5px 13px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 900;
  margin-bottom: 12px;
}
.hero-lead {
  font-size: 17px;
  color: var(--ink-2);
  max-width: 580px;
  margin: 0 auto 24px;
}

/* Creation Card */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.create-card {
  max-width: 540px;
  margin: 0 auto 22px;
  text-align: left;
}
.field-label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.input, .textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  background: #FFF;
  color: var(--ink);
  font-size: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 40, 63, 0.12);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }

.theme-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 8px 0 18px;
}
.theme-opt {
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  background: #FFF;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  transition: all 0.15s;
}
.theme-opt .swatch {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.theme-opt[data-pick-theme="gingerbread"] .swatch { background: #6E3E22; }
.theme-opt[data-pick-theme="snowy"] .swatch { background: #1E3A5F; }
.theme-opt[data-pick-theme="candycane"] .swatch { background: #C8283F; }
.theme-opt.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-d);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1.5px solid var(--line);
  background: #FFF;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, border-color 0.15s;
  text-decoration: none;
}
.btn:hover { background: var(--soft); text-decoration: none; }
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFF;
}
.btn-primary:hover { background: var(--accent-d); border-color: var(--accent-d); color: #FFF; }
.btn-pine {
  background: var(--pine);
  border-color: var(--pine);
  color: #FFF;
}
.btn-pine:hover { background: #155335; color: #FFF; }
.btn-gold {
  background: linear-gradient(135deg, #D99A2B, #B46F0F);
  border-color: #B46F0F;
  color: #FFF;
}
.btn-block { width: 100%; }
.btn-sm { padding: 8px 13px; font-size: 13.5px; border-radius: 10px; }
.link-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
}

/* Calendar Board */
.board-shell {
  background: var(--frame-bg);
  border: 4px solid var(--frame-border);
  border-radius: 24px;
  padding: 18px 16px 20px;
  box-shadow: 0 18px 42px rgba(24, 15, 10, 0.18);
  margin: 18px 0 22px;
  color: #FFF;
}
.board-shell.golden {
  background: linear-gradient(155deg, #8F6113 0%, #593907 100%);
  border-color: #F6D57B;
}
.board-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 0 4px;
}
.board-title { font-size: clamp(20px, 3.6vw, 28px); font-weight: 900; letter-spacing: -0.02em; }
.board-sub { font-size: 13.5px; opacity: 0.88; }
.progress-pill {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.doors-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.door {
  position: relative;
  aspect-ratio: 1 / 1.08;
  border-radius: 14px;
  border: 1.5px dashed var(--door-empty-border);
  background: var(--door-empty-bg);
  color: var(--door-empty-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s, background 0.14s;
  text-align: center;
  overflow: hidden;
}
.door:hover { transform: translateY(-2px); background: rgba(255,255,255,0.2); }
.door-num {
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}
.door-hint {
  font-size: 11px;
  opacity: 0.78;
  margin-top: 4px;
  font-weight: 600;
}

/* Filled doors */
.door.filled {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.35);
  background: linear-gradient(155deg, #C8283F 0%, #971A2D 100%);
  color: #FFF;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}
.door.filled.alt-1 { background: linear-gradient(155deg, #21764B 0%, #155133 100%); }
.door.filled.alt-2 { background: linear-gradient(155deg, #C98B22 0%, #996512 100%); }
.door.filled.alt-3 { background: linear-gradient(155deg, #5F3D8D 0%, #412764 100%); }
.door.filled.alt-4 { background: linear-gradient(155deg, #2A63A8 0%, #1B4272 100%); }

/* Special wrappings */
.door.wrap-gold {
  background: linear-gradient(135deg, #F8DC88 0%, #D99A2B 52%, #9B6510 100%) !important;
  border-color: #FFF4C7 !important;
  color: #362004 !important;
}
.door.wrap-frosted {
  background: linear-gradient(145deg, #CBE8FF 0%, #6DA8DB 55%, #3C6FA1 100%) !important;
  border-color: #EFF8FF !important;
  color: #0D2742 !important;
}
.door.wrap-aurora {
  background: linear-gradient(145deg, #22C55E 0%, #2563EB 52%, #7C3AED 100%) !important;
  border-color: #C4B5FD !important;
  color: #FFF !important;
}

/* Ribbon cross on filled doors */
.door.filled::before, .door.filled::after {
  content: "";
  position: absolute;
  background: rgba(255, 236, 179, 0.22);
  pointer-events: none;
}
.door.filled::before { width: 10px; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); }
.door.filled::after { height: 10px; left: 0; right: 0; top: 48%; }

.door-corner {
  position: absolute;
  top: 5px;
  left: 7px;
  font-size: 11px;
  font-weight: 800;
  opacity: 0.9;
  z-index: 1;
}
.door-lock {
  position: absolute;
  top: 5px;
  right: 6px;
  font-size: 11px;
  z-index: 1;
}
.door-sticker { font-size: 24px; line-height: 1; position: relative; z-index: 1; margin-top: 8px; }
.door-who {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 800;
  max-width: 92%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.22);
  color: #FFF;
  padding: 2px 6px;
  border-radius: 999px;
}
.door.unlock-ready {
  box-shadow: 0 0 0 2px #FDE68A, 0 8px 18px rgba(0,0,0,0.24);
}

/* Share Hub */
.share-hub {
  margin-bottom: 18px;
}
.share-url-row {
  display: flex;
  gap: 8px;
  margin: 10px 0 12px;
}
.share-url-input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 13.5px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--soft);
  color: var(--ink);
}
.share-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.code-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gold-soft);
  border: 1px solid rgba(212, 148, 35, 0.35);
  color: #7C4A05;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  margin-top: 10px;
}
.code-pill code {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.08em;
  color: #5C3402;
}
.nudge {
  font-size: 13.5px;
  color: var(--pine);
  background: var(--pine-soft);
  border: 1px solid rgba(30, 107, 69, 0.18);
  border-radius: 10px;
  padding: 9px 12px;
  margin-top: 12px;
  font-weight: 600;
}
.inapp-tip {
  font-size: 13px;
  color: var(--ink-2);
  background: var(--gold-soft);
  border: 1px solid rgba(212, 148, 35, 0.3);
  border-radius: 10px;
  padding: 9px 12px;
  margin-top: 10px;
}

/* Sections on homepage */
.sec { padding: 30px 0; }
.sec-title {
  font-size: clamp(22px, 3.6vw, 28px);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  text-align: center;
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 18px;
}
.step-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 16px;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-d);
  font-weight: 900;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.step-card h3 { font-size: 16px; margin-bottom: 6px; }
.step-card p { font-size: 14px; color: var(--ink-2); }

.faq-list { max-width: 720px; margin: 16px auto 0; display: grid; gap: 10px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 18px;
}
.faq-item summary {
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.faq-item summary::after { content: "+"; font-size: 20px; color: var(--muted); }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin-top: 10px; font-size: 14.5px; color: var(--ink-2); }

/* Code lookup box */
.code-lookup {
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
}
.code-lookup .btn { white-space: nowrap; flex-shrink: 0; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(20, 12, 10, 0.58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: #FFF;
  border-radius: 20px;
  width: 100%;
  max-width: 470px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px 22px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
  position: relative;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.modal-title { font-size: 20px; font-weight: 900; }
.modal-close {
  border: none;
  background: var(--soft);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 18px;
  cursor: pointer;
  color: var(--ink);
}

.sticker-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin: 6px 0 14px;
}
.sticker-btn {
  border: 1.5px solid var(--line);
  background: #FFF;
  border-radius: 10px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sticker-btn.active { border-color: var(--accent); background: var(--accent-soft); }

.wrap-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 6px 0 14px;
}
.wrap-btn {
  border: 1.5px solid var(--line);
  background: #FFF;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wrap-btn.active { border-color: var(--accent); background: var(--accent-soft); }
.wrap-cost { font-size: 11.5px; color: var(--muted); }

.ideas-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}
.idea-chip {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink-2);
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.idea-chip:hover { border-color: var(--accent); color: var(--accent-d); }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 14px;
  margin: 10px 0;
  cursor: pointer;
}
.check-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.viral-check {
  background: var(--pine-soft);
  border: 1.5px solid rgba(30, 107, 69, 0.28);
  border-radius: 12px;
  padding: 11px 12px;
  font-weight: 700;
  color: #12482D;
}

.note-letter {
  background: #FFFDF7;
  border: 1.5px solid #EFE0C4;
  border-radius: 16px;
  padding: 20px 18px;
  margin: 12px 0;
  text-align: center;
}
.note-body {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 12px 0;
}
.note-from { font-size: 14px; font-weight: 700; color: var(--muted); }

.err-msg { color: var(--accent-d); font-size: 13.5px; font-weight: 700; margin: 8px 0; }
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #1C1917;
  color: #FFF;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  z-index: 100;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
}
.toast[hidden] { display: none; }

.story-preview {
  width: 100%;
  max-height: 55vh;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--line);
  margin: 10px 0 14px;
  display: block;
}

.reply-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.site-footer {
  margin-top: 48px;
  padding: 28px 0 36px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  margin-bottom: 10px;
}
.foot-links a { color: var(--ink-2); }

/* Mobile */
@media (max-width: 720px) {
  .doors-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .steps-grid { grid-template-columns: repeat(2, 1fr); }
  .share-grid { grid-template-columns: repeat(2, 1fr); }
  .sticker-row { grid-template-columns: repeat(4, 1fr); }
  .board-shell { padding: 14px 10px 16px; border-radius: 18px; }
  .door-num { font-size: 18px; }
  .door-sticker { font-size: 21px; }
  .hdr-nav a.hide-sm { display: none; }
}
