:root {
  color-scheme: dark;
  --bg: #0b0b0b;
  --panel: #151515;
  --panel-2: #1d1d1d;
  --line: #303030;
  --muted: #969696;
  --text: #f4f1e7;
  --yellow: #f2c84b;
  --yellow-soft: #ffe59a;
  --red: #ef6b62;
  --green: #6fd59b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(circle at top right, #24200f 0, var(--bg) 42rem); color: var(--text); min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, select, input, textarea { border-radius: 10px; border: 1px solid var(--line); }
button { cursor: pointer; }
.shell { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 32px; }
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 10px 0 34px; }
.eyebrow { margin: 0 0 10px; color: var(--yellow); font-size: 12px; letter-spacing: .22em; font-weight: 800; }
h1 { margin: 0; font-size: clamp(28px, 6vw, 54px); letter-spacing: -.045em; line-height: 1; }
.lede { margin: 15px 0 0; color: var(--muted); font-size: 15px; }
.device-pill, .status { border: 1px solid #4f4420; background: #211c0e; color: var(--yellow-soft); border-radius: 999px; padding: 8px 12px; font-size: 12px; white-space: nowrap; }
.card { background: linear-gradient(145deg, rgba(29,29,29,.96), rgba(17,17,17,.96)); border: 1px solid var(--line); border-radius: 18px; padding: 24px; margin: 16px 0; box-shadow: 0 16px 50px rgba(0,0,0,.2); }
.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 18px; }
.section-heading > div:first-child { display: flex; gap: 12px; align-items: center; }
.section-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.step { color: var(--yellow); font-weight: 800; font-size: 13px; letter-spacing: .1em; }
.form-grid, .measurement-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.session-history { display: flex; align-items: flex-end; gap: 12px; margin-top: 16px; }
.session-history label { flex: 1; }
.session-history .small-button { flex: 0 0 auto; }
.session-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.run-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; align-items: center; margin-top: 16px; padding: 14px; border: 1px solid #4d421c; border-radius: 12px; background: #121109; }
.run-panel > div span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.run-panel > div strong { color: var(--yellow-soft); }
.run-panel .hint { grid-column: 1 / -1; margin: 0; }
label { display: grid; gap: 8px; color: #d5d0c3; font-size: 13px; }
input, select, textarea { width: 100%; background: #0f0f0f; color: var(--text); padding: 11px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(242,200,75,.12); }
textarea { resize: vertical; margin: 15px 0; }
.custom-target-wrap { margin-top: 16px; }
.primary, .danger, .small-button { padding: 11px 16px; font-weight: 700; transition: .18s ease; }
.primary { background: var(--yellow); color: #17120a; border-color: var(--yellow); }
.primary:hover { background: #ffe28a; }
.danger { background: transparent; color: var(--red); border-color: #66302e; }
.danger:hover:not(:disabled) { background: #2a1514; }
.danger:disabled, .primary:disabled, .small-button:disabled { opacity: .4; cursor: not-allowed; }
.small-button { background: #27230f; color: var(--yellow-soft); border-color: #5a4a1c; }
.small-button:hover { background: #3a3013; }
.file-button { display: inline-flex; align-items: center; padding: 11px 16px; font-weight: 700; border: 1px solid #5a4a1c; border-radius: 10px; color: var(--yellow-soft); background: #27230f; cursor: pointer; }
.file-button input { display: none; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.65; margin: 12px 0 0; }
.channel-table-wrap { overflow-x: auto; }
.channel-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.channel-table th { color: var(--muted); font-size: 12px; text-align: left; font-weight: 600; padding: 10px; border-bottom: 1px solid var(--line); }
.channel-table td { padding: 9px 10px; border-bottom: 1px solid #242424; }
.channel-table input, .channel-table select { padding: 8px; font-size: 13px; }
.filter-pair { display: grid; gap: 5px; min-width: 190px; }
.filter-pair label { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.filter-pair select { min-width: 0; }
.remove-channel { color: var(--red); background: transparent; border: 0; padding: 5px 8px; }
.volume-panel { margin-top: 18px; background: #101010; border: 1px solid #2d2d2d; border-radius: 14px; padding: 18px; }
.volume-topline, .meter-scale { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.volume-topline strong { color: var(--yellow); }
.meter { height: 18px; background: #282828; border-radius: 99px; overflow: hidden; margin: 14px 0 7px; }
#meterFill { height: 100%; width: 0%; background: linear-gradient(90deg, #568d7a 0 48%, var(--yellow) 70%, var(--red)); transition: width .1s linear; }
.meter-scale { color: var(--muted); font-size: 11px; }
.volume-message { color: #c9c3b7; line-height: 1.6; font-size: 13px; margin: 14px 0 0; }
.quality-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.quality-panel > div { background: #101010; border: 1px solid #2d2d2d; border-radius: 12px; padding: 12px 14px; }
.quality-panel span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.quality-panel strong { color: var(--yellow-soft); font-size: 14px; }
.record-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.download-link { color: var(--yellow-soft); font-size: 13px; text-decoration: none; border-bottom: 1px dotted var(--yellow); padding: 5px 0; }
.upload-feedback { margin-top: 14px; padding: 14px; border: 1px solid #4d421c; border-radius: 12px; background: #121109; }
.upload-feedback.good { border-color: #285b43; background: #0e1b14; }
.upload-feedback.bad { border-color: #66302e; background: #1c1110; }
.upload-feedback-topline, .upload-progress-meta { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.upload-feedback-topline { color: var(--muted); font-size: 12px; }
.upload-feedback-topline strong { color: var(--yellow-soft); font-size: 14px; }
.upload-feedback.good .upload-feedback-topline strong { color: var(--green); }
.upload-feedback.bad .upload-feedback-topline strong { color: var(--red); }
.upload-progress { height: 10px; margin: 11px 0 7px; overflow: hidden; border-radius: 99px; background: #292929; }
#uploadProgressFill { width: 0%; height: 100%; border-radius: inherit; background: var(--yellow); transition: width .15s ease; }
#uploadProgressFill.indeterminate { width: 38%; animation: upload-progress-slide 1.1s ease-in-out infinite alternate; }
.upload-progress-meta { color: var(--muted); font-size: 12px; }
@keyframes upload-progress-slide { from { margin-left: 0; } to { margin-left: 62%; } }
.recording-summary { color: var(--yellow-soft); font-size: 13px; margin: -4px 0 14px; }
.recording-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.measurement-list { overflow-x: auto; }
.measurement-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 12px; }
.measurement-table th, .measurement-table td { padding: 10px 8px; border-bottom: 1px solid #292929; text-align: left; vertical-align: top; }
.measurement-table th { color: var(--muted); font-weight: 600; }
.measurement-table td strong { color: var(--yellow-soft); display: block; margin-bottom: 4px; }
.measurement-table .recording-actions { white-space: nowrap; }
.measurement-table .recording-actions button { padding: 6px 9px; font-size: 12px; }
.recording-deleted { opacity: .62; }
.recording-deleted td:first-child strong { color: var(--muted); }
.action-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.empty-state { border: 1px dashed #444; border-radius: 14px; color: var(--muted); text-align: center; padding: 45px 16px; }
.hidden { display: none !important; }
.auth-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(7,7,7,.92); }
.auth-card { width: min(420px, 100%); background: linear-gradient(145deg, rgba(29,29,29,.98), rgba(17,17,17,.98)); border: 1px solid var(--line); border-radius: 18px; padding: 26px; box-shadow: 0 20px 80px rgba(0,0,0,.5); }
.auth-card h2 { margin: 0; font-size: 24px; }
.auth-card form { display: grid; gap: 14px; margin-top: 18px; }
.auth-error { min-height: 20px; margin: 12px 0 0; font-size: 13px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.summary { background: #101010; border: 1px solid #2c2c2c; border-radius: 12px; padding: 14px; }
.summary span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.summary strong { display: block; color: var(--yellow-soft); font-size: 20px; }
.chart-card { background: #101010; border: 1px solid #2c2c2c; border-radius: 14px; padding: 14px; overflow: hidden; }
.chart-title { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
#curveCanvas { width: 100%; height: auto; display: block; background: #0c0c0c; border-radius: 8px; }
.report-section { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.report-section h3 { margin: 0 0 12px; font-size: 16px; color: var(--yellow-soft); }
.ai-panel { margin-top: 16px; border: 1px solid #4d421c; border-radius: 14px; padding: 16px; background: linear-gradient(145deg, #1d1a0f, #11100c); }
.ai-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ai-heading h3 { margin: 0; color: var(--yellow-soft); font-size: 16px; }
.ai-heading .hint { display: block; margin-top: 6px; }
.ai-question { display: flex; gap: 10px; margin-top: 14px; }
.ai-question input { flex: 1; }
.ai-summary { margin-top: 14px; color: #e8e0c9; line-height: 1.7; font-size: 14px; }
.ai-finding { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--yellow); background: rgba(0,0,0,.18); }
.ai-finding strong { color: var(--yellow-soft); }
.ai-action { color: #c9c3b7; line-height: 1.6; margin-top: 8px; font-size: 13px; }
.comparison-panel { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.comparison-controls { display: flex; align-items: flex-end; gap: 10px; }
.comparison-controls label { flex: 1; }
.comparison-summary { margin-top: 12px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th, .report-table td { padding: 10px; border-bottom: 1px solid #292929; text-align: left; vertical-align: top; }
.report-table th { color: var(--muted); font-weight: 600; }
.tag { display: inline-block; border: 1px solid #4d421c; color: var(--yellow-soft); border-radius: 999px; padding: 3px 7px; margin: 2px; font-size: 11px; }
.good { color: var(--green) !important; }
.bad { color: var(--red) !important; }
.notes { color: var(--muted); font-size: 13px; line-height: 1.65; margin-top: 16px; }
.notes div { margin: 4px 0; }
footer { display: flex; justify-content: space-between; gap: 12px; color: #737373; font-size: 11px; padding: 18px 2px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #2b2612; color: var(--yellow-soft); border: 1px solid #68571f; padding: 12px 16px; border-radius: 999px; transition: .2s ease; z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 700px) {
  .shell { width: min(100% - 20px, 1160px); padding-top: 22px; }
  .hero { display: block; }
  .device-pill { display: inline-block; margin-top: 18px; }
  .card { padding: 16px; border-radius: 14px; }
  .section-heading { align-items: flex-start; }
  .section-heading h2 { font-size: 17px; }
  .form-grid, .measurement-controls, .summary-grid { grid-template-columns: 1fr; }
  .recording-filters { grid-template-columns: 1fr; }
  .quality-panel { grid-template-columns: 1fr; }
  .session-history { display: block; }
  .session-history .small-button { width: 100%; margin-top: 12px; }
  .session-actions > button { width: 100%; }
  .summary-grid { gap: 8px; }
  .run-panel { grid-template-columns: 1fr; }
  .run-panel .small-button { width: 100%; }
  .summary { display: flex; justify-content: space-between; align-items: center; }
  .summary span { margin: 0; }
  .summary strong { font-size: 16px; }
  .comparison-controls { display: block; }
  .comparison-controls button { width: 100%; margin-top: 12px; }
  .ai-question { display: block; }
  .ai-question button { width: 100%; margin-top: 10px; }
  footer { display: block; line-height: 1.8; }
}
