@import url('/assets/fonts.css');

/* ---------- Tokens: thermal paper (light) / carbon (dark) ---------- */
:root {
  --paper: #eef0ee;
  --paper-2: #e4e7e4;
  --slip: #fbfcfb;
  --ink: #18191b;
  --ink-2: #4f535a;
  --ink-3: #6f747b;
  --rule: #cfd3d6;
  --perf: #a9aeb4;
  --rail: #17181a;
  --rail-ink: #eceeea;
  --rail-ink-2: #9a9ea4;
  --rail-hover: #24262a;
  --stamp: #cf3a28;
  --stamp-ink: #fff;
  --stamp-soft: #f6dcd6;
  --ok: #2c7a4b;
  --warn: #9a6200;
  --danger: #a3261b;
  --focus: #1f6feb;
  --shadow-slip: 0 1px 1px rgba(20, 22, 24, .06), 0 6px 18px -6px rgba(20, 22, 24, .16);
  --radius: 4px;

  --font: 'Anuphan', system-ui, -apple-system, 'Segoe UI', 'Noto Sans Thai', sans-serif;
  --mono: 'Azeret Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --t-xs: .78rem;
  --t-sm: .875rem;
  --t-md: .9375rem;
  --t-lg: 1.125rem;
  --t-xl: 1.375rem;
  --t-2xl: 1.75rem;

  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #121315;
    --paper-2: #18191c;
    --slip: #1d1f22;
    --ink: #e8eae6;
    --ink-2: #b0b4ba;
    --ink-3: #8b9097;
    --rule: #2d3034;
    --perf: #474b51;
    --rail: #0b0c0d;
    --rail-hover: #1a1c1f;
    --stamp: #ff5b45;
    --stamp-ink: #170604;
    --stamp-soft: #3a1914;
    --ok: #5cc48a;
    --warn: #e0a640;
    --danger: #ff7a6b;
    --focus: #6aa6ff;
    --shadow-slip: 0 1px 1px rgba(0, 0, 0, .4), 0 8px 22px -8px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #121315;
  --paper-2: #18191c;
  --slip: #1d1f22;
  --ink: #e8eae6;
  --ink-2: #b0b4ba;
  --ink-3: #8b9097;
  --rule: #2d3034;
  --perf: #474b51;
  --rail: #0b0c0d;
  --rail-hover: #1a1c1f;
  --stamp: #ff5b45;
  --stamp-ink: #170604;
  --stamp-soft: #3a1914;
  --ok: #5cc48a;
  --warn: #e0a640;
  --danger: #ff7a6b;
  --focus: #6aa6ff;
  --shadow-slip: 0 1px 1px rgba(0, 0, 0, .4), 0 8px 22px -8px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-md)/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; text-wrap: balance; }
h1 { font-size: var(--t-2xl); letter-spacing: -.01em; }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
p { margin: 0; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--ink-2); }
.small { font-size: var(--t-sm); }
.xs { font-size: var(--t-xs); }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: var(--perf) transparent; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* ---------- Controls ---------- */
.btn {
  --btn-bg: var(--slip);
  --btn-ink: var(--ink);
  --btn-line: var(--rule);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 2.5rem; padding: .45rem .95rem;
  border: 1px solid var(--btn-line); border-radius: var(--radius);
  background: var(--btn-bg); color: var(--btn-ink);
  font: 500 var(--t-sm)/1.2 var(--font);
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
}
.btn:hover { --btn-line: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-busy='true'] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { --btn-bg: var(--ink); --btn-ink: var(--paper); --btn-line: var(--ink); }
.btn.primary:hover { --btn-bg: var(--ink-2); --btn-line: var(--ink-2); }
.btn.live { --btn-bg: var(--stamp); --btn-ink: var(--stamp-ink); --btn-line: var(--stamp); }
.btn.live:hover { filter: brightness(1.06); }
.btn.ghost { --btn-bg: transparent; --btn-line: transparent; }
.btn.ghost:hover { --btn-bg: var(--paper-2); }
.btn.danger { --btn-ink: var(--danger); }
.btn.danger:hover { --btn-line: var(--danger); }
.btn.sm { min-height: 2rem; padding: .25rem .6rem; font-size: var(--t-xs); }
.btn.icon-only { padding: 0; width: 2.5rem; }
.btn.sm.icon-only { width: 2rem; }

