.yd-app {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Welcome back / My calendars strip (compact single-line when present) */
.yd-my-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.yd-my-bar[hidden] { display: none; }

.yd-my-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.yd-my-title {
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.yd-my-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.yd-my-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  font-size: var(--text-sm);
  color: var(--text);
}

.yd-my-chip a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.yd-my-chip a:hover { text-decoration: underline; }

.yd-my-chip-copy {
  background: transparent;
  border: none;
  padding: 0 2px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.yd-my-chip-copy:hover { color: var(--accent); }

/* =========================================================
   OPTION A: SPLIT-SCREEN STAGE (LEFT 62% BOX / RIGHT 38% PANEL)
   ========================================================= */
.yd-split {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.yd-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Frameless Editorial Create Panel (zero nested box cage) */
.yd-studio-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 6px 0;
}

.yd-studio-panel[hidden] { display: none; }

.yd-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.yd-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.yd-field label,
.yd-field-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  line-height: 1.3;
}

.yd-field input,
.yd-field select,
.yd-field textarea,
.yd-modal textarea,
.yd-modal input[type="text"],
.yd-modal input[type="url"],
.yd-modal select {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fffdf9;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.yd-field input:focus,
.yd-field textarea:focus,
.yd-modal textarea:focus,
.yd-modal input:focus,
.yd-modal select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 59, 43, 0.12);
}

.yd-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.yd-check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* Tactile Swatch Pills & Segmented Toggle */
.yd-segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 44px;
  gap: 3px;
}

.yd-segmented-3 {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  background: transparent;
  border: none;
  min-height: 0;
}

.yd-seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}

.yd-seg-btn:hover { color: var(--text); }

.yd-seg-btn[aria-pressed="true"] {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(31, 25, 20, 0.12);
}

.yd-segmented-3 .yd-seg-btn {
  flex: 1 1 auto;
  min-height: 40px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.yd-segmented-3 .yd-seg-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(23, 59, 43, 0.12);
}

.yd-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex-shrink: 0;
  border: 1px solid rgba(31, 25, 20, 0.2);
}

.yd-swatch-pine { background: #163829; }
.yd-swatch-cranberry { background: #8c2320; }
.yd-swatch-parchment { background: #d6c3a3; }

.yd-create-cta {
  width: 100%;
  min-height: 50px;
  font-size: var(--text-body);
}

.yd-toolbar-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.yd-stats {
  font-size: var(--text-sm);
  color: var(--muted);
  font-weight: 500;
}

.yd-progress-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.yd-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 999px;
  transition: width 240ms var(--ease-out);
}

.yd-subtle-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.yd-code-entry-hint {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.yd-code-entry-hint a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.yd-text-action {
  background: transparent;
  border: none;
  padding: 4px 0;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--border-strong);
  cursor: pointer;
  transition: color 160ms var(--ease-out), text-decoration-color 160ms var(--ease-out);
}

.yd-text-action:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.yd-text-action-danger:hover {
  color: var(--accent-2);
  text-decoration-color: var(--accent-2);
}

/* Friend Banner (in right column) */
.yd-banner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent-2);
  border-radius: var(--radius-lg);
}

.yd-banner[hidden] { display: none; }

.yd-banner-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.yd-banner-text {
  font-family: var(--font-serif);
  font-size: var(--text-heading);
  line-height: 1.2;
  color: var(--text);
  margin: 0;
  font-weight: 700;
}

.yd-banner-sub {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.yd-banner-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.yd-banner-actions .btn-primary,
.yd-banner-actions .btn-secondary {
  width: 100%;
}

/* Viral back-calendar success box */
.yd-viral-box {
  padding: 16px 18px;
  background: #fdf9f0;
  border: 1px solid var(--gold);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.yd-viral-box[hidden] { display: none; }

.yd-viral-box strong {
  font-family: var(--font-serif);
  font-size: var(--text-body);
  color: var(--text);
}

/* Owner Share & Hub Panel (right column in live owner mode) */
.yd-owner-hub {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0;
}

.yd-owner-hub[hidden] { display: none; }

.yd-today-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
}

.yd-today-strip p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text);
  font-weight: 500;
  line-height: 1.45;
}

