/* Hallmark • existing tree editor, component polish */
/* Keep the live tree visible while the owner tries real materials. */
:root {
  --trim-candle: linear-gradient(110deg,#d69843,#fff0b3,#dfa855);
  --trim-ice: linear-gradient(110deg,#66c2dc,#d5fbff,#7296d7);
  --trim-jewel: linear-gradient(100deg,#ca4c51 0 32%,#ffcd72 32% 64%,#3ca58c 64%);
  --trim-velvet: linear-gradient(120deg,#77203c,#db5368,#942c48);
  --trim-gold: linear-gradient(120deg,#9d7134,#edce81,#ad8441);
  --trim-silver: linear-gradient(120deg,#728799,#e1edf3,#91a4b6);
}
.tree-trim { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
body.is3d .tree-trim, .tree-trim[hidden] { display: none; }
.trim-editor {
  position: fixed; inset: 0; z-index: 88; display: flex; align-items: center; justify-content: end;
  padding: 16px max(24px, env(safe-area-inset-right)) 16px 12px; box-sizing: border-box;
}
.trim-panel {
  box-sizing: border-box; width: min(368px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto;
  display: grid; gap: 16px; padding: 20px; border-radius: var(--card-radius);
  border: 0; background: var(--card); color: var(--card-ink);
  font-family: var(--ui-font); box-shadow: 0 12px 45px color-mix(in srgb,var(--card-ink) 25%,transparent);
}
.trim-panel h2 { font: 700 23px/1.15 var(--head-font, var(--ui-font)); margin: 0; text-wrap: balance; overflow-wrap: break-word; min-width: 0; }
.trim-group { border: 0; min-width: 0; margin: 0; padding: 0; }
.trim-group legend, .trim-plaque > span { margin-bottom: 8px; padding: 0; display: block; font-size: 13px; font-weight: 700; }
.trim-choices { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 4px; }
.trim-choices label { position: relative; cursor: pointer; }
.trim-choices input { position: absolute; opacity: 0; }
.trim-choices span {
  height: 100%; min-height: 47px; box-sizing: border-box; display: flex; flex-direction: column;
  justify-content: center; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--card-line);
  border-radius: 9px; text-align: center; overflow-wrap: anywhere; font-size: 12px; line-height: 1.2;
}
.trim-choices span::before { content: ''; width: 25px; height: 7px; border-radius: 4px; background: var(--sample, var(--card-line)); }
.trim-choices input[value="none"] + span::before { height: 7px; width: 12px; background: linear-gradient(transparent 35%, var(--card-soft) 35% 65%, transparent 65%); }
.trim-choices input[value="candle"] + span { --sample: var(--trim-candle); }
.trim-choices input[value="ice"] + span { --sample: var(--trim-ice); }
.trim-choices input[value="jewel"] + span { --sample: var(--trim-jewel); }
.trim-choices input[value="velvet"] + span { --sample: var(--trim-velvet); }
.trim-choices input[value="gold"] + span { --sample: var(--trim-gold); }
.trim-choices input[value="silver"] + span { --sample: var(--trim-silver); }
.trim-choices input:checked + span { box-shadow: inset 0 0 0 1px currentColor; border-color: currentColor; background: color-mix(in srgb,var(--accent) 12%,var(--card)); font-weight: 750; }
.trim-choices input:focus-visible + span, .trim-panel :is(.btn,.input):focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.trim-plaque > span { display: flex; align-items: baseline; justify-content: space-between; }
.trim-plaque small { font-size: 12px; color: var(--card-soft); font-weight: 400; }
.trim-plaque input { width: 100%; box-sizing: border-box; font-size: 16px; }
.trim-panel footer { display: flex; justify-content: space-between; align-items: center; }
.trim-panel footer button { min-height: 44px; }
.trim-panel footer .btn:not(.primary) { background: var(--card); color: var(--card-ink); border: 1px solid var(--card-line); }
.trim-choices label:active span { background: color-mix(in srgb,var(--accent) 18%,var(--card)); }
body.trimming.editing .gift svg { outline: 0; }
body.trimming.editing .gift-label { opacity: 0; }
.trim-error { margin: 0; font-size: 13px; }
.trim-error:empty { display: none; }
body.trimming :is(.owner-bar,.edit-bar,.hero,.empty-tip,.toolbar,.dock,.swipe-hint,.progress-badge,.style-bar,.slot-hint) { visibility: hidden; }
body.trimming .stage-wrap { padding-right: min(416px, 51%); }
body.trimming .stage { max-width: 100%; }
@media (max-width: 760px) {
  .trim-editor { align-items: end; justify-content: center; padding: 0; }
  .trim-panel { width: 100%; gap: 12px; max-height: 59dvh; border-radius: 18px 18px 0 0; padding: 16px 16px max(12px,env(safe-area-inset-bottom)); }
  body.trimming { --top: max(8px,env(safe-area-inset-top)); --bottom: calc(var(--trim-height, 340px) + 4px); }
  body.trimming .stage-wrap { padding-right: 12px; }
}

.tree-scenery { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scenery-editor { z-index: 45; }
.scenery-panel {
  height: min(625px, calc(100dvh - 32px)); grid-template-rows: auto auto minmax(0,1fr) auto auto;
  overflow: hidden; gap: 8px;
}
.scenery-panel header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scenery-panel button { font-family: inherit; cursor: pointer; }
.scenery-panel button:disabled { color: var(--card-soft); background: var(--card); cursor: default; text-decoration: none; }
.scenery-panel button:focus-visible { outline: 2px solid var(--card-ink); outline-offset: -3px; }
.scenery-clear { background: transparent; color: inherit; border: 0; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }
.scenery-sides, .scenery-grid { display: grid; gap: 8px; grid-template-columns: repeat(2,minmax(0,1fr)); }
.scenery-side, .scenery-choice {
  color: var(--card-ink); background: var(--card); border: 1px solid var(--card-line);
  border-radius: 10px; min-width: 0; overflow-wrap: anywhere;
}
.scenery-side { display: grid; gap: 4px; padding: 8px 12px; min-height: 46px; text-align: start; }
.scenery-side span, .scenery-section h3 { font-weight: 700; font-size: 13px; }
.scenery-side small { font-size: 12px; }
.scenery-panel [aria-pressed="true"] { border-color: currentColor; box-shadow: inset 0 0 0 1px; background: color-mix(in srgb,var(--accent) 12%,var(--card)); }
.scenery-shelf { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 4px 4px; }
.scenery-section h3 { margin: 4px 0 8px; }
.scenery-section + .scenery-section { margin-top: 16px; }
.scenery-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.scenery-choice { padding: 8px 4px; display: grid; justify-items: center; align-content: start; gap: 4px; }
.scenery-choice img { width: 100%; height: 48px; object-fit: contain; }
.scenery-choice span { font-size: 12px; line-height: 1.25; }
.scenery-panel .trim-error { grid-row: 4; }
.scenery-panel footer { grid-row: 5; }
@media (max-width: 760px) {
  .scenery-panel { height: min(54dvh,480px); gap: 8px; padding-top: 8px; }
  .scenery-choice img { height: 40px; }
}
.scenery-lock {
  display: inline-block; position: relative; width: 10px; height: 8px; margin-inline: 0 8px;
  border: 1.5px solid currentColor; border-radius: 2px; box-sizing: border-box;
}
.scenery-lock::before {
  content: ''; position: absolute; bottom: 100%; left: 1px; right: 1px; height: 5px;
  border: 1.5px solid currentColor; border-bottom: 0; border-radius: 5px 5px 0 0;
}
