:root {
    color-scheme: dark;
    --bg: #071015;
    --panel: rgba(12, 24, 31, .88);
    --panel-strong: rgba(15, 35, 45, .96);
    --ink: #e8fbff;
    --muted: #99b5c0;
    --line: rgba(112, 220, 240, .22);
    --accent: #25d7ff;
    --accent-2: #7cf7c7;
    --warn: #ffd166;
    --danger: #ff4d67;
    --shadow: 0 22px 52px rgba(0, 0, 0, .34);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    background:
        linear-gradient(90deg, rgba(37, 215, 255, .06) 1px, transparent 1px),
        linear-gradient(180deg, rgba(37, 215, 255, .05) 1px, transparent 1px),
        radial-gradient(circle at 20% 0%, rgba(37, 215, 255, .18), transparent 34%),
        radial-gradient(circle at 90% 12%, rgba(124, 247, 199, .14), transparent 28%),
        var(--bg);
    background-size: 38px 38px, 38px 38px, auto, auto, auto;
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.65;
    -webkit-text-size-adjust: 100%;
}

button,
a,
select,
input,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
}

.noscript {
    background: #fff3cd;
    color: #663c00;
    padding: 12px;
    text-align: center;
}

.site-shell {
    margin: 0 auto;
    max-width: 1180px;
    padding: clamp(18px, 4vw, 48px);
}

.hero {
    max-width: 840px;
    padding: 30px 0 22px;
}

.series-label,
.panel-kicker,
.section-kicker,
.ad-label {
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .16em;
    margin: 0 0 8px;
}

h1 {
    font-size: clamp(42px, 9vw, 88px);
    letter-spacing: 0;
    line-height: .95;
    margin: 0;
}

h2 {
    font-size: 18px;
    letter-spacing: 0;
    margin: 0 0 8px;
}

p {
    margin-top: 0;
}

.subtitle {
    color: var(--accent-2);
    font-size: clamp(18px, 3vw, 24px);
    font-weight: 800;
    margin: 12px 0 0;
}

.lead {
    font-size: clamp(18px, 3vw, 25px);
    font-weight: 800;
    line-height: 1.5;
    margin: 26px 0 0;
}

.note {
    color: var(--muted);
    margin: 14px 0 0;
}

.lab-console {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    margin: 24px 0;
}

.control-panel,
.meter-panel,
.stat-card,
.mode-notes article,
.main-lab-tools,
.about-diagnosis,
.app-comment-section,
.ad-row {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 18px;
}

.control-panel {
    display: grid;
    gap: 16px;
}

.control-panel p,
.stat-card p,
.mode-notes p,
.about-diagnosis p,
.main-lab-tools p {
    color: var(--muted);
    margin-bottom: 0;
}

.control-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.primary-button,
.quiet-button {
    appearance: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    min-height: 46px;
    padding: 10px 16px;
}

.primary-button {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border: 0;
    color: #041014;
}

.quiet-button {
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .18);
    color: var(--ink);
}

.quiet-button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.status-message {
    border-left: 3px solid var(--accent);
    color: #c8eef6;
    margin: 0;
    padding-left: 12px;
}

.meter-panel {
    background: var(--panel-strong);
}

.meter-head {
    align-items: baseline;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.meter-head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .14em;
}

.meter-head strong {
    color: var(--accent);
    font-size: clamp(36px, 8vw, 64px);
    line-height: 1;
}

.level-meter {
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    height: 34px;
    margin: 16px 0;
    overflow: hidden;
    position: relative;
}

.level-fill {
    background: linear-gradient(90deg, #1bd7ff 0%, #7cf7c7 52%, #ffd166 78%, #ff4d67 100%);
    height: 100%;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .08s linear;
}

.zone {
    color: rgba(0, 0, 0, .72);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.zone-low {
    left: 8%;
}

.zone-good {
    left: 48%;
}

.zone-hot {
    right: 8%;
}

#waveCanvas {
    background: rgba(0, 0, 0, .28);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 8px;
    display: block;
    height: 180px;
    width: 100%;
}

.stat-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 24px 0;
}

.stat-card span {
    color: var(--accent);
    display: block;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .12em;
    margin-bottom: 6px;
}

