dialog { width: min(1020px, calc(100% - 32px)); height: min(640px, calc(100dvh - 32px)); max-width: none; max-height: none; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 28px; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .5); }
:root[data-theme="dark"] dialog { background: #17191d; }
dialog[open] { display: grid; grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); animation: modal .45s var(--soft); }
@keyframes modal { from { opacity: 0; translate: 0 12px; scale: .97; } }
dialog::backdrop { background: rgb(0 0 0 / .55); backdrop-filter: blur(6px); }
.ed-left { display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 20px; background: var(--panel); }
:root[data-theme="dark"] .ed-left { background: #101114; }
.stage { position: relative; }
#preview svg { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 22px; background: repeating-conic-gradient(#efeff2 0 25%, #fff 0 50%) 0 0 / 22px 22px; }
#toast { position: absolute; bottom: 12px; left: 50%; margin: 0; padding: 7px 16px; border-radius: 99px; background: #0a0a0a; color: #fff; font-size: 13px; white-space: nowrap; translate: -50% 0; }
#toast:empty { display: none; }
.formats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 99px; background: var(--card); }
.formats button { height: 30px; border-radius: 99px; color: var(--muted); font-size: 13px; }
.formats [aria-pressed="true"] { background: var(--tile); color: var(--ink); }
:root[data-theme="dark"] .formats [aria-pressed="true"] { background: var(--raised); }
.react { display: grid; gap: 8px; min-height: 0; }
.react[hidden] { display: none; }
.react button { display: flex; height: 38px; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 16px; font-size: 12px; }
.react button > span:first-child { color: var(--muted); }
.react button code { flex: 1; text-align: left; }
.react button svg { width: 16px; height: 16px; color: var(--muted); }
.react code { font-family: "DM Mono", ui-monospace, monospace; }
.react pre { max-height: 112px; margin: 0; padding: 10px 14px; overflow: auto; border-radius: 16px; background: var(--card); font-size: 11px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-width: thin; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions button { display: flex; height: 44px; align-items: center; justify-content: center; gap: 8px; border-radius: 99px; background: var(--card); font-size: 15px; transition: scale .3s var(--spring); }
.actions button:active { scale: .96; }
.actions .dark { background: var(--ink); color: var(--page); }
.ed-right { display: flex; min-width: 0; min-height: 0; flex-direction: column; }
.ed-head { display: flex; align-items: center; gap: 8px; padding: 18px 18px 12px 22px; }
.ed-head > div { flex: 1; min-width: 0; }
.ed-head h2 { overflow: hidden; margin: 0; font-size: 20px; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.ed-head p { margin: 0; color: var(--muted); font-size: 13px; }
.ed-head > button, .close { display: flex; height: 36px; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border-radius: 99px; background: var(--tile); }
.ed-head b { font-weight: 500; }
.ed-head form { margin: 0; }
.close { width: 36px; padding: 0; }
@media (max-width: 700px) {
  dialog { width: calc(100% - 16px); height: calc(100dvh - 16px); border-radius: 22px; }
  dialog[open] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .ed-left { display: grid; grid-template-columns: 116px minmax(0, 1fr); align-content: center; gap: 8px 12px; padding: 12px; }
  .stage { grid-row: span 2; }
  .formats { align-self: end; }
  .react { grid-column: 1 / -1; order: 1; }
  .react pre { max-height: 72px; }
  .actions { align-self: start; }
  .actions button { height: 40px; gap: 6px; font-size: 13px; }
  .ed-head { padding: 10px 10px 8px 14px; gap: 6px; }
  .ed-head b { display: none; }
  .ed-head h2 { font-size: 17px; }
}
