/* Digital Invitation Editor 2.0 — tudo dentro de .die2 para não interferir no tema */
.die2 {
  --d2-bg: #fbf7fa; --d2-surface: #ffffff; --d2-fg: #22141f; --d2-muted: #74606f; --d2-line: #eadde6;
  --d2-accent: #c2185b; --d2-soft: #fbe3ee; --d2-whats: #1f9d55; --d2-stage: #f1e7ef;
  color: var(--d2-fg); background: var(--d2-bg); border-radius: 16px; padding: 10px;
  margin: 1.5rem 0; max-width: 1000px; font-size: 16px; line-height: 1.35;
}
.die2 *, .die2 *::before, .die2 *::after { box-sizing: border-box; }
.die2 [hidden] { display: none !important; }
.die2 button { font: inherit; color: inherit; margin: 0; line-height: 1.2; text-transform: none; letter-spacing: normal; box-shadow: none; min-height: 0; }
.die2 button:focus-visible { outline: 3px solid var(--d2-accent); outline-offset: 2px; }
.die2-title { font-size: 1.05rem; font-weight: 700; margin: 0 0 8px; }

.die2-cols { display: grid; gap: 10px; }
.die2-left { position: sticky; top: 0; z-index: 5; background: var(--d2-bg); padding-block: 4px; }
.die2-right { display: grid; gap: 10px; min-width: 0; align-content: start; }
@media (min-width: 860px) {
  .die2 { padding: 16px; }
  .die2-cols { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); align-items: start; gap: 20px; }
  .die2-left { top: 12px; }
}

.die2-stage { background: var(--d2-stage); border-radius: 14px; padding: 8px; display: grid; gap: 6px; justify-items: center; }
.die2-hint { font-size: 0.78rem; color: var(--d2-muted); text-align: center; margin: 0; }
.die2-canvas-wrap { position: relative; height: min(54svh, 520px); aspect-ratio: 9 / 16; max-width: 100%; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 24px rgba(60, 10, 40, .18); }
@supports not (height: 1svh) { .die2-canvas-wrap { height: min(54vh, 520px); } }
@media (min-width: 860px) { .die2-canvas-wrap { height: auto; width: 100%; max-width: 380px; } }
.die2 canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.die2-corner { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 9px; border: 0; background: rgba(0,0,0,.5); color: #fff !important; display: grid; place-items: center; cursor: pointer; padding: 0; }

.die2-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--d2-stage); padding: 4px; border-radius: 12px; }
.die2-tab { border: 0; background: transparent; border-radius: 9px; padding: 10px 6px; font-weight: 600; cursor: pointer; color: var(--d2-muted) !important; }
.die2-tab[aria-selected="true"] { background: var(--d2-surface); color: var(--d2-fg) !important; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.die2-pane { background: var(--d2-surface); border: 1px solid var(--d2-line); border-radius: 14px; padding: 12px; display: grid; gap: 10px; }
.die2-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--d2-muted); margin: 0; }

.die2-models { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.die2-model { width: 100%; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; background: var(--d2-stage); cursor: pointer; position: relative; }
.die2-model img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; }
.die2-model[aria-pressed="true"] { border-color: var(--d2-accent); box-shadow: 0 0 0 3px var(--d2-soft); }
.die2-model span { position: absolute; left: 4px; bottom: 4px; font-size: 0.7rem; font-weight: 700; color: #fff; background: rgba(0,0,0,.55); border-radius: 6px; padding: 1px 6px; }

.die2-list { display: grid; gap: 4px; }
.die2-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto auto; align-items: center; gap: 6px; padding: 3px; border-radius: 10px; }
.die2-item.is-off .die2-name { opacity: .45; text-decoration: line-through; }
.die2-eye { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--d2-line); background: var(--d2-bg); cursor: pointer; display: grid; place-items: center; padding: 0; }
.die2-eye svg { width: 20px; height: 20px; }
.die2-name { text-align: left; background: none; border: 0; padding: 6px 4px; cursor: pointer; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.die2-name small { display: block; font-weight: 400; color: var(--d2-muted); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; }
.die2-sq { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--d2-line); background: var(--d2-bg); font-weight: 700; cursor: pointer; font-size: 0.85rem; padding: 0; }
.die2-dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--d2-line); cursor: pointer; padding: 0; margin-left: 2px; }

.die2-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.die2-row > .die2-k { font-size: 0.8rem; color: var(--d2-muted); min-width: 60px; }
.die2-chip { border: 1px solid var(--d2-line); background: var(--d2-bg); border-radius: 999px; padding: 7px 12px; cursor: pointer; font-size: 0.9rem; }
.die2-chip[aria-pressed="true"] { border-color: var(--d2-accent); background: var(--d2-soft); color: var(--d2-accent) !important; font-weight: 600; }
.die2-sw { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--d2-line); cursor: pointer; padding: 0; }
.die2-sw[aria-pressed="true"] { outline: 3px solid var(--d2-accent); outline-offset: 2px; }
.die2-custom { width: 36px; height: 36px; border: 0; padding: 0; background: none; cursor: pointer; }
.die2 input[type="range"] { flex: 1; min-width: 140px; accent-color: var(--d2-accent); }
.die2-link { background: none; border: 0; color: var(--d2-accent) !important; cursor: pointer; font-weight: 600; padding: 6px 4px; }
.die2-done { background: var(--d2-accent); color: #fff !important; border: 0; border-radius: 10px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
.die2-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.die2-f { display: grid; gap: 4px; min-width: 0; }
.die2-f label { font-size: 0.78rem; font-weight: 600; color: var(--d2-muted); margin: 0; }
.die2-f input { width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--d2-line); background: var(--d2-bg); color: var(--d2-fg); margin: 0; }
.die2-f input:focus { outline: 2px solid var(--d2-accent); outline-offset: 1px; }
.die2-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Rodapé preso embaixo da tela enquanto o editor está visível */
.die2-bar { position: sticky; bottom: 0; z-index: 6; margin-top: 10px; background: var(--d2-surface); border: 1px solid var(--d2-line); border-radius: 14px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
.die2-primary { background: var(--d2-whats); color: #fff !important; border: 0; border-radius: 12px; padding: 14px; font-size: 1rem; font-weight: 700; cursor: pointer; }
.die2-secondary { background: transparent; border: 2px solid var(--d2-fg); border-radius: 12px; padding: 12px 16px; font-weight: 700; cursor: pointer; }
.die2-icon { padding: 10px 12px; display: grid; place-items: center; }
.die2-upsell { display: block; text-align: center; margin-top: 10px; font-size: 0.9rem; }

.die2-full { position: fixed; inset: 0; z-index: 2147483000; background: #000; display: grid; place-items: center;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.die2-full img { max-height: 100%; max-width: 100%; aspect-ratio: 9 / 16; object-fit: contain; display: block; margin: 0; }
.die2-full-close { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: calc(env(safe-area-inset-right, 0px) + 12px); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff !important; font-size: 1.2rem; cursor: pointer; }
.die2-full-hint { position: absolute; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.75); font-size: 0.85rem; margin: 0; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) { .die2-model, .die2-chip, .die2-sw, .die2-tab { transition: border-color .15s, background .15s; } }
