body {
    min-height: 100vh;
}

.game-container {
    max-width: 1180px;
}

.game-area {
    background: var(--card-background, #fff);
    padding: 24px;
    border-radius: var(--border-radius, 8px);
    box-shadow: var(--shadow, 0 4px 6px rgba(0, 0, 0, 0.1));
}

.status {
    min-height: 1.6em;
    margin-bottom: 18px;
    color: var(--secondary-color, #2c3e50);
    font-size: 1.15rem;
    font-weight: 700;
    text-align: center;
}

.cb-panel {
    max-width: 720px;
    margin: 0 auto 20px;
    padding: 24px;
    background: #f8fafc;
    border: 2px solid var(--border-color, #e9ecef);
    border-radius: 14px;
    text-align: center;
}

.cb-panel h2,
.history-card h2,
.controls-card h2 {
    margin-bottom: 10px;
    color: var(--secondary-color, #2c3e50);
}

.local-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.local-choice {
    min-height: 170px;
    padding: 22px;
    background: white;
    color: var(--text-color, #333);
    border: 2px solid var(--border-color, #e9ecef);
    box-shadow: var(--shadow, 0 4px 6px rgba(0, 0, 0, 0.1));
}

.local-choice:hover {
    color: white;
    border-color: var(--primary-color, #2980b9);
}

.choice-icon,
.choice-title,
.choice-copy {
    display: block;
}

.choice-icon {
    font-size: 2.4rem;
    margin-bottom: 8px;
}

.choice-title {
    font-size: 1.15rem;
    font-weight: 800;
}

.choice-copy {
    margin-top: 8px;
    color: var(--text-muted, #666);
    font-size: 0.95rem;
    font-weight: 500;
}

.local-choice:hover .choice-copy {
    color: rgba(255, 255, 255, 0.86);
}

.privacy-note {
    margin-bottom: 16px;
    color: var(--text-muted, #666);
    font-weight: 600;
}

.code-slots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 18px 0;
    flex-wrap: wrap;
}

.code-slot {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: white;
    color: var(--text-muted, #666);
    border: 3px solid var(--border-color, #e9ecef);
    border-radius: 16px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.code-slot:hover,
.code-slot.active {
    border-color: var(--primary-color, #2980b9);
    background: #eef7ff;
}

.code-slot.empty {
    font-size: 1.5rem;
    font-weight: 800;
}

.palette {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    max-width: 560px;
    margin: 18px auto;
}

.palette-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 12px;
    background: white;
    color: var(--text-color, #333);
    border: 2px solid var(--border-color, #e9ecef);
    box-shadow: none;
}

.palette-btn:hover {
    color: var(--text-color, #333);
    background: #f1f7ff;
    border-color: var(--primary-color, #2980b9);
}

.palette-btn:disabled {
    opacity: 0.45;
}

.palette-name {
    font-weight: 800;
}

.peg {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: white;
    border: 3px solid rgba(0, 0, 0, 0.24);
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    box-shadow: inset 0 -4px 7px rgba(0, 0, 0, 0.22), 0 2px 4px rgba(0, 0, 0, 0.12);
}

.peg-small {
    width: 32px;
    height: 32px;
    border-width: 2px;
    font-size: 0.92rem;
}

.peg-empty {
    color: var(--text-muted, #666);
    background: #eef1f5;
    border-style: dashed;
    text-shadow: none;
    box-shadow: none;
}

.peg-red {
    background: #d62828;
}

.peg-blue {
    background: #1d4ed8;
}

.peg-green {
    background: #15803d;
}

.peg-yellow {
    background: #facc15;
    color: #1f2937;
    text-shadow: none;
}

.peg-purple {
    background: #7c3aed;
}

.peg-orange {
    background: #ea580c;
}

.setup-actions,
.guess-actions,
.game-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.hint {
    color: var(--text-muted, #666);
    font-size: 0.95rem;
    font-weight: 600;
}

.play-section {
    margin-top: 10px;
}

.round-summary {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #ecf7ff;
    border: 1px solid #cbe7ff;
    border-radius: 12px;
    color: var(--secondary-color, #2c3e50);
    font-weight: 800;
    text-align: center;
}

.secret-preview {
    max-width: 540px;
    margin: 0 auto 18px;
    padding: 12px 16px;
    background: #fff7ed;
    border: 2px solid #fed7aa;
    border-radius: 12px;
    text-align: center;
}

#secret-preview-title {
    display: block;
    margin-bottom: 8px;
    color: #9a3412;
    font-weight: 800;
}

.secret-preview-code {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.board-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: 20px;
    align-items: start;
}

.history-card,
.controls-card {
    background: #ffffff;
    border: 2px solid var(--border-color, #e9ecef);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.history-header,
.guess-row {
    display: grid;
    grid-template-columns: 64px minmax(170px, 1fr) minmax(150px, 0.9fr);
    gap: 12px;
    align-items: center;
}

.history-header {
    padding: 0 10px 8px;
    color: var(--text-muted, #666);
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.guess-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guess-row {
    min-height: 56px;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.guess-row.empty {
    opacity: 0.62;
}

.guess-number {
    font-weight: 900;
    color: var(--secondary-color, #2c3e50);
}

.history-pegs,
.feedback-pegs {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.feedback-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.feedback-dot {
    width: 17px;
    height: 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #1f2937;
    border-radius: 50%;
    font-size: 0.64rem;
    font-weight: 900;
    line-height: 1;
}

.feedback-dot.black {
    color: white;
    background: #111827;
}

.feedback-dot.white {
    color: #111827;
    background: #ffffff;
}

.feedback-dot.empty {
    color: transparent;
    background: #e5e7eb;
    border-color: #cbd5e1;
}

.feedback-text {
    color: var(--text-muted, #666);
    font-size: 0.82rem;
    font-weight: 700;
}

.game-over-panel {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.game-over-details {
    margin: 14px auto 0;
    color: var(--secondary-color, #2c3e50);
    font-weight: 700;
}

.online-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.opponent-name {
    color: var(--text-muted, #666);
    font-weight: 700;
}

@media (max-width: 820px) {
    .board-layout {
        grid-template-columns: 1fr;
    }

    .palette {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .game-area,
    .cb-panel,
    .history-card,
    .controls-card {
        padding: 16px;
    }

    .local-mode-grid {
        grid-template-columns: 1fr;
    }

    .history-header {
        display: none;
    }

    .guess-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .guess-number::after {
        content: " guess";
        font-weight: 700;
    }

    .code-slot {
        width: 56px;
        height: 56px;
    }

    .peg {
        width: 36px;
        height: 36px;
        font-size: 0.98rem;
    }

    .peg-small {
        width: 28px;
        height: 28px;
        font-size: 0.78rem;
    }
}

@media (max-width: 420px) {
    .palette {
        grid-template-columns: 1fr;
    }

    .code-slots {
        gap: 8px;
    }
}
