:root {
    --ink: #263331;
    --muted: #667773;
    --line: #d9ebe4;
    --mint: #68b89c;
    --mint-dark: #2f8a72;
    --paper: #fffefb;
    --soft: #f6fbf8;
    --yellow: #ffe08a;
    --coral: #ff9f8f;
    --blue: #7eb6df;
    --green: #72bf91;
    --shadow: 0 18px 48px rgba(34, 83, 71, 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% 16%, rgba(255, 224, 138, 0.18), transparent 30%),
        radial-gradient(circle at 86% 22%, rgba(126, 182, 223, 0.15), transparent 28%),
        #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);
}

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

.focus-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-panel {
    width: min(52%, 240px);
    left: 23%;
    top: 28%;
    animation: panelBlink 2.8s ease-in-out infinite;
}

.lab-ghost {
    width: min(28%, 130px);
    right: 6%;
    top: 10%;
    animation: floaty 4s ease-in-out infinite;
}

.lab-notes {
    width: min(36%, 168px);
    left: 0;
    bottom: 8%;
    rotate: -5deg;
}

.game-shell {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.84);
    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;
}

.chaos-board {
    position: relative;
    overflow: hidden;
    min-height: 310px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(104, 184, 156, 0.06) 1px, transparent 1px),
        linear-gradient(rgba(104, 184, 156, 0.06) 1px, transparent 1px),
        var(--paper);
    background-size: 34px 34px;
    padding: clamp(18px, 4vw, 34px);
    text-align: center;
}

.chaos-board::after {
    position: absolute;
    right: -52px;
    bottom: -52px;
    width: 150px;
    height: 150px;
    border-radius: 999px;
    background: rgba(255, 224, 138, 0.26);
    content: "";
}

.instruction-label {
    margin: 0;
    color: var(--mint-dark);
    font-size: 0.78rem;
    font-weight: 800;
}

.instruction-text {
    min-height: 2.2em;
    margin: 8px auto 20px;
    color: var(--muted);
    font-weight: 700;
}

.word-card {
    width: min(100%, 520px);
    min-height: 146px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid #dce8e3;
    border-radius: 8px;
    background: #fff;
    box-shadow: inset 0 0 0 8px rgba(246, 251, 248, 0.9);
}

.word-card span {
    font-size: clamp(3rem, 10vw, 6.3rem);
    font-weight: 900;
    line-height: 1;
}

.word-card.is-noisy {
    animation: wobble 0.42s ease-in-out;
}

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

.choice-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 18px 0;
}

.choice-button,
.primary-button,
.ghost-button {
    appearance: none;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.choice-button {
    min-height: 58px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.choice-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(40, 80, 70, 0.1);
    border-color: #b9ded1;
}

.choice-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.choice-red {
    border-top: 5px solid var(--coral);
}

.choice-blue {
    border-top: 5px solid var(--blue);
}

.choice-green {
    border-top: 5px solid var(--green);
}

.choice-yellow {
    border-top: 5px solid var(--yellow);
}

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

.primary-button,
.ghost-button {
    min-height: 48px;
    padding: 0 22px;
}

.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-ok {
    color: var(--mint-dark);
    background: #f3fbf7;
}

.log-list .is-miss {
    color: #a35d50;
    background: #fff5f2;
}

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

@keyframes panelBlink {
    0%, 100% {
        filter: drop-shadow(0 18px 24px rgba(47, 84, 73, 0.12));
    }
    50% {
        filter: drop-shadow(0 18px 30px rgba(255, 224, 138, 0.28));
    }
}

@keyframes wobble {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-3px);
    }
    75% {
        transform: translateX(3px);
    }
}

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

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

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

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

    .chaos-board {
        min-height: 280px;
    }

    .word-card {
        min-height: 118px;
    }
}
