/* ==================================================================
   FINISH — the last layer of the design language.
   Loaded after styles / atelier / extras. Deliberately narrow selectors:
   the social share sheet keeps its reference layout and is only given
   a little more material depth here.
   ================================================================== */

/* ---------------------------------------------------------------- *
 * 1. Editor chrome — one clear hierarchy instead of a row of buttons
 * ---------------------------------------------------------------- */
.editor-top {
  position: relative; z-index: 12;
  background: linear-gradient(180deg, rgba(8, 30, 23, .96), rgba(6, 24, 19, .88));
  border-bottom: 1px solid rgba(219, 185, 121, .13);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .26);
  padding: 0 22px; gap: 18px;
}
.editor-top::after {
  content: ""; position: absolute; left: 8%; right: 8%; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 214, 155, .42), transparent);
  pointer-events: none;
}
.editor-back {
  width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 11px;
  border: 1px solid rgba(219, 185, 121, .18) !important;
  background: rgba(247, 241, 230, .035) !important;
  color: var(--ivory-dim) !important; font-size: 1.05rem;
  transition: background .2s, color .2s, border-color .2s, transform .2s;
}
.editor-back:hover { color: var(--gold-bright) !important; border-color: rgba(219, 185, 121, .5) !important; transform: translateX(-2px); }
.editor-ident { display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.editor-ident .room-name {
  font-family: var(--serif); font-size: 1.42rem; font-weight: 600; line-height: 1.1;
  letter-spacing: -.015em; color: var(--ivory);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.editor-ident .sub {
  font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(247, 241, 230, .4); font-weight: 600;
}
.editor-top .avatar-stack .avatar.sm {
  width: 27px; height: 27px; font-size: .8rem;
  border: 1px solid rgba(219, 185, 121, .3); box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.editor-top-actions { gap: 6px; }
.editor-top-actions .btn-ghost:not(.btn-icon) {
  min-height: 36px; padding: 0 14px; font-size: .78rem;
  border-radius: 10px; color: var(--text-dim);
}
.editor-top-actions .btn-primary { min-height: 38px; padding: 0 18px; border-radius: 10px; font-size: .82rem; }
.editor-top-actions .btn-ghost.btn-icon { width: 32px; height: 32px; min-height: 32px; }
.top-share { gap: 7px; }
.top-share .sh-ic { color: var(--gold-bright); font-size: .95rem; line-height: 1; }
.editor-top .view-switch { padding: 3px; border-radius: 11px; }
.editor-top .view-switch .btn { min-height: 30px; padding: 0 14px; font-size: .76rem; }

/* ---------------------------------------------------------------- *
 * 2. Stage — a pool of warm light, quieter chrome
 * ---------------------------------------------------------------- */
.editor-body::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background:
    radial-gradient(560px 470px at 50% 40%, rgba(240, 214, 155, .085), transparent 72%),
    radial-gradient(340px 180px at 50% 96%, rgba(240, 214, 155, .05), transparent 75%);
  mix-blend-mode: screen;
}
.stage-badge {
  top: 20px; padding: 7px 16px 7px 12px; letter-spacing: .02em;
  font-size: .7rem; font-weight: 600;
  background: rgba(5, 22, 17, .7); border: 1px solid rgba(219, 185, 121, .24);
  color: var(--gold-bright);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 248, 230, .07);
}
.stage-badge::before { content: "✦"; margin-right: 7px; opacity: .8; }
.stage-tools { top: 18px; right: 22px; gap: 7px; }
.stage-tools .btn {
  width: 36px; height: 36px; min-height: 36px; border-radius: 11px;
  font-size: .86rem; color: var(--gold-bright);
}
.stage-hint {
  bottom: 22px; padding: 7px 17px; border-radius: 999px;
  background: rgba(4, 18, 14, .5); color: rgba(247, 241, 230, .46);
  font-size: .7rem; letter-spacing: .02em;
}
.selection-toolbar { top: 70px; }
.editor:not(.has-selection) .selection-toolbar { display: none; }

/* Panels: a visible "atelier" eyebrow and a hairline under it. */
.panel { border-radius: 18px; }
.panel-inner { padding: 20px 17px 40px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: -2px 0 18px; padding-bottom: 13px;
  border-bottom: 1px solid rgba(247, 241, 230, .09);
}
.panel-head .ph-kicker {
  font-size: .6rem; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(240, 214, 155, .72); font-weight: 700;
}
.panel-head .ph-count {
  font-size: .66rem; color: rgba(247, 241, 230, .38); font-variant-numeric: tabular-nums;
}
.panel-title { margin-top: 0; }

/* Search field gets a real magnifier and a softer surface. */
.search-wrap { position: relative; margin-bottom: 13px; }
.search-wrap::before {
  content: ""; position: absolute; left: 13px; top: 50%; width: 13px; height: 13px;
  transform: translateY(-50%); pointer-events: none; opacity: .55;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23dbb979' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.6'/%3E%3Cpath d='m10.5 10.5 3.4 3.4'/%3E%3C/svg%3E");
}
.search-wrap .input { padding-left: 35px !important; background: rgba(3, 16, 12, .42); }
.cat-tab { font-size: .71rem; padding: 6px 10px; }
.asset-tile {
  position: relative; overflow: hidden;
  border-radius: 13px;
  background:
    radial-gradient(circle at 50% 24%, rgba(240, 214, 155, .14), transparent 62%),
    linear-gradient(170deg, rgba(20, 55, 43, .58), rgba(3, 16, 12, .5));
}
.asset-tile::before {
  content: ""; position: absolute; left: 12%; right: 12%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 214, 155, .5), transparent);
}
.asset-tile canvas { transition: transform .24s cubic-bezier(.2, .8, .2, 1), filter .24s; }
.asset-tile:hover canvas { transform: translateY(-3px) scale(1.06); filter: drop-shadow(0 9px 12px rgba(0, 0, 0, .5)); }
.asset-tile .add-mark {
  opacity: 0; transform: scale(.8); transition: opacity .2s, transform .2s;
  color: var(--gold-bright); text-shadow: 0 1px 6px rgba(0, 0, 0, .5);
}
.asset-tile:hover .add-mark { opacity: 1; transform: scale(1); }

