/* Two-Column Storybook Invite Studio + Tree Code Lookup */
dialog:has(.tree-invites--studio) {
  width: min(820px, 95vw);
  max-width: 95vw;
}
.tree-invites {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #2a2132;
}
.invite-studio-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 16px;
}
.tree-invites .dlg-title {
  margin: 0;
  font-size: clamp(24px, 3vw, 31px);
  color: #2a2132;
}
.invite-tree-name {
  margin: 0;
  font: 700 18px/1.2 var(--display, Georgia, serif);
  color: #9b1c32;
  background: #ffe8ec;
  padding: 4px 12px;
  border-radius: 999px;
}

.invite-studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 18px;
  align-items: start;
}
.invite-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* Golden Ticket 4-Keycap Tree Code Card */
.invite-code-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 18px 16px 15px;
  border-radius: 18px;
  background: linear-gradient(145deg, #1d2f60 0%, #111e42 100%);
  border: 1.5px solid rgba(242, 196, 90, 0.48);
  color: #fff;
  box-shadow: 0 10px 24px rgba(12, 20, 48, 0.2);
  text-align: center;
}
.invite-code-kicker {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #ffd573;
}
.invite-keycaps {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.code-keycap {
  display: grid;
  place-items: center;
  width: 50px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f5e7cb);
  border: 1.5px solid #dfc184;
  box-shadow: 0 4px 0 #c59c52, 0 8px 16px rgba(0, 0, 0, 0.28);
  font: 700 30px/1 var(--display, Georgia, serif);
  color: #9b1c32;
}
.invite-how-inline {
  font-size: 12.5px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.82);
}

/* Warm Lined Stationery Invitation Copy + URL Box */
.invite-message-box {
  padding: 15px 16px;
  border-radius: 16px;
  border: 1.5px solid #e6d4b1;
  background: repeating-linear-gradient(180deg, #fffdf8 0 27px, #f5ead4 27px 28px);
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #e6d4b1;
}
.invite-box-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  color: #8c5c10;
  background: #fff3d6;
  padding: 2px 9px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.invite-letter {
  margin: 0 0 12px;
  font: 600 15.5px/1.55 var(--display, Georgia, serif);
  color: #2a2132;
  white-space: pre-wrap;
}
.invite-url-bar input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1.5px dashed #d6be92;
  background: #fffefb;
  color: #2a2132;
  font: 600 13px/1.3 ui-monospace, Menlo, Consolas, monospace;
  cursor: pointer;
}

.invite-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.invite-actions .btn {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  min-height: 44px;
  padding: 9px 10px;
  font-size: 13.5px;
}
.invite-actions > .invite-primary-copy,
.invite-actions > .invite-save-btn {
  grid-column: 1 / -1;
  font-size: 15.5px;
  min-height: 50px;
}

/* Right Column: Auto-Rendered Story Poster Card */
.invite-col--poster {
  padding: 15px 16px 16px;
  border-radius: 18px;
  border: 1.5px solid #e6d6b8;
  background: linear-gradient(180deg, #fffefb, #f8eedb);
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #e6d6b8;
}
.invite-poster-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.invite-poster-heading h3 {
  font: 700 17px/1.2 var(--display, Georgia, serif);
  margin: 0;
  color: #2a2132;
}
.invite-poster-heading > span {
  font-size: 11px;
  font-weight: 700;
  color: #7c6f82;
  background: #efe4ce;
  padding: 2px 8px;
  border-radius: 999px;
}
.invite-poster-stage {
  display: grid;
  place-items: center;
  min-height: 290px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(16, 27, 58, 0.05);
  border: 1px dashed #dfd0b3;
}
.invite-poster-skeleton {
  text-align: center;
  padding: 28px 12px;
}
.invite-poster-skeleton[hidden] { display: none !important; }
.poster-spin {
  display: inline-block;
  font-size: 32px;
  animation: posterBob 1.2s ease-in-out infinite;
}
@keyframes posterBob { 50% { transform: translateY(-5px) scale(1.06); } }
.invite-status {
  font-size: 13px;
  color: #665c6d;
  margin: 8px 0 0;
}
.invite-poster-preview {
  margin: 0;
  text-align: center;
  width: 100%;
}
.invite-poster-preview[hidden] { display: none !important; }
.invite-poster-preview img {
  display: block;
  width: min(100%, 225px);
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  margin-inline: auto;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(12, 20, 48, 0.28);
  background: #132046;
  -webkit-touch-callout: default;
  user-select: auto;
}
.poster-longpress-tip {
  margin: 10px auto 0;
  padding: 7px 10px;
  border-radius: 10px;
  background: #fff6df;
  border: 1px solid #e6cd93;
  color: #704c10;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}
.poster-longpress-tip[hidden] { display: none !important; }
.invite-copy-buffer {
  position: fixed;
  inset-inline-start: 0;
  top: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  font-size: 16px;
}

/* Tree Code Form Lookup */
.tree-code-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  align-items: end;
  width: 100%;
  max-width: 470px;
  min-width: 0;
  margin: 0;
  text-align: start;
}
.tree-code-form [name="code"] {
  min-width: 0;
  width: 100%;
  height: 48px;
  padding: 10px 12px;
  border: 1.5px solid #d5c3a1;
  border-radius: 12px;
  background: #fff;
  color: #2a2132;
  font: 700 22px/1 var(--display, Georgia, serif);
  letter-spacing: .22em;
  text-transform: uppercase;
  direction: ltr;
  text-align: center;
}
.tree-code-form [role="status"] {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  font-size: 12.5px;
  color: #9b1c32;
}
.tree-code-form [role="status"]:empty { display: none; }

@media (max-width: 700px) {
  .invite-studio-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .code-keycap { width: 44px; height: 50px; font-size: 26px; }
  .invite-poster-preview img { width: min(100%, 200px); }
}
@media (max-width: 380px) {
  .tree-code-form { grid-template-columns: minmax(0, 1fr); }
  .tree-code-form button[type="submit"] { max-width: none; width: 100%; }
}
