/* Fumo Panel - standalone stylesheet (no CSS framework).
   Light/dark follow the OS; data-theme="light|dark" on <html> overrides it. */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --bg:          light-dark(#f5f5f7, #000000);
  --side-bg:     light-dark(#fbfbfd, #161617);
  --surface:     light-dark(#ffffff, #1c1c1e);
  --surface-2:   light-dark(#f5f5f7, #2c2c2e);
  --fill:        light-dark(rgba(120, 120, 128, .12), rgba(120, 120, 128, .24));
  --fill-2:      light-dark(rgba(120, 120, 128, .20), rgba(120, 120, 128, .34));
  --seg-on:      light-dark(#ffffff, #636366);
  --text:        light-dark(#1d1d1f, #f5f5f7);
  --text-2:      light-dark(#6e6e73, #a1a1a6);
  --text-3:      light-dark(#86868b, #6e6e73);
  --sep:         light-dark(rgba(0, 0, 0, .08), rgba(255, 255, 255, .09));
  --border:      light-dark(rgba(0, 0, 0, .07), rgba(255, 255, 255, .06));
  --input-bg:    light-dark(#ffffff, #1c1c1e);
  --input-line:  light-dark(#d2d2d7, #424245);
  --code-bg:     light-dark(#fbfbfd, #141415);
  --code-sel:    light-dark(#cfe3ff, #2d3e57);
  --accent:      light-dark(#0071e3, #0a84ff);
  --accent-2:    light-dark(#0077ed, #409cff);
  --focus:       light-dark(rgba(0, 113, 227, .25), rgba(10, 132, 255, .4));
  --green:       light-dark(#248a3d, #30d158);
  --red:         light-dark(#d70015, #ff453a);
  --orange:      light-dark(#b25000, #ff9f0a);
  --blue:        light-dark(#0066cc, #409cff);
  --green-tint:  light-dark(rgba(52, 199, 89, .14), rgba(48, 209, 88, .16));
  --red-tint:    light-dark(rgba(255, 59, 48, .10), rgba(255, 69, 58, .16));
  --orange-tint: light-dark(rgba(255, 149, 0, .12), rgba(255, 159, 10, .16));
  --blue-tint:   light-dark(rgba(0, 122, 255, .10), rgba(10, 132, 255, .18));
  --shadow:      light-dark(0 1px 2px rgba(0, 0, 0, .04), none);
  --radius: 14px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.47 var(--font);
       letter-spacing: -.008em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3, h4 { margin: 0; color: var(--text); }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.022em; }
h2 { font-size: 20px; font-weight: 600; letter-spacing: -.018em; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: -.012em; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 600; }
small { font-size: 12px; }
code { font-family: var(--mono); font-size: .86em; background: var(--fill); padding: .08em .38em; border-radius: 5px; }
pre { font-family: var(--mono); }
ul { margin: 0; padding: 0; }
.muted { color: var(--text-2); }
.ok { color: var(--green); } .bad { color: var(--red); } .warn-t { color: var(--orange); }
.num, td, .stat .v { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
        padding: 22px 12px 16px; background: var(--side-bg); border-right: 1px solid var(--sep); }
.brand { display: block; padding: 0 10px; color: var(--text); font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.nav { display: flex; flex-direction: column; gap: 2px; list-style: none; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
         color: var(--text); font-size: 14px; font-weight: 500; }
.nav a:hover { background: var(--fill); text-decoration: none; }
.nav a.active { background: var(--fill-2); }
.nav svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 4px; }
.side-foot form { margin: 0; }
.side-foot .seg { display: flex; }
.side-foot .seg button { flex: 1; }
.main { min-width: 0; padding: 34px 40px 80px; }
.wrap { max-width: 1180px; margin: 0 auto; }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px;
          padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--sep); }
  .brand { padding: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { padding: 6px 10px; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; padding: 0; }
  .main { padding: 22px 16px 60px; }
  h1 { font-size: 24px; }
}

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
             margin-bottom: 24px; }
.page-head .sub { margin-top: 6px; color: var(--text-2); font-size: 14px; }
.page-head .sub a { color: var(--text-2); }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 14px; font-weight: 500; }
.back::before { content: ""; width: 7px; height: 7px; border-left: 1.8px solid currentColor;
                border-bottom: 1.8px solid currentColor; transform: rotate(45deg); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.dot-sep::before { content: "\00B7"; margin: 0 .45em; color: var(--text-3); }

/* ---------- segmented control (show tabs, viewer stages, theme) ---------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: 9px; background: var(--fill); max-width: 100%; }
.seg a, .seg button { display: inline-flex; align-items: center; justify-content: center; height: 28px; padding: 0 14px;
                      border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit;
                      font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.seg a:hover, .seg button:hover { text-decoration: none; background: var(--fill); }
.seg .on, .seg .on:hover, .seg .active, .seg .active:hover {
  background: var(--seg-on); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
.seg .kbd { margin-right: 6px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.seg.small a, .seg.small button { height: 24px; padding: 0 8px; font-size: 12px; }
.tabs { display: flex; width: fit-content; margin: -6px 0 24px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 20px 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
             margin-bottom: 16px; }
.card-head .desc, .card .desc { color: var(--text-2); font-size: 13px; }
.card .desc { margin: -8px 0 16px; }
.card.warn { border-color: light-dark(rgba(255, 149, 0, .45), rgba(255, 159, 10, .4)); }
.card.tile { margin: 0; padding: 16px 18px; background: var(--surface-2); border-color: transparent; box-shadow: none; }
a.card { display: block; color: inherit; transition: border-color .15s; }
a.card:hover { text-decoration: none; border-color: var(--input-line); }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0 16px; }
.fields .wide { grid-column: 1 / -1; }
.fields .span2 { grid-column: span 2; }
.stack > * + * { margin-top: 12px; }
@media (max-width: 980px) { .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } .fields .span2 { grid-column: 1 / -1; } }

/* ---------- forms ---------- */
form { margin: 0; }
label { display: block; margin-bottom: 14px; color: var(--text-2); font-size: 13px; font-weight: 500; }
label > input, label > select, label > textarea, label > .inline { margin-top: 6px; }
label small, .help { display: block; margin-top: 5px; color: var(--text-3); font-size: 12px; font-weight: 400; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea {
  display: block; width: 100%; height: 34px; padding: 0 11px; margin: 0;
  border: 1px solid var(--input-line); border-radius: 8px; background: var(--input-bg); color: var(--text);
  font: inherit; font-size: 14px; letter-spacing: normal; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; padding: 8px 11px; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
input[type=number] { font-variant-numeric: tabular-nums; }
select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 11px 8px; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; cursor: pointer; }
input[role=switch] { appearance: none; position: relative; width: 38px; height: 22px; border-radius: 999px;
                     background: var(--fill-2); transition: background .2s; }
input[role=switch]::before { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
                             border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
                             transition: transform .2s; }
input[role=switch]:checked { background: var(--accent); }
input[role=switch]:checked::before { transform: translateX(16px); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.inline { display: flex; gap: 8px; }
.inline > * { flex: 1; min-width: 0; }
.switches { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin: 2px 0 14px; }
.switches label, label.switch { display: inline-flex; align-items: center; gap: 9px; margin: 0;
                                 color: var(--text); font-size: 14px; font-weight: 400; cursor: pointer; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.option { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 12px 14px; cursor: pointer;
          border: 1px solid var(--input-line); border-radius: 10px; color: var(--text); font-size: 14px; font-weight: 400; }
.option input { margin-top: 2px; }
.option span small { display: block; margin-top: 2px; color: var(--text-2); font-size: 12px; }
.options.presets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .options.presets { grid-template-columns: minmax(0, 1fr); } }
button.option { height: auto; padding: 12px 14px; background: transparent; color: var(--text); text-align: left;
                justify-content: flex-start; align-items: flex-start; white-space: normal; font-weight: 600; }
button.option:hover { background: var(--fill); }
button.option small { font-weight: 400; }
button.option.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.option:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bool-field { align-self: center; margin-bottom: 14px; }
.bool-field .switches { margin: 0; }
.bool-field .help { margin-top: 6px; max-width: 70ch; line-height: 1.45; }
.guide > summary { font-size: 16px; font-weight: 600; }
.guide p, .guide dd, .guide li { color: var(--text-2); font-size: 14px; line-height: 1.5; }
.guide dl { display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr); gap: 10px 18px; margin: 4px 0 18px; }
.guide dt { font-size: 14px; font-weight: 600; }
.guide dd { margin: 0; }
.guide h4 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.guide ol { margin: 0; padding-left: 20px; }
.guide li + li { margin-top: 4px; }
@media (max-width: 640px) { .guide dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .guide dd { margin-bottom: 8px; } }
.save-note { margin-right: auto; align-self: center; color: var(--text-2); font-size: 13px; }
label.changed .lbl::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px;
                            border-radius: 50%; background: var(--accent); vertical-align: 2px; }
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px;
            margin: 0 -12px; padding: 12px; border-radius: 12px;
            background: color-mix(in srgb, var(--bg) 82%, transparent);
            backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); }

/* ---------- buttons ---------- */
button, [role=button] {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 16px; margin: 0;
  border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap;
  text-decoration: none; transition: background .15s, opacity .15s; }
button:hover, [role=button]:hover { background: var(--accent-2); text-decoration: none; }
button:focus-visible, [role=button]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
button:disabled { opacity: .4; cursor: default; pointer-events: none; }
button.secondary, [role=button].secondary { background: var(--fill); color: var(--text); }
button.secondary:hover, [role=button].secondary:hover { background: var(--fill-2); }
button.danger { background: var(--red-tint); color: var(--red); }
button.danger:hover { background: light-dark(rgba(255, 59, 48, .16), rgba(255, 69, 58, .24)); }
button.block { width: 100%; }
button.destructive { background: light-dark(#ff3b30, #ff453a); color: #fff; }
button.destructive:hover { background: light-dark(#e0352b, #ff5a50); }

/* ---------- confirm dialog ---------- */
dialog.modal { width: min(400px, calc(100vw - 32px)); padding: 24px 24px 18px; border: 0; border-radius: 16px;
               background: var(--surface); color: var(--text); box-shadow: 0 24px 70px rgba(0, 0, 0, .35); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
dialog.modal h3 { margin-bottom: 8px; }
dialog.modal p { margin: 0 0 20px; color: var(--text-2); font-size: 14px; }
dialog.modal .actions { justify-content: flex-end; }
.btn-sm, td button { height: 28px; padding: 0 12px; font-size: 13px; }

/* ---------- tables & lists ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 8px 12px; border-bottom: 1px solid var(--sep); text-align: left; white-space: nowrap;
     color: var(--text-2); font-size: 12px; font-weight: 500; }
td { padding: 11px 12px; border-bottom: 1px solid var(--sep); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
td .inline { max-width: 11rem; }
td input:not([type=checkbox]) { height: 28px; }
.right { text-align: right; }
.rows > * { display: flex; justify-content: space-between; align-items: center; gap: 12px;
            padding: 10px 0; border-bottom: 1px solid var(--sep); }
.rows > *:first-child { padding-top: 0; }
.rows > *:last-child { border-bottom: 0; padding-bottom: 0; }
.rows .meta { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.empty { padding: 22px 0; text-align: center; color: var(--text-2); font-size: 14px; }
.ico { width: 16px; height: 16px; vertical-align: -3px; margin-right: 8px; color: var(--text-3); }
.ico.folder { color: var(--accent); }

/* ---------- details ---------- */
details > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none;
                    font-weight: 500; color: var(--text); }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 6px; height: 6px; flex: none; margin: 0 2px;
                            border-right: 1.7px solid var(--text-3); border-bottom: 1.7px solid var(--text-3);
                            transform: rotate(-45deg); transition: transform .15s; }
details[open] > summary::before { transform: rotate(45deg); }
details[open] > summary { margin-bottom: 14px; }
details > summary.bad { color: var(--red); }

/* ---------- flash ---------- */
.flash { margin-bottom: 20px; padding: 11px 16px; border-radius: 12px; font-size: 14px;
         background: var(--green-tint); color: var(--green); }
.flash.bad { background: var(--red-tint); color: var(--red); }

/* ---------- stats / badges / status / progress ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.stat .k { color: var(--text-2); font-size: 12px; font-weight: 500; }
.stat .v { margin-top: 3px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.stat .v small { color: var(--text-2); font-size: 13px; font-weight: 400; letter-spacing: 0; }
.stat .v.text { font-size: 15px; font-weight: 500; letter-spacing: -.01em; padding-top: 4px; }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px;
         background: var(--fill); color: var(--text-2); font-size: 12px; font-weight: 500; letter-spacing: 0;
         white-space: nowrap; vertical-align: 1px; }
.badge.running, .badge.uploaded, .badge.muxing, .badge.rendering, .badge.loading { background: var(--blue-tint); color: var(--blue); }
.badge.done { background: var(--green-tint); color: var(--green); }
.badge.failed { background: var(--red-tint); color: var(--red); }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.status.on::before { background: light-dark(#34c759, #30d158); }
.status.off::before { background: var(--red); }
progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 6px; margin: 0;
           border: 0; border-radius: 999px; overflow: hidden; background: var(--fill); color: var(--accent); }
progress::-webkit-progress-bar { background: var(--fill); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width .3s; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
progress:indeterminate { background: var(--fill) linear-gradient(var(--accent), var(--accent)) no-repeat;
                         background-size: 28% 100%; animation: indeterminate 1.3s ease-in-out infinite; }
progress:indeterminate::-webkit-progress-bar { background: transparent; }
progress:indeterminate::-moz-progress-bar { background: transparent; }
@keyframes indeterminate { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.prog { display: flex; align-items: center; gap: 12px; }
.prog progress { flex: 1; }
.prog small { color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- running jobs ---------- */
.job { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; }
.job .title { font-weight: 600; }
.job .title a { color: var(--text); }
.job .meta { color: var(--text-2); font-size: 13px; }
.job .prog { grid-column: 1 / -1; margin-top: 6px; }
.stack-tiles > * + * { margin-top: 10px; }

/* ---------- track editor ---------- */
.track { padding: 16px 18px 2px; margin-bottom: 12px; border-radius: 12px; background: var(--surface-2); }
.track-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.track-head .name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.track input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .track select { background-color: var(--input-bg); }

/* ---------- code editor & log ---------- */
.CodeMirror { height: 68vh; border: 1px solid var(--input-line); border-radius: 10px; background: var(--code-bg);
              color: var(--text); font-family: var(--mono); font-size: 13px; line-height: 1.55; }
.CodeMirror-focused { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.CodeMirror-gutters { background: var(--code-bg); border-right: 1px solid var(--sep); border-radius: 10px 0 0 10px; }
.CodeMirror-linenumber { color: var(--text-3); padding: 0 10px 0 6px; }
.CodeMirror-cursor { border-left: 1.5px solid var(--text); }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: var(--code-sel); }
.cm-s-fumo .cm-keyword { color: light-dark(#9b2393, #fc5fa3); font-weight: 600; }
.cm-s-fumo .cm-string, .cm-s-fumo .cm-string-2 { color: light-dark(#c41a16, #fc6a5d); }
.cm-s-fumo .cm-number { color: light-dark(#1c00cf, #d0bf69); }
.cm-s-fumo .cm-comment { color: light-dark(#5d6c79, #7f8c98); font-style: italic; }
.cm-s-fumo .cm-def { color: light-dark(#0f68a0, #41a1c0); }
.cm-s-fumo .cm-builtin { color: light-dark(#3900a0, #a167e6); }
.cm-s-fumo .cm-variable-2, .cm-s-fumo .cm-property { color: light-dark(#326d74, #67b7a4); }
.cm-s-fumo .cm-atom { color: light-dark(#9b2393, #fc5fa3); }
.cm-s-fumo .cm-meta { color: light-dark(#643820, #fd8f3f); }
.cm-s-fumo .cm-attribute { color: light-dark(#815f03, #bf8555); }
.cm-s-fumo .CodeMirror-matchingbracket { color: inherit; background: var(--fill-2); }
textarea.code { min-height: 60vh; font-family: var(--mono); font-size: 13px; }
pre.log { max-height: 30rem; margin: 0; padding: 12px 14px; overflow: auto; white-space: pre-wrap;
          border: 1px solid var(--sep); border-radius: 10px; background: var(--code-bg); color: var(--text);
          font-size: 12px; line-height: 1.55; }

/* ---------- frame viewer ---------- */
.viewer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.frames { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.frames button { height: 26px; padding: 0 10px; border-radius: 999px; background: var(--fill); color: var(--text);
                 font-size: 12px; font-variant-numeric: tabular-nums; }
.frames button:hover { background: var(--fill-2); }
.frames button.on { background: var(--accent); color: #fff; }
.view { position: relative; height: clamp(360px, calc(100vh - 230px), 1400px); overflow: hidden; border-radius: 12px;
        background: #0b0b0c; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.view.dragging { cursor: grabbing; }
.view img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; will-change: transform; }
.view img.px { image-rendering: pixelated; }
.view .label, .view .readout { position: absolute; left: 12px; z-index: 2; padding: 4px 10px; border-radius: 8px;
               background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; font-weight: 500; pointer-events: none;
               backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-variant-numeric: tabular-nums; }
.view .label { top: 12px; }
.view .readout { bottom: 12px; font-family: var(--mono); font-weight: 400; white-space: pre; }
.zoom-level { min-width: 52px; text-align: right; color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.viewer:fullscreen { overflow: auto; padding: 16px 20px; background: var(--bg); }
.viewer:fullscreen .view { height: calc(100vh - 140px); }
.vinfo { margin-top: 18px; }
.vinfo h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.vinfo h4 + .table-wrap { margin-bottom: 18px; }
table.compact { font-size: 13px; }
table.compact th { padding: 6px 10px; }
table.compact td { padding: 7px 10px; white-space: nowrap; }
table.compact th.n, table.compact td.n { text-align: right; }
table.compact tbody tr { cursor: pointer; }
table.compact tbody tr:hover td { background: var(--fill); }
table.compact tbody tr.on td { background: var(--blue-tint); }
table.compact tbody tr.on td:first-child { color: var(--blue); font-weight: 600; }
table.compact th:first-child, table.compact td:first-child { padding-left: 10px; border-radius: 8px 0 0 8px; }
table.compact th:last-child, table.compact td:last-child { padding-right: 10px; border-radius: 0 8px 8px 0; }
.hint { margin: 10px 0 0; color: var(--text-2); font-size: 12px; }
kbd { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 5px; background: var(--fill);
      color: var(--text); font: 500 11px/18px var(--font); text-align: center; }

/* ---------- login ---------- */
.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login .card { width: 100%; max-width: 360px; padding: 34px 28px 26px; }
.login h1 { text-align: center; font-size: 24px; }
.login .sub { margin: 6px 0 26px; text-align: center; color: var(--text-2); font-size: 14px; }
