:root {
    --bg: #070f17;
    --panel: rgba(10, 24, 34, .94);
    --panel-soft: rgba(13, 30, 40, .78);
    --line: rgba(124, 226, 245, .23);
    --line-strong: rgba(124, 226, 245, .4);
    --text: #eafcff;
    --muted: rgba(234, 252, 255, .66);
    --cyan: #25e6ff;
    --green: #50ff9f;
    --yellow: #ffd166;
    --red: #ff5576;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 50% -12%, rgba(37, 230, 255, .16), transparent 34rem),
        linear-gradient(180deg, #0a1620, var(--bg) 52%, #05090f);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select {
    font: inherit;
}

a {
    color: inherit;
}

.lab-shell {
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto;
    padding: 28px 0 36px;
}

.hero {
    padding: clamp(26px, 6vw, 64px) 0 24px;
    text-align: center;
}

.series-label,
.section-kicker {
    margin: 0 0 10px;
    color: var(--cyan);
    font-size: 12px;
    letter-spacing: .18em;
    font-weight: 800;
}

.hero h1 {
    margin: 0;
    font-size: clamp(34px, 8vw, 72px);
    line-height: 1;
}

.lead {
    width: min(720px, 100%);
    margin: 18px auto 0;
    color: var(--muted);
    line-height: 1.9;
}

main {
    display: grid;
    gap: 22px;
}

.tester,
.info-card,
.comments-section,
.ad-panel,
.return-link,
.mothership-link,
.lab-footer {
    background: linear-gradient(180deg, var(--panel), rgba(7, 14, 21, .94));
    border: 1px solid var(--line);
    box-shadow: 0 0 30px rgba(37, 230, 255, .08);
}

.tester {
    border-radius: 8px;
    padding: clamp(14px, 3vw, 24px);
}

.tester-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.tester-head h2,
.info-card h2 {
    margin: 0;
    font-size: clamp(20px, 4vw, 28px);
}

.round-select {
    display: grid;
    gap: 6px;
    min-width: 150px;
    color: var(--muted);
    font-size: 12px;
}

.round-select select {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: rgba(3, 10, 14, .92);
    color: var(--text);
    padding: 10px 12px;
}

.edge-stage {
    position: relative;
    min-height: clamp(360px, 62vh, 620px);
    border: 1px solid rgba(124, 226, 245, .32);
    border-radius: 8px;
    background:
        linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px),
        radial-gradient(circle at center, rgba(37, 230, 255, .12), rgba(8, 19, 28, .96) 62%);
    background-size: 40px 40px, 40px 40px, auto;
    overflow: hidden;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    overscroll-behavior: contain;
    outline: none;
}

.edge-stage:focus-visible {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(37, 230, 255, .18);
}

.focus-mark {
    position: absolute;
    inset: 50% auto auto 50%;
    width: 70px;
    height: 70px;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(234, 252, 255, .28);
    border-radius: 50%;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.focus-mark::before,
.focus-mark::after {
    content: "";
    position: absolute;
    background: rgba(234, 252, 255, .35);
}

.focus-mark::before {
    width: 1px;
    height: 92px;
}

.focus-mark::after {
    width: 92px;
    height: 1px;
}

.focus-mark span {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 18px rgba(37, 230, 255, .75);
}

.target {
    position: absolute;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: none;
    place-items: center;
    color: #071018;
    background: var(--green);
    box-shadow: 0 0 22px rgba(80, 255, 159, .55);
    transform: translate(-50%, -50%);
    font-size: 17px;
    font-weight: 900;
    pointer-events: none;
}

.target.is-visible {
    display: grid;
}

.stage-message {
    position: absolute;
    inset: auto 18px 18px 18px;
    display: grid;
    gap: 6px;
    text-align: center;
    color: var(--muted);
    pointer-events: none;
}

.stage-message strong {
    color: var(--text);
    font-size: clamp(30px, 7vw, 64px);
    line-height: 1;
}

.edge-stage.is-waiting {
    border-color: rgba(255, 209, 102, .45);
}

.edge-stage.is-ready {
    border-color: rgba(80, 255, 159, .75);
}

.edge-stage.is-false-start {
    border-color: rgba(255, 85, 118, .75);
    background:
        radial-gradient(circle at center, rgba(255, 85, 118, .18), rgba(28, 7, 14, .96) 64%),
        #14060c;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.controls button,
.app-comment-form button {
    border: 1px solid rgba(37, 230, 255, .55);
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(37, 230, 255, .22), rgba(37, 230, 255, .08));
    color: var(--text);
    padding: 12px 18px;
    font-weight: 800;
    cursor: pointer;
}

.controls .ghost-button {
    border-color: rgba(234, 252, 255, .24);
    background: rgba(255, 255, 255, .04);
}

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

.stat-card,
.direction-cell {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel-soft);
    padding: 12px;
}