.yd-share-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.yd-share-grid strong {
  font-family: var(--font-serif);
  font-size: var(--text-body);
  color: var(--text);
}

.yd-share-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.yd-share-input {
  flex: 1 1 180px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #ffffff;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text);
}

.yd-share-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.yd-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.yd-pill-btn:hover {
  border-color: var(--accent);
  background: var(--bg);
}

.yd-pill-btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fffdf8;
}

.yd-pill-btn-accent:hover {
  background: #102a1e;
  border-color: #102a1e;
  color: #fffdf8;
}

.yd-subcards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.yd-subcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.yd-subcard[hidden] { display: none; }

.yd-subcard-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.yd-subcard-desc {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

.yd-code-badge {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px dashed var(--border-strong);
  border-radius: 7px;
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-body);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  word-break: break-all;
}

.yd-subcard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.yd-remind-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.yd-remind-row span {
  font-size: var(--text-sm);
  color: var(--muted);
  font-weight: 500;
}

.yd-status-msg {
  font-size: var(--text-sm);
  color: var(--accent);
  margin: 0;
  font-weight: 600;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.yd-status-msg:empty {
  display: none;
  padding: 0;
  border: none;
}

/* =========================================================
   OPTION A: HEIRLOOM PAPER ADVENT BOX + PERFORATED DOORS + WAX SEALS
   ========================================================= */
.yd-calendar-box {
  --box-bg: #122e21;
  --box-bg-top: #1b4332;
  --box-border: #2a5743;
  --box-notch: #153526;
  --box-frame: rgba(226, 194, 130, 0.36);
  --box-ink: #fdf6e9;
  --box-muted: rgba(253, 246, 233, 0.74);

  --door-empty-bg: rgba(250, 243, 230, 0.05);
  --door-empty-border: rgba(232, 200, 138, 0.34);
  --door-empty-hinge: rgba(232, 200, 138, 0.48);
  --door-empty-ink: #f3e4c3;

  --door-filled-bg: linear-gradient(180deg, #fffdf8 0%, #f6ede0 100%);
  --door-filled-border: #dcc7a2;
  --door-filled-hinge: #9e2a22;
  --door-filled-num: #173b2b;
  --door-filled-ink: #221a14;
  --door-filled-muted: #5d5044;

  --seal-bg: radial-gradient(circle at 34% 30%, #cc3e33 0%, #8f221b 78%);
  --seal-shadow: 0 2px 5px rgba(80, 14, 10, 0.38), inset 0 1px 2px rgba(255, 224, 200, 0.45);

  background: linear-gradient(160deg, var(--box-bg-top) 0%, var(--box-bg) 100%);
  border: 1px solid var(--box-border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 26px 56px rgba(16, 40, 29, 0.24), inset 0 1px 0 rgba(255, 245, 220, 0.14);
  transition: background-color 240ms var(--ease-out), border-color 240ms var(--ease-out);
}

/* Cranberry Wax Theme */
.yd-app[data-theme="cranberry"] .yd-calendar-box {
  --box-bg: #4b1515;
  --box-bg-top: #6d201f;
  --box-border: #8a3230;
  --box-notch: #561818;
  --box-frame: rgba(238, 206, 144, 0.38);
  --box-ink: #fff8ee;
  --box-muted: rgba(255, 248, 238, 0.78);
  --door-empty-bg: rgba(255, 246, 232, 0.06);
  --door-empty-border: rgba(240, 208, 146, 0.36);
  --door-empty-hinge: rgba(240, 208, 146, 0.52);
  --door-empty-ink: #fae9c8;
  --door-filled-hinge: #173b2b;
  --door-filled-num: #7b201c;
  --seal-bg: radial-gradient(circle at 34% 30%, #266147 0%, #143627 78%);
  --seal-shadow: 0 2px 5px rgba(12, 36, 24, 0.4), inset 0 1px 2px rgba(210, 245, 225, 0.38);
}

/* Warm Parchment Theme */
.yd-app[data-theme="parchment"] .yd-calendar-box {
  --box-bg: #e1d3ba;
  --box-bg-top: #eee3ce;
  --box-border: #c7b492;
  --box-notch: #e5d8c1;
  --box-frame: rgba(120, 88, 52, 0.28);
  --box-ink: #241912;
  --box-muted: #5c4b3b;
  --door-empty-bg: rgba(255, 250, 242, 0.42);
  --door-empty-border: rgba(120, 88, 52, 0.36);
  --door-empty-hinge: rgba(120, 88, 52, 0.5);
  --door-empty-ink: #3d2c1e;
  --door-filled-bg: linear-gradient(180deg, #ffffff 0%, #fcf7ee 100%);
  --door-filled-border: #cbb690;
  --door-filled-hinge: #9e2a22;
  --door-filled-num: #173b2b;
  box-shadow: 0 20px 44px rgba(72, 52, 28, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.yd-box-frame {
  border: 1px solid var(--box-frame);
  border-radius: 12px;
  padding: 20px;
}

.yd-box-masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--box-frame);
  flex-wrap: wrap;
}

.yd-box-title {
  font-family: var(--font-serif);
  font-size: var(--text-heading);
  font-weight: 700;
  color: var(--box-ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
}

.yd-box-count {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--box-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 24 Perforated Paper Doors Grid */
.yd-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 11px;
}

.yd-door {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  aspect-ratio: 1 / 1.06;
  min-height: 92px;
  padding: 9px 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  transform-origin: left center;
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out), border-color 180ms var(--ease-out), background-color 180ms var(--ease-out);
}

/* Right-edge half-circle thumb notch */
.yd-door::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 6px;
  height: 14px;
  transform: translateY(-50%);
  background: var(--box-notch);
  border-radius: 10px 0 0 10px;
  border: 1px solid var(--door-empty-border);
  border-right: none;
  pointer-events: none;
}

/* Empty Perforated Paper Door */
.yd-door.is-empty {
  justify-content: center;
  align-items: center;
  text-align: center;
  background: var(--door-empty-bg);
  border: 1.25px dashed var(--door-empty-border);
  border-left: 2px solid var(--door-empty-hinge);
  color: var(--door-empty-ink);
}

.yd-door.is-empty:hover {
  border-color: #e8c680;
  background: rgba(250, 243, 230, 0.1);
  transform: perspective(520px) rotateY(-6deg) translateY(-2px);
  box-shadow: 4px 8px 16px rgba(8, 18, 13, 0.24);
}

/* Filled Embossed Cream Paper Door + Crimson Wax Seal */
.yd-door.is-filled {
  background: var(--door-filled-bg);
  border: 1px solid var(--door-filled-border);
  border-left: 3px solid var(--door-filled-hinge);
  color: var(--door-filled-ink);
  box-shadow: 0 5px 14px rgba(8, 18, 13, 0.22);
}

.yd-door.is-filled::after {
  border-color: var(--door-filled-border);
}

.yd-door.is-filled:hover {
  transform: perspective(560px) rotateY(-12deg) translateY(-2px);
  box-shadow: 8px 12px 22px rgba(8, 18, 13, 0.32), -2px 0 14px rgba(244, 210, 128, 0.35);
  border-color: var(--gold);
}

/* Today's door subtle ajar peek & warm golden glow */
.yd-door.is-today.is-filled {
  box-shadow: 0 0 0 2px #f2d282, 6px 10px 20px rgba(8, 18, 13, 0.3);
}

.yd-door.is-today.is-empty {
  border-color: #f2d282;
  box-shadow: 0 0 0 1.5px rgba(242, 210, 130, 0.55);
}

/* Opened Door styles moved to end for cascade clarity */

/* Day 24 Brushed Gold Foil Christmas Eve Door */
.yd-door[data-day="24"].is-empty {
  background: linear-gradient(145deg, #d7b162 0%, #b58836 100%);
  border: 1px solid #f4dd9e;
  border-left: 2.5px solid #f8e7b4;
  color: #291805;
  box-shadow: 0 6px 16px rgba(10, 18, 13, 0.28);
}

.yd-door[data-day="24"].is-empty::after {
  border-color: #f4dd9e;
}

.yd-door-top {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
}

.yd-door.is-empty .yd-door-top {
  justify-content: center;
  align-items: center;
}

.yd-day-num {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: inherit;
}

.yd-door.is-filled .yd-day-num,
.yd-door.is-opened .yd-day-num {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--door-filled-num);
}

/* Realistic Crimson Wax Seal on Filled Doors */
.yd-door-icon {
  display: none;
}

.yd-door.is-filled .yd-door-icon,
.yd-door.is-opened .yd-door-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--seal-bg);
  box-shadow: var(--seal-shadow);
  font-size: 0.72rem;
  line-height: 1;
  flex-shrink: 0;
}

.yd-door.is-opened .yd-door-icon {
  background: #f5ead4;
  border: 1px solid var(--gold);
  box-shadow: none;
}

.yd-door[data-day="24"].is-empty .yd-door-icon {
  display: inline;
  position: absolute;
  top: 7px;
  right: 8px;
  font-size: 0.85rem;
}

.yd-door-body {
  width: 100%;
  margin-top: auto;
  padding-top: 6px;
}

.yd-door.is-empty .yd-door-body {
  display: none;
}

.yd-door-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
}

.yd-door-tag {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--door-filled-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yd-door-meta {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.8125rem;
  line-height: 1.25;
  color: var(--door-filled-muted);
}

.yd-door-meta:empty {
  display: none;
}

/* Box footer utility bar */
.yd-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--box-frame);
  font-size: var(--text-sm);
  color: var(--box-muted);
  flex-wrap: wrap;
}

.yd-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.yd-link-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  color: var(--box-ink);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.yd-link-btn:hover { color: #f5d887; }

/* Festive Greeting Card Modal */
.yd-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 14, 12, 0.64);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.yd-modal-backdrop[hidden] { display: none; }

.yd-modal {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 64px rgba(12, 10, 8, 0.36);
  padding: 24px;
}

.yd-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.yd-modal-head h2 {
  margin: 0;
  font-size: var(--text-heading);
}

.yd-close-btn {
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.yd-close-btn:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.yd-note-card {
  position: relative;
  background: #fffdf8;
  border: 1px solid #d9c39b;
  border-top: 4px solid var(--accent-2);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(31, 25, 20, 0.08);
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0 31px,
    rgba(179, 139, 77, 0.12) 31px 32px
  );
}

.yd-note-stamp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: radial-gradient(circle at 34% 30%, #cc3e33 0%, #8f221b 78%);
  box-shadow: 0 3px 8px rgba(80, 14, 10, 0.34);
  font-size: 1.25rem;
  line-height: 1;
  margin-bottom: 14px;
}

.yd-note-message {
  font-family: var(--font-serif);
  font-size: var(--text-body);
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 18px;
  white-space: pre-wrap;
}

.yd-note-author {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--accent-2);
  margin: 0;
}