/* ---------------------------------------------------------------- *
 * 3. Inspector idle state — teach, don't just say "nothing selected"
 * ---------------------------------------------------------------- */
.guide-card {
  border-radius: 14px; padding: 18px 16px 16px;
  background: radial-gradient(circle at 50% 0%, rgba(219, 185, 121, .1), transparent 65%), rgba(3, 16, 12, .34);
  border: 1px solid rgba(219, 185, 121, .14);
}
.guide-card .gc-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  margin-bottom: 12px; color: var(--gold-bright); font-size: 1rem;
  background: rgba(219, 185, 121, .12); border: 1px solid rgba(219, 185, 121, .22);
}
.guide-card h4 { font-size: 1.08rem; margin: 0 0 5px; }
.guide-card > p { font-size: .74rem; color: rgba(247, 241, 230, .48); line-height: 1.6; margin: 0 0 14px; }
.guide-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.guide-steps li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: .74rem; line-height: 1.5; color: rgba(247, 241, 230, .66);
}
.guide-steps i {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-style: normal;
  font-size: .62rem; font-weight: 700; color: var(--night);
  background: linear-gradient(150deg, var(--gold-bright), var(--gold-deep));
}
.mini-stat { font-size: .78rem; }
.mini-stat b { color: var(--ivory); font-weight: 600; }
.mini-stat b.gold { color: var(--gold-bright); }

/* ---------------------------------------------------------------- *
 * 4. The two crafted cards (created / lit)
 * ---------------------------------------------------------------- */
