forced-aligner / style.css
CiscoR's picture
In-browser forced aligner (transformers.js, int8 ONNX)
33af36b verified
Raw History Blame Contribute Delete
13.3 kB
:root {
--bg: #f7f8fb;
--panel: #ffffff;
--text: #0f172a;
--muted: #5b6478;
--border: #e2e6ef;
--accent: #4f46e5;
--accent-strong: #4338ca;
--accent-soft: #eef0ff;
--on-accent: #ffffff;
--mid: #d97706;
--lo: #dc2626;
--warn-text: #9f1239;
--track: #eceff5;
--code-bg: #f3f4f8;
--shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.04);
--radius: 12px;
--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
color-scheme: light;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #0b0f19;
--panel: #121826;
--text: #e5e7ef;
--muted: #98a1b6;
--border: #253047;
--accent: #818cf8;
--accent-strong: #a5b4fc;
--accent-soft: #1e2140;
--on-accent: #0b0f19;
--mid: #f59e0b;
--lo: #f87171;
--warn-text: #fda4af;
--track: #1a2234;
--code-bg: #0e1422;
--shadow: none;
color-scheme: dark;
}
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
margin: 0;
background: var(--bg);
color: var(--text);
font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans",
"Noto Sans Devanagari", "Noto Sans CJK SC", "PingFang SC", "Hiragino Sans", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.86em; background: var(--code-bg); padding: 0.05em 0.35em; border-radius: 5px; }
small { font-weight: 400; color: var(--muted); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 40px; }
/* Header */
.hero { margin-bottom: 18px; }
.brand { margin: 0 0 6px; font-size: 0.8rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }
.brand a { color: var(--muted); }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.25rem); line-height: 1.15; margin: 0 0 10px; letter-spacing: -0.02em; }
.lede { font-size: 1.04rem; color: var(--muted); max-width: 800px; margin: 0 0 12px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 12px; }
.pills li { font-size: 0.8rem; padding: 3px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); }
.pills li.hl { border-color: transparent; background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.links { margin: 0; font-size: 0.93rem; }
.links .sep { color: var(--muted); margin: 0 6px; }
/* Status */
.status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 10px 14px; margin-bottom: 16px;
border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); font-size: 0.9rem; }
.status-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; flex: none; }
.status[data-state="ready"] .dot { background: #22c55e; }
.status[data-state="error"] .dot { background: #ef4444; }
.status[data-state="idle"] .dot { background: var(--muted); }
#status-detail { color: var(--muted); }
.bar { flex: 1 1 160px; height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; min-width: 120px; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease; }
.status[data-state="ready"] .bar, .status[data-state="error"] .bar, .status[data-state="idle"] .bar { display: none; }
.privacy { display: flex; align-items: center; gap: 6px; color: var(--muted); margin-left: auto; font-size: 0.85rem; }
.privacy svg { flex: none; }
/* Layout */
.grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .grid { grid-template-columns: minmax(0, 1fr); } .privacy { margin-left: 0; } }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.panel + .panel { margin-top: 16px; }
.grid .panel + .panel { margin-top: 0; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; min-height: 30px; }
.label-row.tight { margin-bottom: 0; min-height: 0; }
.label { font-weight: 650; font-size: 0.92rem; display: inline-block; }
.hint { margin: 2px 0 0; font-size: 0.8rem; color: var(--muted); }
.label-row .hint { margin: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
textarea, input[type="text"], input:not([type]), input[list] {
width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px;
background: var(--bg); color: var(--text); font: inherit; font-size: 0.94rem; line-height: 1.55;
}
textarea { resize: vertical; min-height: 140px; }
textarea:focus, input:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Audio input */
.drop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px; margin-bottom: 14px;
border: 1px dashed var(--border); border-radius: 10px; background: var(--bg); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-hint { font-size: 0.8rem; color: var(--muted); }
button.big { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; font-size: 0.9rem; font-weight: 600; background: var(--panel); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lo); flex: none; }
#record.on { border-color: var(--lo); color: var(--lo); }
#record.on .rec-dot { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { #record.on .rec-dot { animation: none; } }
.row2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; margin: 12px 0 10px; }
.row2 .label { margin-bottom: 6px; }
@media (max-width: 520px) { .row2 { grid-template-columns: minmax(0, 1fr); } }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--bg); max-width: 100%; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 8px 12px; font-size: 0.88rem; white-space: nowrap; }
.seg label + label span { border-left: 1px solid var(--border); }
.seg input:checked + span { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
details.opts { margin: 4px 0 14px; border: 1px solid var(--border); border-radius: 9px; padding: 8px 12px; }
details.opts summary { font-size: 0.9rem; }
details.opts[open] summary { margin-bottom: 8px; }
.opt { margin-bottom: 12px; }
.opt .label { margin-bottom: 6px; }
output { font-family: var(--mono); font-weight: 650; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 6px 0 0; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 0.9rem; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--accent); }
.check small { display: block; font-size: 0.78rem; }
button { font: inherit; cursor: pointer; }
button.primary { width: 100%; padding: 11px 16px; border: 0; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-weight: 650; }
button.primary:hover:not(:disabled) { background: var(--accent-strong); }
button.primary:disabled { opacity: 0.6; cursor: progress; }
button.ghost, a.btn { display: inline-block; padding: 4px 12px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text); font-size: 0.82rem; }
button.ghost:hover, a.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
a.btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
#load-btn { padding: 6px 14px; border-radius: 8px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 14px 0 0; }
.examples .mini { font-size: 0.78rem; color: var(--muted); margin-right: 2px; width: 100%; }
.chip { font: inherit; font-size: 0.8rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border);
background: var(--bg); color: var(--text); cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
/* Player */
.downloads { display: flex; gap: 6px; }
.player { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--bg); }
.player audio { width: 100%; height: 40px; display: block; }
.timeline { position: relative; height: 24px; margin: 10px 0 12px; cursor: pointer; border-radius: 4px; background: var(--track); overflow: hidden; }
.block { position: absolute; top: 3px; bottom: 3px; border-radius: 2px; opacity: 0.55; background: var(--accent); border-right: 2px solid var(--track); }
.block.mid { background: var(--mid); }
.block.lo { background: var(--lo); }
.block.on { opacity: 1; top: 0; bottom: 0; }
.head { position: absolute; top: 0; bottom: 0; width: 2px; left: 0; background: var(--text); pointer-events: none; }
.words { font-size: 1.12rem; line-height: 1.9; max-height: 300px; min-height: 3.8em; overflow-y: auto; padding-right: 4px; overflow-wrap: anywhere; position: relative; }
.words:empty::before { content: "Word timings appear here, synced to playback. Press Align."; color: var(--muted); font-size: 0.95rem; }
.w { cursor: pointer; border-radius: 4px; padding: 1px 2px; transition: background 80ms; }
.w:hover { background: var(--track); }
.w.mid { text-decoration: underline dotted var(--mid) 2px; text-underline-offset: 4px; }
.w.lo { text-decoration: underline wavy var(--lo) 1.5px; text-underline-offset: 4px; }
.w.na { color: var(--muted); cursor: default; }
.w.on { background: var(--accent); color: var(--on-accent); }
.legend { font-size: 0.8rem; color: var(--muted); margin-top: 8px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 3px 0 10px; vertical-align: -1px; background: var(--accent); }
.key.mid { background: var(--mid); }
.key.lo { background: var(--lo); }
.notes { font-size: 0.88rem; margin-top: 10px; }
.notes p { margin: 6px 0; overflow-wrap: anywhere; }
.notes .warn { color: var(--warn-text); }
.notes .muted { color: var(--muted); }
/* Table */
.table-wrap { max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: 9px; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); }
th { position: sticky; top: 0; background: var(--panel); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 650; }
td:first-child, th:first-child { width: 3.5em; color: var(--muted); }
td:nth-child(n+3), th:nth-child(n+3) { width: 6.5em; text-align: right; }
td:nth-child(2) { overflow-wrap: anywhere; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--track); }
tbody tr.mid td:last-child { color: var(--mid); font-weight: 600; }
tbody tr.lo td:last-child { color: var(--lo); font-weight: 600; }
tbody tr.na { color: var(--muted); }
tbody:empty::after { content: "No alignment yet."; display: block; padding: 10px; color: var(--muted); }
/* Code */
h2 { font-size: 1.1rem; margin: 0 0 6px; }
.code > p { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 7px 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 0.88rem; font-weight: 600; margin-bottom: -1px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabpane .sub { margin: 12px 0 6px; font-size: 0.82rem; font-weight: 650; color: var(--muted); }
.codebox { position: relative; }
.codebox pre { margin: 0; padding: 14px 16px; background: var(--code-bg); border: 1px solid var(--border);
border-radius: 9px; overflow-x: auto; font: 0.84rem/1.6 var(--mono); }
.codebox pre code { background: none; padding: 0; font-size: inherit; }
.codebox .ghost { position: absolute; top: 8px; right: 8px; background: var(--panel); }
/* Details */
details > summary { cursor: pointer; font-weight: 650; }
details.panel ol { padding-left: 1.3em; margin: 10px 0; }
details.panel li { margin: 4px 0; }
details.panel p { margin: 10px 0; color: var(--muted); }
footer { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 26px; }
footer code { font-size: 0.8em; overflow-wrap: anywhere; }
@media (max-width: 520px) {
.wrap { padding: 20px 16px 32px; }
.panel { padding: 13px; }
.player { padding: 10px; }
#input-hint, .drop-hint { display: none; }
.words { font-size: 1.05rem; }
th, td { padding: 6px 7px; }
td:nth-child(n+3), th:nth-child(n+3) { width: 4.6em; }
}