.field { display: grid; gap: .35rem; align-content: start; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.field > label, .label { font-size: var(--t-sm); font-weight: 500; }
.hint { font-size: var(--t-xs); color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 2.5rem; padding: .5rem .7rem;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--slip); color: var(--ink);
  font: 400 var(--t-md)/1.4 var(--font);
  transition: border-color .15s var(--ease);
}
textarea.input { min-height: 6rem; resize: vertical; }
textarea.code { font: 400 var(--t-sm)/1.5 var(--mono); min-height: 14rem; }
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.input[aria-invalid='true'] { border-color: var(--danger); }
.input::placeholder { color: var(--ink-3); }
input[type='color'].input { padding: .2rem; width: 3.25rem; cursor: pointer; }

.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-size: var(--t-sm); }
.switch input { appearance: none; margin: 0; width: 2.4rem; height: 1.4rem; border-radius: 1rem; background: var(--perf); position: relative; cursor: pointer; transition: background-color .15s var(--ease); flex: none; }
.switch input::after { content: ''; position: absolute; top: .2rem; left: .2rem; width: 1rem; height: 1rem; border-radius: 50%; background: var(--slip); transition: transform .18s var(--ease); }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(1rem); }

/* Range with a live mono readout (the specimen raise). */
.range { display: grid; grid-template-columns: 1fr 4.5rem; align-items: center; gap: .75rem; }
.range input[type='range'] { width: 100%; accent-color: var(--ink); }
.range output { font: 500 var(--t-sm)/1 var(--mono); text-align: right; font-variant-numeric: tabular-nums; }

.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--slip); }
.seg button { border: 0; background: none; color: var(--ink-2); padding: .4rem .8rem; font: 500 var(--t-sm)/1.2 var(--font); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }

