:root {
    --ink: #253235;
    --muted: #65767a;
    --line: #dbeae6;
    --mint: #68b89c;
    --mint-dark: #2f8a72;
    --paper: #fffefb;
    --soft: #f6fbf9;
    --blue: #6faed7;
    --pale-blue: #eff8ff;
    --shadow: 0 18px 48px rgba(36, 77, 79, 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 18% 18%, rgba(104, 184, 156, 0.13), transparent 28%),
        radial-gradient(circle at 86% 20%, rgba(111, 174, 215, 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);
}

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

.typing-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-crt {
    width: min(44%, 210px);
    left: 8%;
    top: 14%;
}

.lab-keyboard {
    width: min(58%, 270px);
    right: 8%;
    bottom: 12%;
    animation: keyFloat 4s ease-in-out infinite;
}

.lab-mouse {
    width: min(34%, 160px);
    right: 8%;
    top: 12%;
}

.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;
}

.typing-board {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(111, 174, 215, 0.06) 1px, transparent 1px),
        linear-gradient(rgba(111, 174, 215, 0.06) 1px, transparent 1px),
        var(--paper);
    background-size: 34px 34px;
    padding: clamp(18px, 4vw, 34px);
    text-align: center;
}

.typing-board::after {
    position: absolute;
    right: -46px;
    bottom: -46px;
    width: 140px;
    height: 140px;
    border-radius: 999px;
    background: rgba(111, 174, 215, 0.14);
    content: "";
}

.code-label,
.typing-input-label {
    display: block;
    margin: 0 0 8px;
    color: var(--mint-dark);
    font-size: 0.78rem;
    font-weight: 800;
}

.target-code {
    min-height: 1.2em;
    margin: 0 auto 24px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: clamp(2.2rem, 8vw, 5.4rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0;
}

.target-code.is-hit {
    animation: hitPulse 0.28s ease;
}

.typing-input {
    position: relative;
    z-index: 1;
    width: min(100%, 560px);
    min-height: 58px;
    border: 1px solid #cfe0dd;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 0 18px;
    font: 800 1.35rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0;
    text-align: center;
}

.typing-input:focus {
    border-color: var(--mint);
    outline: 3px solid rgba(104, 184, 156, 0.18);
}

.typing-input:disabled {
    color: #8d9b9e;
    cursor: not-allowed;
}

.hint-text {
    margin: 16px auto 0;
    color: var(--muted);
}

.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;
    background: var(--pale-blue);
    padding: 4px 10px;
    color: #346f95;
    font-size: 0.86rem;
}

.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 keyFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

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

@media (max-width: 820px) {
    .typing-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;
    }

    .target-code {
        font-size: clamp(2rem, 12vw, 3.5rem);
    }

    .typing-input {
        font-size: 1.08rem;
    }

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