.wk-overlay {
  position: fixed; inset: 0; z-index: 165;
  display: grid; place-items: center; padding: 20px;
  padding-bottom: calc(20px + var(--safe-b));
  /* Deliberately light: the editor and its tree stay visible behind the card,
     so creating a tree still feels like arriving in the decorating room. */
  background: rgba(2, 10, 8, .42);
  -webkit-backdrop-filter: blur(4px) saturate(1.05); backdrop-filter: blur(4px) saturate(1.05);
  animation: wk-fade .24s ease both;
}
@keyframes wk-fade { from { opacity: 0; } to { opacity: 1; } }
.wk-card {
  position: relative; width: min(468px, 100%);
  max-height: calc(100dvh - 40px); overflow-y: auto; overscroll-behavior: contain;
  padding: 26px 28px 24px; border-radius: 26px; text-align: center;
  background:
    radial-gradient(520px 240px at 50% -14%, rgba(240, 214, 155, .16), transparent 68%),
    linear-gradient(168deg, rgba(24, 63, 49, .97), rgba(8, 30, 23, .985) 62%, rgba(5, 22, 17, .99));
  border: 1px solid rgba(219, 185, 121, .3);
  box-shadow: 0 40px 110px rgba(0, 0, 0, .62),
              0 0 70px rgba(219, 185, 121, .09),
              inset 0 1px 0 rgba(255, 248, 230, .13);
  animation: wk-rise .42s cubic-bezier(.18, .9, .24, 1) both;
  scrollbar-width: thin; scrollbar-color: rgba(219, 185, 121, .3) transparent;
}
.wk-card::before {
  content: ""; position: absolute; left: 15%; right: 15%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 214, 155, .75), transparent);
}
.wk-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: .045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes wk-rise { from { opacity: 0; transform: translateY(22px) scale(.97); } to { opacity: 1; transform: none; } }
.wk-close {
  position: absolute; top: 15px; right: 15px; z-index: 3;
  width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center;
  color: rgba(247, 241, 230, .55); background: rgba(247, 241, 230, .05);
  border: 1px solid rgba(247, 241, 230, .1); transition: color .2s, background .2s;
}
.wk-close svg { width: 15px; height: 15px; }
.wk-close:hover { color: var(--ivory); background: rgba(247, 241, 230, .13); }
.wk-art { position: relative; height: 108px; display: grid; place-items: center; margin: 0 auto 2px; }
.wk-tree { width: 104px; height: 116px; overflow: visible; filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .45)); animation: wk-breathe 4.6s ease-in-out infinite; }
@keyframes wk-breathe { 0%, 100% { opacity: .93; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.wk-eyebrow {
  font-size: .64rem; letter-spacing: .21em; font-weight: 700; text-transform: uppercase;
  color: var(--gold-bright); opacity: .95; margin-bottom: 9px;
}
.wk-title {
  font-family: var(--serif); font-size: clamp(1.9rem, 5vw, 2.35rem);
  font-weight: 600; line-height: 1.06; letter-spacing: -.025em;
  color: var(--ivory); margin: 0 0 9px;
}
.wk-lede {
  font-size: .84rem; line-height: 1.65; color: rgba(247, 241, 230, .62);
  max-width: 36ch; margin: 0 auto 20px;
}
.wk-plays { display: grid; gap: 8px; margin-bottom: 18px; text-align: left; }
.wk-play {
  display: flex; align-items: center; gap: 13px; width: 100%;
  padding: 12px 14px; border-radius: 14px; text-align: left;
  border: 1px solid rgba(247, 241, 230, .1); background: rgba(3, 16, 12, .34);
  transition: border-color .2s, background .2s, transform .2s, box-shadow .2s;
  animation: wk-play-in .4s cubic-bezier(.2, .8, .2, 1) both;
}
.wk-play:nth-child(1) { animation-delay: .08s; }
.wk-play:nth-child(2) { animation-delay: .15s; }
.wk-play:nth-child(3) { animation-delay: .22s; }
@keyframes wk-play-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
.wk-play:hover { border-color: rgba(219, 185, 121, .46); background: rgba(219, 185, 121, .075); transform: translateX(3px); }
.wk-play.is-primary {
  border-color: rgba(219, 185, 121, .42);
  background: linear-gradient(100deg, rgba(219, 185, 121, .13), rgba(219, 185, 121, .035));
  box-shadow: inset 0 1px 0 rgba(255, 248, 230, .08);
}
.wk-play-ic {
  flex: none; width: 37px; height: 37px; border-radius: 11px;
  display: grid; place-items: center; color: var(--gold-bright);
  background: rgba(219, 185, 121, .1); border: 1px solid rgba(219, 185, 121, .2);
}
.wk-play-ic svg { width: 20px; height: 20px; }
.wk-play.is-primary .wk-play-ic { background: rgba(219, 185, 121, .2); }
.wk-play-tx { flex: 1; min-width: 0; }
.wk-play-tx b { display: block; font-size: .85rem; font-weight: 650; color: var(--ivory); line-height: 1.35; }
.wk-play-tx small { display: block; font-size: .71rem; line-height: 1.45; color: rgba(247, 241, 230, .48); margin-top: 2px; }
.wk-play-go { flex: none; font-size: .95rem; color: rgba(240, 214, 155, .65); }
.wk-cta {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 52px; border-radius: 13px;
  color: #241a09; font-size: .92rem; font-weight: 750;
  background: linear-gradient(158deg, #f6e2b2, var(--gold-bright) 28%, var(--gold) 62%, #bd9957);
  border: 1px solid rgba(255, 240, 205, .55);
  box-shadow: 0 14px 34px rgba(219, 185, 121, .24), inset 0 1px 0 rgba(255, 255, 255, .7);
  transition: transform .2s, box-shadow .2s;
}
.wk-cta:hover { transform: translateY(-2px); box-shadow: 0 20px 44px rgba(219, 185, 121, .34), inset 0 1px 0 rgba(255, 255, 255, .8); }
.wk-cta:active { transform: translateY(0) scale(.99); }
.wk-cta i { font-style: normal; font-size: .9rem; }
.wk-foot { font-size: .7rem; color: rgba(247, 241, 230, .4); margin: 13px 0 0; line-height: 1.5; }

/* Lighting moment result — floats over the fully lit tree. */
.wk-lit-wrap { display: grid; place-items: center; width: 100%; padding: 22px; }
.wk-lit-card {
  width: min(420px, 100%); padding: 26px 28px 24px; border-radius: 24px; text-align: center;
  background: linear-gradient(168deg, rgba(16, 48, 37, .9), rgba(5, 22, 17, .94));
  border: 1px solid rgba(219, 185, 121, .34);
  box-shadow: 0 34px 90px rgba(0, 0, 0, .6), 0 0 60px rgba(219, 185, 121, .12), inset 0 1px 0 rgba(255, 248, 230, .12);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  animation: wk-rise .5s cubic-bezier(.18, .9, .24, 1) both;
}
.wk-art-sm { height: 82px; }
.wk-art-sm .wk-tree { width: 80px; height: 88px; }
.wk-lit-card .wk-lede { max-width: 100%; }
.wk-faces { display: flex; justify-content: center; gap: 6px; margin: 2px 0 16px; }
.wk-face {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: .9rem; background: rgba(219, 185, 121, .12);
  border: 1px solid rgba(219, 185, 121, .28);
}
.wk-wish {
  font-family: var(--serif); font-style: italic; font-size: 1.05rem;
  color: var(--gold-bright); margin: -4px 0 16px; line-height: 1.45;
}
.wk-links { display: flex; justify-content: center; gap: 22px; margin-top: 15px; }
.wk-links button {
  font-size: .76rem; color: rgba(247, 241, 230, .55);
  border-bottom: 1px solid rgba(247, 241, 230, .2); padding-bottom: 2px;
  transition: color .2s, border-color .2s;
}
.wk-links button:hover { color: var(--gold-bright); border-color: var(--gold-bright); }

/* ---------------------------------------------------------------- *
 * 5. Celebration — readable countdown, strong light bloom
 * ---------------------------------------------------------------- */
.celebration { background: radial-gradient(760px 620px at 50% 48%, #0b2f23, #020b08 76%); }
.celebration::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(900px 700px at 50% 50%, transparent 42%, rgba(2, 10, 8, .5) 100%);
}
.celebration::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(520px 440px at 50% 46%, rgba(240, 214, 155, .07), transparent 72%);
}
#cele-content { position: relative; z-index: 3; }
.cele-content .eyebrow { text-shadow: 0 2px 18px rgba(0, 0, 0, .9); }
.count-num {
  position: relative; font-family: var(--serif);
  font-size: clamp(6rem, 20vw, 11rem); line-height: 1;
  font-weight: 600; color: var(--gold-bright);
  text-shadow: 0 0 90px rgba(219, 185, 121, .7), 0 8px 44px rgba(0, 0, 0, .8);
}
.count-num::before {
  content: ""; position: absolute; z-index: -1; left: 50%; top: 50%;
  width: 260px; height: 260px; transform: translate(-50%, -50%);
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(2, 10, 8, .6), rgba(2, 10, 8, .28) 48%, transparent 72%);
}
.cele-counting {
  display: inline-block; padding: 7px 18px; border-radius: 999px;
  background: rgba(4, 18, 14, .5); border: 1px solid rgba(219, 185, 121, .2);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.cele-bloom {
  font-family: var(--serif); font-size: clamp(2.4rem, 8vw, 4.4rem); line-height: 1.1;
  color: var(--gold-bright); letter-spacing: -.02em;
  text-shadow: 0 0 70px rgba(219, 185, 121, .55), 0 8px 40px rgba(0, 0, 0, .7);
}
.cele-skip { z-index: 5; }
.celebration .wk-lit-wrap { animation: wk-fade .5s ease both; }

/* ---------------------------------------------------------------- *
 * 6. Overlays / sheets — lighter scrim, no duplicated headings
 * ---------------------------------------------------------------- */
.overlay { background: rgba(2, 10, 8, .56); }
.sheet {
  border-top: 1px solid rgba(219, 185, 121, .3);
  box-shadow: 0 -26px 74px rgba(0, 0, 0, .58), inset 0 1px 0 rgba(255, 248, 230, .1);
}
.sheet-handle { width: 38px; height: 4px; border-radius: 99px; }
.sheet[data-view="props"] .panel-section:first-child > .panel-title,
.sheet[data-view="assets"] .panel-section:first-child > .panel-title { display: none; }
.sheet[data-view="props"] .panel-section:first-child,
.sheet[data-view="assets"] .panel-section:first-child { margin-top: 0; }

/* Share sheet: keep the reference structure, just give it material depth. */
.share-card { border-color: rgba(240, 214, 155, .2); box-shadow: 0 34px 96px rgba(0, 0, 0, .62), inset 0 1px 0 rgba(255, 255, 255, .1); }
.share-card::before {
  content: ""; position: absolute; left: 18%; right: 18%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 214, 155, .6), transparent);
  pointer-events: none;
}
.share-illustration { filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .4)) drop-shadow(0 0 20px rgba(219, 185, 121, .14)); }