.stat-card strong {
    color: var(--ink);
    display: block;
    font-size: clamp(28px, 5vw, 46px);
    line-height: 1;
    margin: 12px 0;
}

.mode-notes {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 24px 0;
}

.ad-row,
.main-lab-tools,
.about-diagnosis,
.app-comment-section {
    margin: 28px 0;
}

.ad-row {
    min-height: 110px;
}

.tool-links {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.tool-links a {
    background: rgba(37, 215, 255, .1);
    border: 1px solid rgba(37, 215, 255, .25);
    border-radius: 8px;
    color: var(--ink);
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 12px;
    text-decoration: none;
}

.tool-links strong,
.tool-links span {
    display: block;
}

.tool-links strong {
    color: var(--accent);
    font-size: 15px;
}

.tool-links span {
    color: var(--muted);
    font-size: 13px;
}

.app-comment-section :where(.app-comments, .app-comment-form-section) {
    background: rgba(12, 24, 31, .92);
    border: 1px solid rgba(112, 220, 240, .22);
    box-shadow: none;
    color: var(--ink);
}

.app-comment-section :where(.app-comments h2, .app-comment-form-section h2) {
    color: var(--ink);
}

.app-comment-section :where(.app-comment-summary, .app-comment-meta, .app-comment-page-status) {
    color: rgba(232, 251, 255, .68);
}

.app-comment-section :where(.app-comment-card) {
    border-top-color: rgba(112, 220, 240, .18);
}

.app-comment-section :where(.app-comment-body, .app-comments-empty, .app-comment-message) {
    color: rgba(232, 251, 255, .82);
}

.app-comment-section :where(.app-comment-rating) {
    color: var(--warn);
}

.app-comment-section :where(.app-comment-admin-reply, .app-comment-reply) {
    background: rgba(3, 10, 14, .74);
    color: rgba(232, 251, 255, .82);
}

.app-comment-section :where(.app-comment-admin-reply) {
    border-left-color: var(--accent);
}

.app-comment-section :where(.app-comment-admin-reply-title, .app-comment-reply-form-wrap summary) {
    color: var(--accent);
}

.app-comment-section :where(.app-comment-admin-reply-date) {
    color: rgba(232, 251, 255, .56);
}

.app-comment-section :where(.app-comment-replies, .app-comment-pagination) {
    border-color: rgba(112, 220, 240, .18);
}

.app-comment-section :where(.app-comment-form label) {
    color: rgba(232, 251, 255, .84);
}

.app-comment-section :where(.app-comment-form input, .app-comment-form select, .app-comment-form textarea) {
    background: rgba(3, 10, 14, .88);
    border: 1px solid rgba(112, 220, 240, .28);
    border-radius: 8px;
    color: var(--ink);
    min-height: 42px;
    padding: 10px 12px;
}

.app-comment-section :where(.app-comment-form textarea) {
    min-height: 8rem;
    resize: vertical;
}

.app-comment-section :where(.app-comment-form input::placeholder, .app-comment-form textarea::placeholder) {
    color: rgba(232, 251, 255, .48);
}

.app-comment-section :where(.app-comment-form input:focus, .app-comment-form select:focus, .app-comment-form textarea:focus) {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 215, 255, .14);
    outline: 0;
}

.app-comment-section :where(.app-comment-form button) {
    appearance: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border: 0;
    border-radius: 8px;
    color: #041014;
    cursor: pointer;
    font-weight: 900;
    min-height: 44px;
    padding: 10px 16px;
}

.app-comment-section :where(.app-comment-pagination a, .app-comment-pagination span) {
    background: rgba(3, 10, 14, .72);
    border-color: rgba(112, 220, 240, .28);
    color: var(--accent);
}

.app-comment-section :where(.app-comment-pagination span) {
    background: var(--accent);
    color: #041014;
}

@media (max-width: 940px) {
    .lab-console,
    .mode-notes {
        grid-template-columns: 1fr;
    }

    .stat-grid,
    .tool-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .site-shell {
        padding: 18px 14px 28px;
    }

    .hero {
        padding-top: 18px;
    }

    .stat-grid,
    .tool-links {
        grid-template-columns: 1fr;
    }

    .control-actions {
        display: grid;
    }

    .primary-button,
    .quiet-button {
        width: 100%;
    }

    #waveCanvas {
        height: 150px;
    }
}
