:root {
  color-scheme: dark;
  --background: #080a14;
  --card: rgba(19, 24, 43, 0.88);
  --surface: #10172a;
  --surface-active: #17213c;
  --line: rgba(176, 196, 255, 0.16);
  --text: #f4f7ff;
  --muted: #9aa5c2;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --danger: #fb7185;
  --success: #5eead4;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 5% 5%, rgba(139, 92, 246, 0.2), transparent 28rem),
    radial-gradient(circle at 95% 95%, rgba(34, 211, 238, 0.13), transparent 30rem),
    var(--background);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.page-shell {
  display: grid;
  min-height: 100vh;
  padding: 32px 20px;
  place-items: center;
}

.voice-card {
  position: relative;
  width: min(100%, 560px);
  overflow: hidden;
  padding: clamp(28px, 7vw, 48px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38), inset 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
}

.signal { position: absolute; border-radius: 999px; filter: blur(2px); pointer-events: none; }
.signal-one { top: -92px; right: -76px; width: 220px; height: 220px; border: 1px solid rgba(139, 92, 246, 0.35); box-shadow: 0 0 80px rgba(139, 92, 246, 0.2); }
.signal-two { right: -20px; top: 18px; width: 104px; height: 104px; border: 1px solid rgba(34, 211, 238, 0.28); }

.brand { position: relative; display: inline-flex; align-items: center; gap: 8px; margin-bottom: 17px; color: var(--muted); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.13em; }
.brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 0 4px rgba(244, 114, 182, 0.16); }

