Files
PA_horn_speaker/static/style.css
T

468 lines
11 KiB
CSS

/* 喇叭 — 控制界面
概念:颜色 = 喇叭是否在响。待机时整页无彩,只有正在广播时才出现唯一的朱红。 */
:root {
--paper: #121614;
--surface: #1A1F1C;
--ink: #ECEFEA;
--ink-soft: #9AA29C;
--line: #2C332E;
--live: #FF5A3D;
--live-ink: #121614;
--ink-hover: #DCE0D9;
--live-hover: #FF7059;
--slab-shadow: none;
--slab-ring: 1px solid var(--line);
color-scheme: dark;
}
:root.theme-light {
--paper: #F0F1EE;
--surface: #FFFFFF;
--ink: #191C1A;
--ink-soft: #5E645F;
--line: #D9DBD6;
--live: #C8321E;
--live-ink: #FFFFFF;
--ink-hover: #2E332F;
--live-hover: #B02A18;
--slab-shadow: 0 20px 44px -28px rgba(25, 28, 26, 0.45);
--slab-ring: 1px solid transparent;
color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC",
"Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
font-size: 16px;
line-height: 1.6;
background: var(--paper);
color: var(--ink);
min-height: 100dvh;
-webkit-font-smoothing: antialiased;
padding: max(22px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right))
max(34px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
transition: background-color 0.25s ease, color 0.25s ease;
}
/* 正在广播时,页面顶端出现一条朱红横线 */
body::before {
content: "";
position: fixed;
inset: 0 0 auto 0;
height: 3px;
background: var(--live);
transform: scaleX(0);
transform-origin: left;
transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.3, 1);
z-index: 10;
}
body.is-live::before { transform: scaleX(1); }
.shell { max-width: 640px; margin: 0 auto; }
.sr-only {
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* ---------- 页头 ---------- */
.top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-bottom: 26px;
}
.wordmark {
font-size: 1.85rem;
font-weight: 800;
letter-spacing: 0.1em;
line-height: 1.1;
}
.top-actions { display: flex; align-items: center; gap: 12px; }
.live-dot {
width: 8px; height: 8px; border-radius: 50%;
background: var(--line);
transition: background-color 0.25s ease;
}
body.is-live .live-dot {
background: var(--live);
animation: breathe 1.8s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.22; } }
.ghost-btn {
font: inherit;
font-size: 0.8125rem;
color: var(--ink-soft);
background: none;
border: 1px solid var(--line);
border-radius: 999px;
padding: 6px 14px;
cursor: pointer;
transition: color 0.18s ease, border-color 0.18s ease;
}
.ghost-btn:hover { color: var(--ink); border-color: var(--ink-soft); }
.ghost-btn.small { padding: 4px 12px; font-size: 0.75rem; }
.ghost-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
/* ---------- 输入区(唯一有阴影的面) ---------- */
.slab {
background: var(--surface);
border: var(--slab-ring);
border-radius: 20px;
box-shadow: var(--slab-shadow);
padding: 4px 4px 0;
transition: background-color 0.25s ease, border-color 0.25s ease;
}
.slab:focus-within { outline: 2px solid var(--ink); outline-offset: 3px; }
#text {
display: block;
width: 100%;
border: 0;
background: none;
color: inherit;
font: inherit;
font-size: 1.0625rem;
line-height: 1.75;
padding: 20px 18px 6px;
resize: none;
overflow: auto;
max-height: 420px;
}
#text::placeholder { color: var(--ink-soft); opacity: 0.7; }
#text:focus { outline: none; }
#text.nudge { animation: nudge 0.5s ease; }
@keyframes nudge {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-5px); }
75% { transform: translateX(5px); }
}
.slab-foot {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px 14px;
flex-wrap: wrap;
padding: 6px 18px 14px;
}
.meta {
font-size: 0.8125rem;
color: var(--ink-soft);
font-variant-numeric: tabular-nums;
}
.voice-pick { position: relative; display: inline-flex; align-items: center; min-width: 0; }
#voice {
appearance: none;
-webkit-appearance: none;
font: inherit;
font-size: 0.875rem;
color: var(--ink);
background: none;
border: 0;
border-bottom: 1px solid var(--line);
border-radius: 0;
padding: 4px 22px 4px 0;
max-width: 52vw;
cursor: pointer;
text-overflow: ellipsis;
transition: border-color 0.18s ease;
}
#voice:hover { border-color: var(--ink-soft); }
#voice:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
#voice option { background: var(--surface); color: var(--ink); }
.voice-pick::after {
content: "";
position: absolute;
right: 5px;
top: 50%;
width: 6px; height: 6px;
border-right: 1.5px solid var(--ink-soft);
border-bottom: 1.5px solid var(--ink-soft);
transform: translateY(-70%) rotate(45deg);
pointer-events: none;
}
/* ---------- 循环与间隔 ---------- */
.loop-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
flex-wrap: wrap;
margin: 18px 2px 0;
}
.switch {
display: inline-flex;
align-items: center;
gap: 10px;
font-size: 0.9375rem;
cursor: pointer;
user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
position: relative;
flex: none;
width: 38px; height: 22px;
border-radius: 999px;
background: var(--line);
transition: background-color 0.2s ease;
}
.switch-track::after {
content: "";
position: absolute;
top: 3px; left: 3px;
width: 16px; height: 16px;
border-radius: 50%;
background: var(--surface);
transition: transform 0.2s ease;
}
.switch input:checked + .switch-track { background: var(--ink); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--ink); outline-offset: 2px; }
.interval { display: flex; align-items: center; gap: 12px; }
.interval[hidden] { display: none; }
#interval {
appearance: none;
-webkit-appearance: none;
width: 118px;
height: 22px;
background: none;
cursor: pointer;
}
#interval::-webkit-slider-runnable-track { height: 2px; background: var(--line); }
#interval::-webkit-slider-thumb {
appearance: none;
-webkit-appearance: none;
margin-top: -7px;
width: 16px; height: 16px;
border-radius: 50%;
background: var(--ink);
}
#interval::-moz-range-track { height: 2px; background: var(--line); }
#interval::-moz-range-thumb {
width: 16px; height: 16px; border: 0;
border-radius: 50%; background: var(--ink);
}
#interval:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 999px; }
#interval-out { min-width: 4.6em; }
/* ---------- 广播按钮:界面上唯一一件大事 ---------- */
.broadcast {
display: block;
width: 100%;
margin-top: 22px;
font: inherit;
font-size: 1.0625rem;
font-weight: 700;
letter-spacing: 0.06em;
color: var(--paper);
background: var(--ink);
border: 0;
border-radius: 20px;
padding: 20px 24px;
cursor: pointer;
transition: background-color 0.22s ease, color 0.22s ease, transform 0.1s ease;
}
.broadcast:hover { background: var(--ink-hover); }
.broadcast:active { transform: translateY(1px); }
.broadcast:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.broadcast:disabled { cursor: default; opacity: 0.55; }
.broadcast.is-stop { background: var(--live); color: var(--live-ink); }
.broadcast.is-stop:hover { background: var(--live-hover); }
/* ---------- 抽屉 ---------- */
.drawer { margin-top: 30px; border-top: 1px solid var(--line); }
.drawer-head {
display: flex;
align-items: center;
gap: 10px;
width: 100%;
padding: 15px 0;
font: inherit;
color: inherit;
text-align: left;
background: none;
border: 0;
cursor: pointer;
}
.drawer-head:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.drawer-title {
flex: none;
font-size: 0.9375rem;
font-weight: 600;
white-space: nowrap;
}
.drawer-meta {
margin-right: auto;
min-width: 0;
font-size: 0.8125rem;
color: var(--ink-soft);
font-variant-numeric: tabular-nums;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.caret {
flex: none;
width: 7px; height: 7px;
border-right: 1.5px solid var(--ink-soft);
border-bottom: 1.5px solid var(--ink-soft);
transform: rotate(45deg);
transition: transform 0.2s ease;
}
.drawer-head[aria-expanded="true"] .caret { transform: rotate(225deg); }
.drawer-body { display: none; padding-bottom: 14px; }
.drawer-body.open { display: block; }
body.is-live #status-text { color: var(--live); }
/* ---------- 语音列表 ---------- */
.rows { display: flex; flex-direction: column; }
.row {
display: grid;
gap: 2px;
padding: 14px 0;
border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; padding-top: 2px; }
.row-name {
width: 100%;
padding: 2px 0;
font: inherit;
font-size: 0.9375rem;
font-weight: 600;
color: var(--ink);
background: none;
border: 0;
border-radius: 4px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.row-name:hover { box-shadow: inset 0 -1px 0 var(--line); }
.row-name:focus { outline: none; box-shadow: inset 0 -1px 0 var(--ink); }
.row-meta {
display: flex;
gap: 12px;
font-size: 0.75rem;
color: var(--ink-soft);
font-variant-numeric: tabular-nums;
}
.row-actions {
display: flex;
align-items: center;
gap: 4px;
flex-wrap: wrap;
margin-top: 6px;
}
.act {
font: inherit;
font-size: 0.75rem;
color: var(--ink-soft);
background: none;
border: 1px solid transparent;
border-radius: 999px;
padding: 3px 10px;
cursor: pointer;
transition: color 0.18s ease, border-color 0.18s ease;
}
.act:hover { color: var(--ink); border-color: var(--line); }
.act:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.act[data-act="play"] { color: var(--ink); }
.act.on { color: var(--ink); border-color: var(--ink); }
.act.danger { color: var(--live); border-color: var(--live); }
.confirm-text { font-size: 0.75rem; color: var(--ink-soft); }
.empty { padding: 4px 0 10px; font-size: 0.875rem; line-height: 1.7; color: var(--ink-soft); }
/* ---------- 日志 ---------- */
.logs {
display: flex;
flex-direction: column;
gap: 4px;
max-height: 220px;
overflow: auto;
margin-bottom: 12px;
padding-left: 12px;
border-left: 1px solid var(--line);
font-size: 0.8125rem;
color: var(--ink-soft);
}
.log { display: flex; gap: 10px; }
.log-time { flex: none; opacity: 0.6; font-variant-numeric: tabular-nums; }
.log-ok { color: var(--ink); }
.log-err { color: var(--ink); font-weight: 600; }
/* ---------- 宽屏:抽屉变成右栏常显 ---------- */
@media (min-width: 1000px) {
body { padding: 46px 40px 72px; }
.shell {
max-width: 1000px;
display: grid;
grid-template-columns: minmax(0, 1fr) 340px;
gap: 0 48px;
}
.top { grid-column: 1 / -1; margin-bottom: 34px; }
.composer { grid-column: 1; grid-row: 2 / span 2; }
#history { grid-column: 2; grid-row: 2; margin-top: 0; border-top: 0; }
#history .drawer-head { padding-top: 0; }
#status { grid-column: 2; grid-row: 3; margin-top: 24px; }
.drawer-body { display: block; }
.caret { display: none; }
#text { min-height: 260px; }
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.001ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.001ms !important;
}
}