:root {
  color-scheme: light;
  --page: #ecf0f8;
  --paper: #fff;
  --ink: #1d273e;
  --muted: #52617b;
  --accent: #354e9d;
  --tint: #e4eafb;
  --line: #cfd7e6;
  --danger: #a02246;
  font: 16px/1.5 system-ui, sans-serif;
  background: var(--page);
  color: var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --page: #171d2d; --paper: #222b40; --ink: #eff3ff; --muted: #b7c5df; --accent: #c0ccff; --tint: #303e61; --line: #455470; --danger: #ff9cb7; }
}
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 46rem; margin: auto; padding: 1.1rem 1rem 3rem; padding-bottom: max(3rem, env(safe-area-inset-bottom)); }
header, .toolbar, .dialog-header, .actions, .variant { display: flex; align-items: center; gap: .65rem; }
header, .dialog-header, .variant { justify-content: space-between; }
.brand { display: inline-flex; gap: .5rem; align-items: center; color: inherit; text-decoration: none; font-weight: 750; }
.brand span { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .55rem; background: var(--accent); color: var(--page); font: italic 700 1.35rem Georgia, serif; }
h1, h2, h3 { margin: 0; overflow-wrap: anywhere; }
h1 { margin: 1.65rem 0 1rem; font: 500 clamp(2.6rem, 11vw, 4.1rem)/1 Georgia, serif; letter-spacing: -.055em; }
h2 { font: 500 1.7rem/1.2 Georgia, serif; }
h3 { font: 500 1.45rem/1.2 Georgia, serif; }
p { margin: .55rem 0; overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; min-height: 2.75rem; border: 0; border-radius: .6rem; padding: .5rem .75rem; color: var(--ink); background: var(--tint); }
button:disabled { cursor: default; opacity: .65; }
button.primary { background: var(--accent); color: var(--page); font-weight: 650; }
button.quiet { color: var(--accent); background: transparent; }
button.danger { color: var(--danger); }
input, select, textarea { width: 100%; min-width: 0; padding: .63rem .75rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--paper); color: var(--ink); }
textarea { resize: vertical; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#status, .muted, #dialog-status { color: var(--muted); font-size: .9rem; }
#results { display: grid; gap: .55rem; margin-top: .9rem; }
.card { width: 100%; text-align: left; background: var(--paper); border: 1px solid var(--line); border-left: .25rem solid var(--accent); padding: .8rem 1rem; overflow-wrap: anywhere; }
.card span { display: block; margin-top: .22rem; }
.actions { flex-wrap: wrap; margin-top: 1rem; }
dialog { width: min(36rem, calc(100% - 1rem)); max-height: 88vh; max-height: 88dvh; border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); color: var(--ink); padding: 1rem; }
dialog::backdrop { background: #10193399; }
.dialog-header { align-items: start; margin-bottom: .85rem; }
.dialog-header button { flex-shrink: 0; }
form label { display: block; margin: .65rem 0 .22rem; font-weight: 600; }
.language-popup { max-height: min(13rem, 27dvh); overflow: auto; overscroll-behavior: contain; margin-top: .25rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--paper); }
.language-option { display: block; width: 100%; text-align: left; background: transparent; border-radius: 0; overflow-wrap: anywhere; }
.language-option[hidden] { display: none; }
.language-option + .language-option { border-top: 1px solid var(--line); }
.language-option.active, .language-option[aria-selected="true"] { background: var(--tint); }
.variant { align-items: start; gap: .5rem; padding: .7rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.variant p { white-space: pre-wrap; }
.variant .quiet { flex-shrink: 0; }
.variant-content { flex: 1; min-width: 0; }
.variant .reorder { flex: 0 0 2.75rem; width: 2.75rem; padding: 0; font-size: 1.45rem; cursor: grab; touch-action: none; user-select: none; }
.reordering .variant { transition: transform 140ms ease-out; }
.reordering .variant.dragging {
  position: relative;
  z-index: 1;
  background: var(--paper);
  border-radius: .55rem;
  box-shadow: 0 4px 14px #10193340, 0 0 0 1px var(--line);
  transition: none;
}
.variant.dragging .reorder { cursor: grabbing; }
@media (prefers-reduced-motion: reduce) { .reordering .variant { transition: none; } }
details { margin-top: 1rem; }
details textarea { margin-top: .5rem; }