h1 { position: relative; margin: 0; font-size: clamp(2rem, 8vw, 3.3rem); line-height: 1; letter-spacing: -0.06em; }
h1 span { color: var(--cyan); text-shadow: 0 0 28px rgba(34, 211, 238, 0.34); }
.subtitle { position: relative; margin: 14px 0 34px; color: var(--muted); font-size: clamp(0.96rem, 3vw, 1.08rem); }
.twitch-access { position: relative; margin: -12px 0 25px; padding: 15px; border: 1px solid rgba(167, 139, 250, .42); border-radius: 15px; background: rgba(139, 92, 246, .1); }
.twitch-access p { margin: 0; color: #ded6ff; line-height: 1.45; }
.button-twitch { display: grid; margin-top: 12px; place-items: center; text-decoration: none; background: #9147ff; }
.twitch-user { display: flex; min-width: 0; align-items: center; gap: 9px; margin-bottom: 12px; }
.twitch-profile-image, .twitch-profile-fallback { width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid rgba(196, 181, 253, .72); border-radius: 50%; }
.twitch-profile-image { object-fit: cover; background: #17112f; }
.twitch-profile-fallback { display: grid; place-items: center; background: #2b185a; }
.twitch-user strong { min-width: 0; overflow: hidden; color: #f5f3ff; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.twitch-logout { margin-left: auto; padding: 7px 10px; border: 1px solid rgba(196, 181, 253, .48); border-radius: 8px; color: #e9ddff; background: transparent; font-size: .78rem; font-weight: 700; }
.twitch-logout:hover:not(:disabled) { border-color: #c4b5fd; background: rgba(196, 181, 253, .12); }

label { display: block; margin-bottom: 9px; color: #d8e0f9; font-size: 0.88rem; font-weight: 650; }
input {
  width: 100%;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  color: var(--text);
  background: rgba(5, 8, 20, 0.58);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
input::placeholder { color: #697491; }
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12); }
select {
  width: 100%;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  color: var(--text);
  background: rgba(5, 8, 20, 0.58);
}
select:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.12); }

.recorder { margin-top: 22px; padding: 19px; border: 1px solid var(--line); border-radius: 18px; background: rgba(5, 8, 20, 0.43); }
.recorder-header { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
h2 { margin: 0; font-size: 0.95rem; }
.recording-state { color: var(--muted); font-size: 0.77rem; font-weight: 650; text-align: right; }
.recording-state.is-recording { color: var(--pink); }
.recording-state.is-ready { color: var(--success); }

.waveform { display: flex; height: 62px; align-items: center; justify-content: center; gap: 5px; margin: 15px 0 8px; }
.waveform i { width: 4px; height: 11px; border-radius: 99px; background: linear-gradient(var(--cyan), var(--violet)); opacity: 0.38; }
.waveform i:nth-child(3n) { height: 25px; }
.waveform i:nth-child(4n) { height: 39px; }
.waveform.is-recording i { opacity: 1; animation: pulse-wave 720ms ease-in-out infinite alternate; }
.waveform.is-recording i:nth-child(2n) { animation-delay: -300ms; }
.waveform.is-recording i:nth-child(3n) { animation-delay: -520ms; }
@keyframes pulse-wave { from { transform: scaleY(0.45); } to { transform: scaleY(1.1); } }

.timer { display: block; color: var(--text); font-variant-numeric: tabular-nums; font-size: 1.5rem; font-weight: 760; letter-spacing: 0.02em; text-align: center; }
.timer span { color: var(--muted); font-size: 0.86rem; font-weight: 600; }
.helper-text { min-height: 20px; margin: 7px 0 17px; color: var(--muted); font-size: 0.8rem; text-align: center; }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.button { width: 100%; min-height: 48px; padding: 12px 16px; border: 1px solid transparent; border-radius: 13px; color: var(--text); font-weight: 750; transition: transform 150ms ease, filter 150ms ease, background 150ms ease; }
.button:not(:disabled):hover { filter: brightness(1.1); transform: translateY(-1px); }
.button:focus-visible { outline: 3px solid rgba(34, 211, 238, 0.56); outline-offset: 3px; }
.button:disabled { opacity: 0.45; }
.button-record { background: linear-gradient(112deg, #7443ea, #9f67fa); box-shadow: 0 10px 28px rgba(139, 92, 246, 0.23); }
.button-stop { background: rgba(251, 113, 133, 0.13); border-color: rgba(251, 113, 133, 0.48); color: #ffb7c2; }
.button-secondary { margin-top: 13px; border-color: var(--line); background: var(--surface); color: #ced8f3; }
.button-submit { margin-top: 16px; background: linear-gradient(112deg, #089ab2, #16b8ce); box-shadow: 0 10px 28px rgba(34, 211, 238, 0.18); }

.preview-section { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
audio { width: 100%; min-height: 42px; }
.status-message { min-height: 20px; margin: 14px 1px 0; color: var(--muted); font-size: 0.85rem; text-align: center; }
.status-message.is-error { color: #fda4af; }
.status-message.is-success { color: var(--success); }
.privacy-note { margin: 22px 0 0; color: #7e89a8; font-size: 0.75rem; line-height: 1.45; text-align: center; }
.back-link { display: block; margin-top: 24px; color: var(--cyan); font-size: 0.85rem; text-align: center; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.admin-shell { width: min(100%, 1120px); min-height: 100vh; margin: 0 auto; padding: clamp(22px, 5vw, 58px) 20px; }
.admin-header { display: flex; gap: 24px; align-items: flex-start; justify-content: space-between; margin-bottom: 30px; }
.admin-header h1 { font-size: clamp(1.8rem, 5vw, 3.15rem); }
.admin-header h1 small { display: inline-block; margin-left: 10px; color: var(--muted); font-size: 0.39em; letter-spacing: 0; }
.admin-header p { margin: 13px 0 0; color: var(--muted); }
.admin-header-actions { display: flex; gap: 9px; align-items: center; }
.logout-button { width: auto; min-width: 82px; margin-top: 0; }
.admin-link { display: inline-flex; min-height: 43px; align-items: center; padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; color: var(--cyan); font-size: 0.82rem; font-weight: 720; text-decoration: none; }
.admin-link:hover { border-color: rgba(34, 211, 238, 0.55); }
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.metric { display: grid; grid-template-columns: auto 1fr; column-gap: 11px; align-items: center; padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: rgba(19, 24, 43, 0.73); }
.metric span { grid-row: span 2; font-size: 1.35rem; }
.metric strong { font-size: 1.58rem; line-height: 1; }
.metric small { margin-top: 5px; color: var(--muted); font-size: 0.77rem; }
.metric-pending { border-color: rgba(139, 92, 246, 0.38); }
.metric-approved { border-color: rgba(94, 234, 212, 0.38); }
.metric-playing { border-color: rgba(34, 211, 238, 0.48); }
.metric-played { border-color: rgba(148, 163, 184, 0.38); }
.metric-rejected { border-color: rgba(251, 113, 133, 0.38); }
.overlay-diagnostic { display: flex; gap: 18px; align-items: center; justify-content: space-between; margin-bottom: 20px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 15px; background: rgba(19, 24, 43, 0.52); }
.diagnostic-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 0.68rem; font-weight: 750; letter-spacing: 0.11em; }
.overlay-status { display: block; font-size: 0.95rem; }
.overlay-status.is-connected { color: var(--success); }
.overlay-status.is-waiting { color: #fda4af; }
.overlay-diagnostic p { margin: 5px 0 0; color: var(--muted); font-size: 0.78rem; }
.overlay-diagnostic > p { margin: 0; text-align: right; }
.admin-controls { margin-bottom: 20px; padding: clamp(19px, 4vw, 26px); border: 1px solid rgba(34, 211, 238, 0.22); border-radius: 20px; background: rgba(10, 20, 37, 0.66); }
.admin-controls-heading { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.admin-controls-heading h2 { font-size: 1.08rem; }
.admin-controls-heading p { margin: 7px 0 0; color: var(--muted); font-size: 0.82rem; }
.admin-controls-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.range-label { display: flex; align-items: center; justify-content: space-between; margin: 23px 0 9px; }
.range-label strong { color: var(--cyan); font-variant-numeric: tabular-nums; }
.volume-range { height: 8px; padding: 0; border: 0; border-radius: 999px; accent-color: var(--cyan); background: var(--surface-active); box-shadow: none; }
.volume-range:focus { box-shadow: none; }
.limit-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 23px 0 0; }
.limit-list div { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 8, 20, 0.28); }
.limit-list dt { color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.limit-list dd { margin: 5px 0 0; color: #dce7ff; font-size: 0.8rem; overflow-wrap: anywhere; }
.submission-mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 18px; }
.submission-mode-options label { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; background: rgba(5, 8, 20, .28); }
.submission-mode-options input { width: auto; margin-top: 3px; accent-color: var(--violet); }
.submission-mode-options strong, .submission-mode-options small { display: block; }
.submission-mode-options small { margin-top: 4px; color: var(--muted); font-weight: 500; }
.moderation-panel { padding: clamp(19px, 4vw, 30px); border: 1px solid var(--line); border-radius: 22px; background: rgba(19, 24, 43, 0.73); box-shadow: inset 0 1px rgba(255, 255, 255, 0.04); }
.queue-heading { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.queue-heading h2 { font-size: 1.16rem; }
.queue-heading p { margin: 7px 0 0; color: var(--muted); font-size: 0.82rem; }
.refresh-status { color: var(--success); font-size: 0.76rem; font-weight: 650; white-space: nowrap; }
.queue-tools { display: flex; gap: 14px; align-items: center; justify-content: space-between; margin: 18px 0 0; padding: 12px; border: 1px solid rgba(251, 113, 133, 0.19); border-radius: 13px; background: rgba(251, 113, 133, 0.04); }
.queue-tools p { margin: 0; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 23px; border-bottom: 1px solid var(--line); }
.filter-tab { padding: 10px 12px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 0.84rem; font-weight: 720; }
.filter-tab.is-active { border-bottom-color: var(--cyan); color: var(--text); }
.admin-status { margin-left: 0; text-align: left; }
.message-list { display: grid; gap: 12px; }
.message-card { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(5, 8, 20, 0.38); }
.message-card-header { display: flex; gap: 15px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.message-card h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.message-card p { margin: 5px 0 0; color: var(--muted); font-size: 0.78rem; }
.message-source { display: block; margin-top: 7px; color: var(--muted); font-size: .72rem; }
.message-badge { flex: 0 0 auto; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.7rem; font-weight: 750; }
.message-badge.is-pending { border-color: rgba(139, 92, 246, 0.5); color: #c4b5fd; }
.message-badge.is-approved { border-color: rgba(94, 234, 212, 0.5); color: var(--success); }
.message-badge.is-rejected { border-color: rgba(251, 113, 133, 0.5); color: #fda4af; }
.message-card audio { display: block; margin-bottom: 13px; }
.message-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.message-button { width: auto; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--surface); font-size: 0.78rem; font-weight: 700; }
.message-button:hover { filter: brightness(1.13); }
.message-approve { border-color: rgba(94, 234, 212, 0.46); color: var(--success); }
.message-reject, .message-delete { border-color: rgba(251, 113, 133, 0.46); color: #fda4af; }
.message-test { border-color: rgba(34, 211, 238, 0.46); color: var(--cyan); }
.empty-queue { padding: 42px 10px; margin: 0; color: var(--muted); text-align: center; }
.blacklist-panel { max-width: 840px; }
.blacklist-form { display: grid; grid-template-columns: minmax(160px, 0.65fr) minmax(220px, 1.35fr) auto; gap: 12px; align-items: end; margin-top: 22px; }
.blacklist-form .button-submit { width: auto; min-width: 170px; margin: 0; }
.blacklist-items { display: grid; gap: 10px; }
.blacklist-item { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 8, 20, 0.38); }
.blacklist-item h3 { margin: 0; color: var(--muted); font-size: 0.74rem; font-weight: 720; }
.blacklist-item p { margin: 5px 0; color: var(--text); font-size: 0.9rem; overflow-wrap: anywhere; }
.blacklist-item small { color: #7e89a8; font-size: 0.72rem; }

@media (max-width: 420px) {
  .page-shell { padding: 12px; }
  .voice-card { padding: 27px 20px; border-radius: 21px; }
  .recorder { padding: 15px; }
  .action-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .admin-header { gap: 16px; }
  .admin-header h1 small { display: block; margin: 7px 0 0; font-size: 0.45em; }
  .metrics { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .metric { display: block; padding: 14px 10px; text-align: center; }
  .metric span, .metric strong, .metric small { display: block; }
  .metric strong { margin: 5px 0; }
  .queue-heading, .message-card-header { flex-direction: column; }
  .overlay-diagnostic { display: block; }
  .overlay-diagnostic > p { margin-top: 10px; text-align: left; }
  .admin-controls-heading, .queue-tools, .blacklist-item { flex-direction: column; align-items: stretch; }
  .admin-controls-actions { justify-content: flex-start; }
  .limit-list { grid-template-columns: repeat(2, 1fr); }
  .submission-mode-options { grid-template-columns: 1fr; }
  .blacklist-form { grid-template-columns: 1fr; }
  .blacklist-form .button-submit { width: 100%; }
  .refresh-status { margin-top: -8px; }
  .message-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .message-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