.yd-note-link-wrap {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 600;
}

.yd-prompts-label {
  margin: 0 0 8px;
  font-size: var(--text-sm);
  color: var(--muted);
  font-weight: 500;
}

.yd-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.yd-prompt-chip {
  padding: 7px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}

.yd-prompt-chip:hover {
  border-color: var(--accent);
  background: #ffffff;
}

.yd-modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.yd-modal-form textarea {
  min-height: 108px;
  resize: vertical;
  font-size: var(--text-body);
  line-height: 1.65;
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0 26px,
    rgba(179, 139, 77, 0.14) 26px 27px
  );
}

.yd-char-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.yd-char-count {
  font-size: var(--text-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.yd-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
  flex-wrap: wrap;
}

.yd-viral-opt {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

@media (prefers-reduced-motion: reduce) {
  .yd-door, .yd-progress-fill, .yd-pill-btn { transition: none; }
}

@media (max-width: 980px) {
  .yd-split {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .yd-side {
    order: -1;
  }
  .yd-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 11px;
  }
}

@media (max-width: 640px) {
  .yd-calendar-box { padding: 12px; border-radius: 16px; }
  .yd-box-frame { padding: 14px 12px; }
  .yd-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  .yd-door { min-height: 88px; padding: 8px; }
  .yd-day-num { font-size: 1.25rem; }
  .yd-door.is-filled .yd-day-num, .yd-door.is-opened .yd-day-num { font-size: 1.05rem; }
  .yd-modal { padding: 18px; }
  .yd-modal-actions { flex-direction: column-reverse; }
  .yd-modal-actions .btn-primary, .yd-modal-actions .btn-secondary { width: 100%; }
}

/* Global [hidden] safeguard inside tool */
.yd-app [hidden] {
  display: none !important;
}

.yd-field textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.5;
}

/* Selected empty door highlight in Friend inline editor mode */
.yd-door.is-empty.is-selected {
  border: 2px solid #fff8ea;
  background: rgba(250, 243, 230, 0.16);
  box-shadow: 0 0 0 3px rgba(242, 210, 130, 0.45), 0 8px 18px rgba(8, 18, 13, 0.28);
  transform: translateY(-2px);
}

.yd-app[data-theme="parchment"] .yd-door.is-empty.is-selected {
  border: 2px solid var(--accent);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 0 0 3px rgba(29, 71, 56, 0.18), 0 6px 14px rgba(32, 24, 16, 0.14);
}

/* Friend inline studio panel (matches creator .yd-studio-panel layout) */
.yd-friend-panel {
  gap: 14px;
}

.yd-friend-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.yd-friend-door-head {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.25;
}

.yd-friend-door-sub {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

.yd-friend-form-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.yd-stamp-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.yd-stamp-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  padding: 0;
}

.yd-stamp-btn:hover {
  border-color: var(--accent-2);
  transform: translateY(-1px);
}

.yd-stamp-btn[aria-pressed="true"] {
  border-color: var(--accent-2);
  background: #fdf6ec;
  box-shadow: 0 0 0 2px rgba(158, 52, 43, 0.22);
  transform: scale(1.06);
}

.yd-friend-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
}