/* ---------------------------------------------------------------- *
 * 7. Responsive
 * ---------------------------------------------------------------- */
@media (max-width: 900px) {
  .editor-top { padding: 0 14px; gap: 10px; }
  .editor-ident .room-name { font-size: 1.12rem; }
  .editor-top-actions .btn-primary { padding: 0 13px; }
  .selection-toolbar { top: auto; bottom: 14px; }
  .stage-tools { top: 14px; right: 14px; }
  .stage-badge { top: 14px; }
  .wk-overlay { place-items: end center; padding: 0; }
  .wk-card {
    width: 100%; max-height: 88dvh; border-radius: 26px 26px 0 0;
    padding: 22px 20px calc(20px + var(--safe-b));
  }
  .wk-card::before { left: 12%; right: 12%; }
  .wk-art { height: 78px; }
  .wk-tree { width: 76px; height: 84px; }
  .wk-title { font-size: 1.85rem; }
  .wk-lede { font-size: .8rem; margin-bottom: 16px; }
  .wk-play { padding: 10px 12px; gap: 11px; }
  .wk-play-ic { width: 33px; height: 33px; }
  .wk-play-tx b { font-size: .81rem; }
  .wk-play-tx small { font-size: .68rem; }
  .wk-lit-wrap { padding: 14px; place-items: end center; }
  .wk-lit-card { padding: 20px 20px calc(18px + var(--safe-b)); }
  .wk-art-sm { height: 62px; }
  .wk-art-sm .wk-tree { width: 62px; height: 68px; }
  /* On a phone the square tree leaves space above and below; give that
     space a warm pool of light so it reads as depth, not empty bands. */
  .editor-body::after {
    background:
      radial-gradient(340px 250px at 50% 6%, rgba(240, 214, 155, .10), transparent 72%),
      radial-gradient(420px 210px at 50% 97%, rgba(240, 214, 155, .07), transparent 74%),
      radial-gradient(560px 470px at 50% 46%, rgba(240, 214, 155, .06), transparent 74%);
  }
}
@media (max-width: 560px) {
  /* The old rule hid every span in top-bar ghost buttons, leaving an empty
     outlined circle. Keep the arrow, drop only the word. */
  .editor-top-actions .btn-ghost span { display: inline; }
  .editor-top-actions .btn-ghost.top-share {
    width: 36px; min-width: 36px; min-height: 36px; padding: 0; justify-content: center;
  }
  .editor-top-actions .top-share .sh-tx { display: none; }
}
@media (max-width: 400px) {
  .wk-card { padding-left: 16px; padding-right: 16px; }
  .wk-play-tx small {
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
    overflow: hidden; font-size: .66rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wk-overlay, .wk-card, .wk-play, .wk-lit-card, .wk-tree, .celebration .wk-lit-wrap { animation: none !important; }
  .wk-tree { transition: none; }
}
