* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    line-height: 1.6;
    min-height: 100vh;
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.breadcrumb {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.75rem;
}

.breadcrumb a {
    color: #4ecca3;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

h1 {
    text-align: center;
    color: #4ecca3;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

/* ── Game container ─────────────────────────────────── */

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    position: relative;
}

.game-status {
    display: flex;
    gap: 2rem;
    font-size: 1rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

#guesses-left {
    color: #4ecca3;
    font-weight: 600;
}

#best-score {
    color: #888;
    font-size: 0.9rem;
}

/* ── Board ──────────────────────────────────────────── */

.board {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: #1a1a2e;
    border-radius: 10px;
    border: 1px solid #2a2a4e;
    width: 100%;
    max-width: 420px;
}

.guess-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: #12122a;
    border: 2px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}

.guess-row.active {
    border-color: #4ecca3;
    background: #1e1e38;
}

.guess-row.completed {
    opacity: 0.85;
    background: #161628;
}

.row-number {
    color: #555;
    font-size: 0.75rem;
    width: 18px;
    text-align: right;
    flex-shrink: 0;
}

/* Peg slots */

.pegs {
    display: flex;
    gap: 6px;
    flex: 1;
}

.peg-slot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #2a2a4e;
    background: #0f0f1a;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.peg-slot.filled {
    border-color: rgba(255,255,255,0.25);
    cursor: pointer;
}

.peg-slot.filled:hover {
    transform: scale(1.08);
    border-color: #e94560;
}

.guess-row.completed .peg-slot {
    cursor: default;
}

.guess-row.completed .peg-slot.filled:hover {
    transform: none;
    border-color: rgba(255,255,255,0.25);
}

/* Feedback pegs */

.feedback {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 3px;
    width: 36px;
    flex-shrink: 0;
}

.fb-peg {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1px solid #3a3a5e;
    background: #0f0f1a;
}

.fb-peg.black {
    background: #111;
    border-color: #444;
    box-shadow: inset 0 0 0 2px #888;
}

.fb-peg.white {
    background: #e8e8e8;
    border-color: #bbb;
}

/* ── Palette ──────────────────────────────────────── */

.palette-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 420px;
}

.palette {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
    background: #1a1a2e;
    border-radius: 8px;
    border: 1px solid #2a2a4e;
    width: 100%;
}

.color-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.15);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

.color-btn:hover {
    transform: scale(1.12);
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 0 8px rgba(255,255,255,0.2);
}

.color-btn.selected {
    border-color: #fff;
    box-shadow: 0 0 12px rgba(255,255,255,0.35);
    transform: scale(1.1);
}

.palette-actions {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    justify-content: center;
}

.action-btn {
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
    border-radius: 6px;
    border: 2px solid;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.action-btn.primary {
    background: #4ecca3;
    color: #0f0f1a;
    border-color: #4ecca3;
}

.action-btn.primary:hover:not(:disabled) {
    background: #3db892;
    border-color: #3db892;
}

.action-btn.primary:disabled {
    background: #2a2a4e;
    color: #555;
    border-color: #2a2a4e;
    cursor: not-allowed;
}

.action-btn.secondary {
    background: transparent;
    color: #e0e0e0;
    border-color: #4a4a6e;
}

.action-btn.secondary:hover {
    background: #2a2a4e;
    border-color: #6a6a8e;
}

/* ── Overlay ─────────────────────────────────────── */

.overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 15, 26, 0.97);
    padding: 2rem;
    border-radius: 10px;
    border: 2px solid #4ecca3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 10;
    min-width: 260px;
    text-align: center;
}

.overlay.hidden {
    display: none;
}

#result-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: #4ecca3;
}

.solution-display {
    display: flex;
    gap: 8px;
    align-items: center;
}

.solution-display.hidden {
    display: none;
}

.solution-peg {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.25);
}

.overlay button {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    background: #4ecca3;
    color: #0f0f1a;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: background 0.2s;
}

.overlay button:hover {
    background: #3db892;
}

/* ── Content / SEO article ──────────────────────── */

.content {
    padding-top: 1.5rem;
    border-top: 1px solid #2a2a4e;
}

.last-updated {
    font-size: 0.8rem;
    color: #555;
    margin-bottom: 1rem;
}

.content h2 {
    color: #4ecca3;
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

.content h2:first-of-type {
    margin-top: 1rem;
}

.content p {
    margin-bottom: 0.75rem;
    color: #c0c0c0;
}

.content ul {
    margin: 0.5rem 0 1rem 1.5rem;
    color: #c0c0c0;
}

.content li {
    margin-bottom: 0.5rem;
}

.faq {
    margin: 0.5rem 0 1.5rem;
}

.faq dt {
    font-weight: 700;
    color: #e0e0e0;
    margin-top: 1rem;
}

.faq dd {
    color: #aaa;
    margin-left: 0;
    margin-top: 0.25rem;
}

.related-games {
    margin-top: 1.5rem;
}

.related-games h3 {
    color: #4ecca3;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.game-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.game-links a {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    background: #1a1a2e;
    color: #4ecca3;
    border: 1px solid #2a2a4e;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s, border-color 0.2s;
}

.game-links a:hover {
    background: #2a2a4e;
    border-color: #4ecca3;
}

/* ── Responsive ──────────────────────────────────── */

@media (min-width: 600px) {
    main {
        padding: 2rem;
    }

    h1 {
        font-size: 2rem;
    }

    .peg-slot {
        width: 42px;
        height: 42px;
    }

    .color-btn {
        width: 48px;
        height: 48px;
    }

    .board {
        max-width: 460px;
    }

    .palette-section {
        max-width: 460px;
    }
}

@media (max-width: 380px) {
    .peg-slot {
        width: 30px;
        height: 30px;
    }

    .color-btn {
        width: 38px;
        height: 38px;
    }

    .feedback {
        width: 30px;
        gap: 2px;
    }

    .fb-peg {
        width: 11px;
        height: 11px;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    main { padding-top: 0.5rem; }
    h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
}
