:root {
    --ink: #293235;
    --muted: #687579;
    --line: #dfe9e7;
    --mint: #68b89c;
    --mint-dark: #2f8a72;
    --paper: #fffefb;
    --soft: #f6fbf9;
    --lavender: #8d7fd0;
    --pale-lavender: #f3f0ff;
    --shadow: 0 18px 48px rgba(42, 76, 72, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.75;
    background:
        radial-gradient(circle at 14% 18%, rgba(104, 184, 156, 0.14), transparent 28%),
        radial-gradient(circle at 88% 22%, rgba(141, 127, 208, 0.16), transparent 30%),
        #fff;
}

a {
    color: inherit;
}

.site-header,
.site-footer {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.site-header {
    min-height: 70px;
}

.site-logo {
    color: var(--mint-dark);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0;
    text-decoration: none;
}

.site-nav,
.site-footer {
    flex-wrap: wrap;
}

.site-nav {
    display: flex;
    gap: 14px;
    color: var(--muted);
    font-size: 0.86rem;
}

.site-nav a,
.site-footer a {
    text-decoration: none;
}

.site-nav a:hover,
.site-footer a:hover {
    color: var(--mint-dark);
}

.ghost-page {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto 64px;
}

.ghost-hero {
    min-height: 430px;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    align-items: center;
    gap: clamp(26px, 5vw, 70px);
    padding: 34px 0 44px;
}

.series-label {
    margin: 0 0 12px;
    color: var(--mint-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.hero-copy h1 {
    margin: 0;
    font-size: clamp(2.1rem, 5vw, 4rem);
    line-height: 1.15;
    letter-spacing: 0;
}

.hero-copy p:last-child {
    max-width: 620px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: clamp(1rem, 1.8vw, 1.12rem);
}

.mini-lab {
    position: relative;
    min-height: 300px;
}

.mini-lab img {
    position: absolute;
    display: block;
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 18px 24px rgba(47, 84, 73, 0.12));
    user-select: none;
}

.lab-radar {
    width: min(34%, 150px);
    left: 8%;
    top: 28%;
    animation: pulse 2.4s ease-in-out infinite;
}

.lab-wave {
    width: min(48%, 220px);
    right: 10%;
    bottom: 12%;
}

.lab-ghost {
    width: min(30%, 128px);
    right: 18%;
    top: 8%;
    animation: floaty 4s ease-in-out infinite;
}

.game-shell {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow);
    padding: clamp(18px, 3vw, 32px);
}

.status-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.status-panel div {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    padding: 12px;
}

.status-panel span {
    display: block;
    color: var(--mint-dark);
    font-size: 0.72rem;
    font-weight: 800;
}

.status-panel strong {
    display: block;
    margin-top: 2px;
    font-size: clamp(1.1rem, 2.7vw, 1.6rem);
    line-height: 1.2;
}

.signal-screen {
    position: relative;
    width: 100%;
    min-height: 360px;
    overflow: hidden;
    appearance: none;
    border: 1px solid #cfe0dd;
    border-radius: 8px;
    background:
        radial-gradient(circle at center, rgba(104, 184, 156, 0.08), transparent 52%),
        linear-gradient(90deg, rgba(47, 138, 114, 0.07) 1px, transparent 1px),
        linear-gradient(rgba(47, 138, 114, 0.07) 1px, transparent 1px),
        #fff;
    background-size: auto, 34px 34px, 34px 34px, auto;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
}

.signal-screen:disabled {
    cursor: not-allowed;
}

.scan-line {
    position: absolute;
    inset: 12%;
    border-radius: 999px;
    border: 1px solid rgba(47, 138, 114, 0.18);
}

.scan-line::before,
.scan-line::after {
    position: absolute;
    inset: 18%;
    border-radius: inherit;
    border: 1px solid rgba(47, 138, 114, 0.16);
    content: "";
}

.scan-line::after {
    inset: 36%;
}

.signal-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 160px;
    background: linear-gradient(to bottom, rgba(47, 138, 114, 0.72), transparent);
    transform-origin: 50% 0;
    animation: scanRotate 3.6s linear infinite;
}

.signal-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--mint);
    box-shadow: 0 0 18px rgba(104, 184, 156, 0.7);
    transform: translate(-50%, -50%);
    opacity: 0.55;
}

.ghost-mark {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 118px;
    min-height: 116px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.88);
    transition: opacity 0.12s ease, transform 0.12s ease;
    pointer-events: none;
}

.ghost-mark img {
    width: 78px;
    height: auto;
    filter: drop-shadow(0 10px 16px rgba(93, 74, 150, 0.18));
}

.ghost-mark span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border: 1px solid rgba(141, 127, 208, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #6d5bb2;
    padding: 2px 12px;
    font-size: 0.9rem;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(93, 74, 150, 0.1);
}

.signal-screen.is-haunted .ghost-mark {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.screen-message {
    position: absolute;
    left: 50%;
    bottom: 24px;
    width: min(90%, 520px);
    transform: translateX(-50%);
    color: var(--muted);
    font-weight: 700;
}

.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 18px;
}

.primary-button,
.ghost-button {
    appearance: none;
    min-height: 48px;
    border-radius: 8px;
    padding: 0 22px;
    border: 0;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.primary-button {
    background: var(--mint-dark);
    color: #fff;
    box-shadow: 0 10px 22px rgba(47, 138, 114, 0.22);
}

.primary-button:hover {
    transform: translateY(-1px);
}

.ghost-button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
}

.result-panel {
    margin-top: 20px;
    border-top: 1px dashed #c9dfd7;
    padding-top: 18px;
}

.result-panel h2 {
    margin: 0 0 4px;
    font-size: clamp(1.25rem, 3vw, 1.7rem);
}

.result-panel p {
    margin: 0;
    color: var(--muted);
}

.log-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.log-list li {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 10px;
    color: var(--muted);
    font-size: 0.86rem;
}

.log-list .is-found {
    color: var(--mint-dark);
    background: #f3fbf7;
}

.log-list .is-noise {
    color: #7a65b7;
    background: var(--pale-lavender);
}

.info-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 28px;
}

.info-section article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    padding: 20px;
}

.info-section h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.info-section p {
    margin: 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.info-section a {
    color: var(--mint-dark);
    font-weight: 700;
}

.site-footer {
    border-top: 1px solid var(--line);
    padding: 26px 0 38px;
    color: var(--muted);
    font-size: 0.86rem;
}

@keyframes scanRotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.04);
    }
}

@keyframes floaty {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@media (max-width: 820px) {
    .ghost-hero {
        grid-template-columns: 1fr;
        min-height: 0;
        text-align: center;
    }

    .hero-copy p:last-child {
        margin-left: auto;
        margin-right: auto;
    }

    .mini-lab {
        min-height: 220px;
    }

    .status-panel {
        grid-template-columns: repeat(2, 1fr);
    }

    .info-section {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 540px) {
    .site-header,
    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .signal-screen {
        min-height: 300px;
    }

    .ghost-mark {
        width: 96px;
        min-height: 102px;
    }

    .ghost-mark img {
        width: 66px;
    }

    .ghost-mark span {
        min-height: 26px;
        padding: 2px 10px;
        font-size: 0.82rem;
    }

    .info-section {
        grid-template-columns: 1fr;
    }
}