.stat-card span,
.direction-cell span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .1em;
}

.stat-card strong,
.direction-cell strong {
    display: block;
    margin-top: 8px;
    font-size: clamp(18px, 3vw, 28px);
    overflow-wrap: anywhere;
}

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

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

.round-log {
    margin: 14px 0 0;
    padding: 0;
    display: grid;
    gap: 6px;
    list-style: none;
}

.round-log li {
    border-left: 3px solid rgba(37, 230, 255, .45);
    background: rgba(255, 255, 255, .035);
    padding: 8px 10px;
    color: var(--muted);
}

.round-log li.miss {
    border-left-color: var(--yellow);
}

.round-log li.flying {
    border-left-color: var(--red);
}

.ad-panel {
    min-height: 250px;
    border-radius: 8px;
    padding: 12px;
}

.ad-panel p {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .12em;
    text-align: center;
}

.ad-panel .adsbygoogle {
    min-height: 250px;
}

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

.info-card {
    border-radius: 8px;
    padding: 18px;
}

.info-card p,
.info-card li {
    color: var(--muted);
    line-height: 1.85;
}

.info-card ol {
    padding-left: 1.25em;
}

.tool-links {
    display: grid;
    gap: 8px;
}

.tool-links a {
    display: block;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, .035);
    padding: 10px 12px;
    text-decoration: none;
}

.comments-section {
    border-radius: 8px;
    padding: 18px;
}

.app-comments,
.app-comment-form-section {
    background: rgba(8, 18, 26, .92);
    border-color: var(--line);
    color: var(--text);
}

.app-comment-form input,
.app-comment-form textarea,
.app-comment-form select {
    background: rgba(3, 10, 14, .9);
    color: var(--text);
    border: 1px solid var(--line-strong);
}

.app-comment-form input::placeholder,
.app-comment-form textarea::placeholder {
    color: rgba(234, 252, 255, .48);
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.return-link,
.mothership-link,
.lab-footer {
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.return-link span,
.mothership-link span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.return-link a,
.mothership-link a {
    display: inline-block;
    margin-top: 5px;
    color: var(--cyan);
    font-weight: 800;
    text-decoration: none;
}

.return-link p,
.mothership-link p,
.lab-footer {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 860px) {
    .tester-head,
    .footer-links {
        display: grid;
        grid-template-columns: 1fr;
        align-items: start;
    }

    .stats-grid,
    .direction-grid,
    .info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .lab-shell {
        width: min(100% - 18px, 1120px);
        padding-top: 18px;
    }

    .edge-stage {
        min-height: 430px;
    }

    .target {
        width: 30px;
        height: 30px;
    }

    .controls button {
        width: 100%;
    }

    .stats-grid,
    .direction-grid,
    .info-grid {
        grid-template-columns: 1fr;
    }

    .stat-card,
    .direction-cell {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 10px;
    }

    .stat-card strong,
    .direction-cell strong {
        margin-top: 0;
    }
}