.yd-friend-done {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.yd-friend-done-text {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text);
  line-height: 1.5;
}

/* Opened Door — clean stationery card (centered number, top-right seal, bottom name strip) */
.yd-door.is-opened {
  position: relative;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #fffdf8 0%, #f6ecd7 100%);
  border: 1.5px solid #d4af64;
  color: var(--door-filled-ink);
  box-shadow: 0 4px 12px rgba(8, 18, 13, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

/* Subtle miniature stationery lines beneath the centered day number */
.yd-door.is-opened::before {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 30px;
  height: 11px;
  background:
    linear-gradient(to right, rgba(166, 132, 72, 0.38), rgba(166, 132, 72, 0.38)) 0 0 / 100% 1.5px no-repeat,
    linear-gradient(to right, rgba(166, 132, 72, 0.28), rgba(166, 132, 72, 0.28)) center 5px / 76% 1.5px no-repeat,
    linear-gradient(to right, rgba(166, 132, 72, 0.2), rgba(166, 132, 72, 0.2)) center 10px / 52% 1.5px no-repeat;
  pointer-events: none;
}

.yd-door.is-opened::after {
  display: none;
}

.yd-door.is-opened:hover {
  transform: translateY(-2px);
  border-color: #e8c675;
  box-shadow: 0 8px 18px rgba(8, 18, 13, 0.24), 0 0 0 2px rgba(242, 210, 130, 0.35);
}

.yd-door.is-opened.is-today {
  box-shadow: 0 0 0 2px #f2d282, 0 6px 16px rgba(8, 18, 13, 0.25);
}

.yd-door.is-opened .yd-door-top {
  flex: 1 1 auto;
  width: 100%;
  align-items: center;
  justify-content: center;
  padding: 6px 8px 14px;
}

.yd-door.is-opened .yd-day-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: #8f6724;
  line-height: 1;
}

.yd-door.is-opened .yd-door-icon {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  background: #fffdf8;
  border: 1.5px solid #d4af64;
  box-shadow: 0 1px 3px rgba(60, 42, 16, 0.14);
  font-size: 0.7rem;
}

.yd-door.is-opened .yd-door-body {
  width: 100%;
  margin-top: 0;
  padding: 4px 6px 5px;
  background: rgba(255, 253, 249, 0.96);
  border-top: 1px solid rgba(212, 175, 100, 0.42);
}

.yd-door.is-opened .yd-door-tag {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--door-filled-ink);
}

.yd-door.is-opened .yd-door-meta {
  display: none;
}

@media (max-width: 640px) {
  .yd-door.is-opened .yd-day-num { font-size: 1.3rem; }
  .yd-door.is-opened::before { bottom: 26px; }
}