/* ---------- Shell ---------- */
.shell { min-height: 100dvh; display: grid; grid-template-columns: 15rem 1fr; }
.rail {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 1.5rem;
  padding: 1.25rem .85rem;
  background: var(--rail); color: var(--rail-ink);
}
.brand { display: flex; align-items: center; gap: .6rem; padding: 0 .5rem; font-weight: 700; letter-spacing: .02em; }
.brand-mark { width: 1.6rem; height: 1.6rem; }
.brand small { display: block; font: 400 var(--t-xs)/1.3 var(--font); color: var(--rail-ink-2); letter-spacing: 0; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: .7rem;
  padding: .55rem .65rem; border-radius: var(--radius);
  color: var(--rail-ink-2); text-decoration: none; font-size: var(--t-sm); font-weight: 500;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.nav a:hover { background: var(--rail-hover); color: var(--rail-ink); }
.nav a[aria-current='page'] { background: var(--rail-ink); color: var(--rail); }
.lang-mini { display: none; }
.nav .count { margin-left: auto; font: 500 var(--t-xs)/1 var(--mono); padding: .2rem .4rem; border-radius: 3px; background: var(--stamp); color: var(--stamp-ink); }
.rail-foot { margin-top: auto; display: grid; gap: .75rem; padding: 0 .25rem; font-size: var(--t-sm); }
.rail-foot .who { color: var(--rail-ink-2); font-size: var(--t-xs); padding: 0 .4rem; }
.rail-foot .who strong { display: block; color: var(--rail-ink); font-size: var(--t-sm); font-weight: 500; }
.rail .seg { background: transparent; border-color: #34373c; }
.rail .seg button { color: var(--rail-ink-2); }
.rail .seg button + button { border-color: #34373c; }
.rail .seg button[aria-pressed='true'] { background: var(--rail-ink); color: var(--rail); }
.rail .btn.ghost { --btn-ink: var(--rail-ink-2); justify-content: flex-start; }
.rail .btn.ghost:hover { --btn-bg: var(--rail-hover); --btn-ink: var(--rail-ink); }

.main { min-width: 0; padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head p { color: var(--ink-2); margin-top: .25rem; font-size: var(--t-sm); }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.panel { background: var(--slip); border: 1px solid var(--rule); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1.1rem; border-bottom: 1px dashed var(--perf); }
.panel-head h2 { font-size: var(--t-md); font-weight: 600; }
.panel-body { padding: 1.1rem; display: grid; gap: 1rem; }

/* ---------- Live view ---------- */
.live { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1.5rem; align-items: start; }
.live-side { display: grid; gap: 1rem; position: sticky; top: 1.5rem; }

/* The now-playing slip: torn top and bottom edge, the only stamp-red surface. */
.slip {
  position: relative;
  background: var(--slip);
  box-shadow: var(--shadow-slip);
  padding: 1.4rem 1.4rem 1.5rem;
  --tooth: 7px;
  -webkit-mask:
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x,
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth) + 1px) no-repeat;
  mask:
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--tooth) * 2) var(--tooth) repeat-x,
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--tooth) + 1px) no-repeat;
}
.now { display: grid; gap: 1rem; margin-bottom: 1.75rem; }
.now-label { display: flex; align-items: center; gap: .6rem; font-size: var(--t-sm); font-weight: 600; }
.stamp {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .15rem .5rem; border-radius: 3px;
  background: var(--stamp); color: var(--stamp-ink);
  font: 600 var(--t-xs)/1.4 var(--font); letter-spacing: .04em;
}
.stamp.off { background: var(--paper-2); color: var(--ink-2); }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.stamp:not(.off) .dot { animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.now-body { display: grid; grid-template-columns: 1fr auto; gap: .25rem 1.5rem; align-items: baseline; }
.now-name { font-size: var(--t-xl); font-weight: 600; overflow-wrap: anywhere; }
.now-amount { font: 700 var(--t-2xl)/1.1 var(--mono); color: var(--stamp); font-variant-numeric: tabular-nums; text-align: right; }
.now-msg { grid-column: 1 / -1; color: var(--ink-2); overflow-wrap: anywhere; }
.now-empty { color: var(--ink-2); font-size: var(--t-sm); }
.now-actions { display: flex; flex-wrap: wrap; gap: .5rem; padding-top: .9rem; border-top: 1px dashed var(--perf); }

.roll-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.roll-head h2 { font-size: var(--t-md); }
.roll { list-style: none; margin: 0; padding: 0; background: var(--slip); border: 1px solid var(--rule); border-radius: var(--radius); }
.roll li { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem 1rem; padding: .85rem 1.1rem .7rem; }
.roll li + li { border-top: 1px dashed var(--perf); }
.roll .who { font-weight: 600; overflow-wrap: anywhere; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.roll .amt { font: 600 var(--t-lg)/1.3 var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.roll .msg { grid-column: 1 / -1; color: var(--ink-2); font-size: var(--t-sm); overflow-wrap: anywhere; }
.roll .meta { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem 1rem; font: 400 var(--t-xs)/1.4 var(--mono); color: var(--ink-3); }
.roll .row-actions { grid-column: 2; display: flex; justify-content: flex-end; align-items: center; }
.roll .meta .channel { font-family: var(--font); }
.media-grid > .empty { grid-column: 1 / -1; }
.roll li[data-status='playing'] { background: var(--stamp-soft); }
.roll li.printing { animation: print .7s var(--ease) both; }
@keyframes print {
  from { clip-path: inset(0 0 100% 0); transform: translateY(-6px); }
  to { clip-path: inset(0 0 0 0); transform: none; }
}
.tag { font: 500 .7rem/1.3 var(--font); padding: .1rem .4rem; border-radius: 3px; border: 1px solid var(--rule); color: var(--ink-2); letter-spacing: .02em; white-space: nowrap; }
.tag.test { border-style: dashed; }
.tag.pending { color: var(--warn); border-color: currentColor; }
.tag.playing { background: var(--stamp); border-color: var(--stamp); color: var(--stamp-ink); }
.tag.skipped, .tag.expired, .tag.below_min { color: var(--ink-3); }

.empty { padding: 2.5rem 1.25rem; text-align: center; color: var(--ink-2); display: grid; gap: .75rem; justify-items: center; }
.empty strong { color: var(--ink); font-size: var(--t-lg); }

/* 24h summary set as a receipt total: label, dotted leader, mono figure. */
.receipt { margin: 0; gap: .6rem; }
.receipt > div { display: flex; align-items: baseline; gap: .5rem; }
.receipt > div::after { content: none; }
.receipt dt { font-size: var(--t-sm); color: var(--ink-2); display: flex; align-items: baseline; flex: 1; gap: .5rem; }
.receipt dt::after { content: ''; flex: 1; border-bottom: 1px dotted var(--perf); transform: translateY(-.25em); }
.receipt dd { margin: 0; font: 500 var(--t-md)/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.receipt .total { padding-top: .6rem; border-top: 1px dashed var(--perf); }
.receipt .total dt { color: var(--ink); font-weight: 600; }
.receipt .total dd { font-size: var(--t-xl); font-weight: 700; }
.receipt small { font-size: var(--t-xs); color: var(--ink-2); font-weight: 400; }

.url-row { display: grid; gap: .35rem; }
.url-box { display: flex; align-items: stretch; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.url-box code { flex: 1; min-width: 0; padding: .5rem .6rem; font: 400 var(--t-xs)/1.5 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.url-box code.masked { letter-spacing: .1em; color: var(--ink-3); }
.url-box .btn { border: 0; border-left: 1px solid var(--rule); border-radius: 0; min-height: auto; }

/* ---------- Alert customizer ---------- */
.editor { display: grid; grid-template-columns: minmax(20rem, 26rem) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.editor > *, .editor-form > *, .editor-preview > * { min-width: 0; }
.editor-form { display: grid; gap: 1rem; }
.editor-preview { position: sticky; top: 1.5rem; display: grid; gap: .75rem; }
.preview-frame {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius);
  background:
    repeating-conic-gradient(var(--paper-2) 0 25%, var(--paper) 0 50%) 0 0 / 24px 24px;
  border: 1px solid var(--rule);
}
.preview-frame.scene { background: #2a2f36 linear-gradient(160deg, #3b4a5a 0%, #1d232b 55%, #3a2c2a 100%); }
.preview-frame iframe { position: absolute; top: 0; left: 0; width: 1920px; height: 1080px; border: 0; transform-origin: 0 0; background: transparent; }
.preview-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.preview-bar .scale { font: 400 var(--t-xs)/1 var(--mono); color: var(--ink-3); }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--rule); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: .6rem .8rem; font: 500 var(--t-sm)/1.2 var(--font); color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--ink); }
.tier { display: grid; gap: .75rem; padding: .9rem; border: 1px dashed var(--perf); border-radius: var(--radius); }
.tier-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.savebar {
  position: sticky; bottom: 1rem; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem .8rem .7rem 1.1rem; border-radius: var(--radius);
  background: var(--ink); color: var(--paper); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .45);
  font-size: var(--t-sm);
  animation: rise .2s var(--ease);
}
.savebar .btn { --btn-bg: var(--paper); --btn-ink: var(--ink); --btn-line: var(--paper); }
.savebar .btn.ghost { --btn-bg: transparent; --btn-ink: var(--paper); --btn-line: transparent; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

.stack { display: grid; gap: 1.25rem; }
.stack > :empty { display: none; }

/* ---------- Media ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1rem; }
.media-item { display: grid; gap: .5rem; padding: .6rem; background: var(--slip); border: 1px solid var(--rule); border-radius: var(--radius); }
.media-thumb { aspect-ratio: 4 / 3; display: grid; place-items: center; background: repeating-conic-gradient(var(--paper-2) 0 25%, var(--paper) 0 50%) 0 0 / 16px 16px; border-radius: 2px; overflow: hidden; }
.media-thumb img, .media-thumb video { max-width: 100%; max-height: 100%; object-fit: contain; }
.media-thumb .icon { width: 2rem; height: 2rem; color: var(--ink-3); }
.media-name { font-size: var(--t-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font: 400 var(--t-xs)/1.3 var(--mono); color: var(--ink-3); }
.dropzone { display: grid; place-items: center; gap: .4rem; padding: 1.5rem; border: 1.5px dashed var(--perf); border-radius: var(--radius); text-align: center; color: var(--ink-2); cursor: pointer; transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.dropzone:hover, .dropzone.over { border-color: var(--ink); background: var(--slip); color: var(--ink); }
.picker { display: flex; gap: .5rem; align-items: center; }
.picker select { flex: 1; }

/* ---------- Tables (webhook log, friends) ---------- */
.table-wrap { overflow-x: auto; background: var(--slip); border: 1px solid var(--rule); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th { text-align: left; font-weight: 600; font-size: var(--t-xs); color: var(--ink-2); padding: .65rem 1rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: .75rem 1rem; border-top: 1px dashed var(--perf); vertical-align: top; }
tr:first-child td { border-top: 0; }
td.num, th.num { text-align: right; }
details.raw summary { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; color: var(--ink-2); font-size: var(--t-xs); list-style: none; }
details.raw summary::-webkit-details-marker { display: none; }
details.raw summary:hover { color: var(--ink); }
details.raw summary .icon { transition: transform .15s var(--ease); }
details.raw[open] summary .icon { transform: rotate(90deg); }
.tag.error { color: var(--slip); background: var(--ink); border-color: var(--ink); }
.result-error { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.result-error code { color: var(--ink-2); }
details.raw pre { margin: .5rem 0 0; padding: .75rem; background: var(--paper); border-radius: var(--radius); font: 400 var(--t-xs)/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; max-height: 22rem; overflow: auto; }

/* ---------- Auth ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 2rem 1rem; background: var(--rail); }
.auth .slip { width: min(100%, 24rem); padding: 2rem 1.75rem 2.4rem; display: grid; gap: 1.25rem; }
.auth .brand { padding: 0; color: var(--ink); }
.auth .brand small { color: var(--ink-2); }
.auth form { display: grid; gap: 1rem; }
.auth .seg { justify-self: start; }
.auth .perf { border-top: 1px dashed var(--perf); }

/* ---------- Feedback ---------- */
.notice { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem .9rem; border-radius: var(--radius); background: var(--paper-2); font-size: var(--t-sm); }
.notice.error { background: color-mix(in srgb, var(--danger) 12%, var(--slip)); color: var(--danger); }
.notice.ok { background: color-mix(in srgb, var(--ok) 12%, var(--slip)); color: var(--ok); }
.notice.secret { background: var(--ink); color: var(--paper); display: grid; gap: .5rem; }
.notice.secret code { font: 600 var(--t-lg)/1.3 var(--mono); letter-spacing: .03em; }
.toast-host { position: fixed; z-index: 50; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; justify-items: end; pointer-events: none; }
.toast { pointer-events: auto; padding: .65rem .9rem; border-radius: var(--radius); background: var(--ink); color: var(--paper); font-size: var(--t-sm); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); animation: rise .2s var(--ease); max-width: 22rem; }
.toast.error { background: var(--danger); color: #fff; }

.skeleton { height: 4.5rem; background: linear-gradient(90deg, var(--paper-2), var(--slip), var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton + .skeleton { border-top: 1px dashed var(--perf); }
@keyframes shimmer { to { background-position: -200% 0; } }

dialog { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: min(30rem, calc(100vw - 2rem)); }
dialog::backdrop { background: rgba(10, 11, 12, .55); }
dialog .slip { display: grid; gap: 1rem; }
dialog .row { display: flex; justify-content: flex-end; gap: .5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .live { grid-template-columns: 1fr; }
  .live-side { position: static; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
  .editor { grid-template-columns: 1fr; }
  .editor-preview { position: static; order: -1; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: sticky; z-index: 10; height: auto; flex-direction: row; align-items: center; gap: .75rem; padding: .6rem .75rem; overflow-x: auto; }
  .brand small, .rail-foot .who, .nav .label-text, .rail .seg { display: none; }
  .rail .lang-mini { display: inline-flex; }
  .rail .brand > div { display: none; }
  .rail .brand { padding: 0; }
  .tabs { flex-wrap: wrap; }
  .nav { display: flex; gap: 2px; }
  .nav a { padding: .55rem; }
  .rail-foot { margin: 0 0 0 auto; display: flex; align-items: center; gap: .25rem; padding: 0; }
  .rail-foot .btn .label-text { display: none; }
  .main { padding: 1.25rem 1rem 3rem; }
  .fields-2 { grid-template-columns: 1fr; }
  .now-amount { font-size: var(--t-xl); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
