body {
    min-height: 100vh;
}

.game-container {
    max-width: 1200px;
}

.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;
}

.mf-panel {
    max-width: 900px;
    margin: 0 auto 20px;
    padding: 24px;
    background: #f8fafc;
    border: 2px solid var(--border-color, #e9ecef);
    border-radius: 14px;
    text-align: center;
}

.mf-panel h2 {
    margin-bottom: 10px;
    color: var(--secondary-color, #2c3e50);
}

.privacy-note {
    margin-bottom: 16px;
    color: var(--text-muted, #666);
    font-weight: 600;
}

.hint {
    color: var(--text-muted, #666);
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.setup-actions,
.game-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.ai-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.ai-info.hidden {
    display: none;
}

.ai-info-label {
    font-weight: 600;
    color: var(--text-muted, #666);
}

.difficulty-btn {
    padding: 6px 14px;
    border: 2px solid var(--primary-color);
    border-radius: 999px;
    background: white;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.difficulty-btn.active,
.difficulty-btn:hover {
    background: var(--primary-color);
    color: white;
}

.round-summary {
    max-width: 900px;
    margin: 0 auto 16px;
    padding: 12px 16px;
    background: #ecf7ff;
    border: 1px solid #cbe7ff;
    border-radius: 12px;
    color: var(--secondary-color, #2c3e50);
    font-weight: 800;
    text-align: center;
}

/* ---------- Face card grid ---------- */

.face-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 0 auto 10px;
}

.face-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px 8px;
    background: white;
    border: 3px solid var(--border-color, #e9ecef);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: var(--touch-target-min, 44px);
}

.face-card:hover {
    border-color: var(--primary-color, #2980b9);
    transform: translateY(-1px);
}

.face-card.selected {
    border-color: var(--success-color, #27ae60);
    background: #eafaf0;
    box-shadow: 0 0 0 2px var(--success-color, #27ae60) inset;
}

.face-card.eliminated {
    opacity: 0.4;
    border-style: dashed;
}

.face-card.eliminated .face-name::after {
    content: ' (out)';
    font-weight: 700;
    color: var(--danger-color, #e74c3c);
}

.face-card:disabled,
.face-card.static {
    cursor: default;
    opacity: 1;
}

.face-card.static:hover {
    transform: none;
    border-color: var(--border-color, #e9ecef);
}

.face-name {
    font-weight: 800;
    color: var(--secondary-color, #2c3e50);
    font-size: 0.85rem;
}

.face-attrs {
    font-size: 0.68rem;
    line-height: 1.25;
    color: var(--text-muted, #666);
    text-align: center;
}

/* ---------- Portrait (pure CSS, no emoji/images) ---------- */

.portrait {
    position: relative;
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
}

.portrait-face {
    position: absolute;
    inset: 0;
    border-radius: 46% 46% 50% 50% / 50% 50% 46% 46%;
    border: 2px solid rgba(0, 0, 0, 0.25);
}

.palette-sunny .portrait-face { background: linear-gradient(160deg, #ffd166, #fb8500); }
.palette-ocean .portrait-face { background: linear-gradient(160deg, #6fd6e8, #023e8a); }
.palette-berry .portrait-face { background: linear-gradient(160deg, #f792c6, #8f2d56); }
.palette-forest .portrait-face { background: linear-gradient(160deg, #95d5b2, #1b4332); }

.portrait-eyes {
    position: absolute;
    top: 30px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
}

.portrait-eyes span {
    width: 8px;
    height: 8px;
    background: #1f2937;
    border-radius: 50%;
    display: block;
}

.expr-surprised .portrait-eyes span {
    width: 10px;
    height: 10px;
}

.expr-sleepy .portrait-eyes span {
    height: 2px;
    border-radius: 2px;
    margin-top: 4px;
}

.portrait-mouth {
    position: absolute;
    left: 50%;
    top: 42px;
    transform: translateX(-50%);
    border: 2px solid #1f2937;
}

.expr-happy .portrait-mouth {
    width: 22px;
    height: 11px;
    border-top: none;
    border-radius: 0 0 22px 22px;
}

.expr-neutral .portrait-mouth {
    width: 18px;
    height: 0;
    border-width: 0 0 2px 0;
}

.expr-surprised .portrait-mouth {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #1f2937;
}

.expr-sleepy .portrait-mouth {
    width: 12px;
    height: 0;
    border-width: 0 0 2px 0;
    border-radius: 2px;
}

.portrait-hair {
    position: absolute;
    left: 8px;
    right: 8px;
    top: -4px;
    height: 20px;
    background: #4b3621;
    border-radius: 50% 50% 10% 10% / 100% 100% 0 0;
}

.hair-bald {
    display: none;
}

.hair-short {
    height: 14px;
}

.hair-curly {
    height: 22px;
    border-radius: 40%;
    box-shadow:
        -10px 4px 0 -4px #4b3621,
        10px 4px 0 -4px #4b3621,
        0 -4px 0 -2px #4b3621;
}

.hair-long {
    height: 20px;
}

.hair-long::before,
.hair-long::after {
    content: '';
    position: absolute;
    top: 10px;
    width: 9px;
    height: 30px;
    background: #4b3621;
    border-radius: 0 0 8px 8px;
}

.hair-long::before { left: -4px; }
.hair-long::after { right: -4px; }

.portrait-glasses {
    position: absolute;
    top: 27px;
    left: 10px;
    right: 10px;
    height: 14px;
}

.glasses-none {
    display: none;
}

.glasses-round::before,
.glasses-round::after {
    content: '';
    position: absolute;
    top: 0;
    width: 16px;
    height: 14px;
    border: 2px solid #1f2937;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
}

.glasses-round::before { left: 0; }
.glasses-round::after { right: 0; }

.glasses-square::before,
.glasses-square::after {
    content: '';
    position: absolute;
    top: 1px;
    width: 16px;
    height: 12px;
    border: 2px solid #1f2937;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.35);
}

.glasses-square::before { left: 0; }
.glasses-square::after { right: 0; }

.portrait-hat {
    position: absolute;
    left: 6px;
    right: 6px;
    top: -14px;
    height: 16px;
}

.hat-none {
    display: none;
}

.hat-cap {
    background: #d62828;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.hat-cap::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-10%);
    width: 26px;
    height: 6px;
    background: #d62828;
    border-radius: 4px;
}

.hat-bow {
    top: -10px;
    height: 12px;
    background: transparent;
}

.hat-bow::before,
.hat-bow::after {
    content: '';
    position: absolute;
    top: 0;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

.hat-bow::before {
    left: 50%;
    border-right: 12px solid #7c3aed;
    transform: translateX(-100%);
}

.hat-bow::after {
    right: 50%;
    border-left: 12px solid #7c3aed;
    transform: translateX(100%);
}

.hat-crown {
    background: #f4b400;
    clip-path: polygon(0% 100%, 0% 40%, 20% 70%, 35% 20%, 50% 60%, 65% 20%, 80% 70%, 100% 40%, 100% 100%);
}

/* ---------- Layout ---------- */

.mf-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: 20px;
    align-items: start;
}

.board-section,
.action-section {
    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);
}

.my-secret-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: #fff7ed;
    border: 2px solid #fed7aa;
    border-radius: 12px;
}

.my-secret-label {
    font-weight: 700;
    color: #9a3412;
    flex: 0 0 auto;
}

.my-secret-portrait .portrait {
    width: 48px;
    height: 48px;
}

.my-secret-name {
    font-weight: 800;
    color: var(--secondary-color, #2c3e50);
}

.question-groups {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}

.question-group h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted, #666);
    margin-bottom: 8px;
}

.question-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.question-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    background: white;
    color: var(--text-color, #333);
    border: 2px solid var(--border-color, #e9ecef);
    border-radius: 999px;
    box-shadow: none;
}

.question-btn:hover:not(:disabled) {
    border-color: var(--primary-color, #2980b9);
    background: #eef7ff;
    color: var(--text-color, #333);
}

.question-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.question-btn.answered-yes {
    border-color: var(--success-color, #27ae60);
    background: #eafaf0;
}

.question-btn.answered-no {
    border-color: var(--danger-color, #e74c3c);
    background: #fdecea;
}

.question-btn .answer-tag {
    font-weight: 800;
    margin-left: 4px;
}

.guess-btn {
    width: 100%;
    background: var(--warning-color, #f39c12);
    margin-bottom: 12px;
}

.guess-btn:hover {
    background: #e08e0b;
}

.guess-panel {
    padding: 14px;
    margin-bottom: 16px;
    background: #fff5f5;
    border: 2px solid #fecaca;
    border-radius: 12px;
}

.guess-confirm {
    margin-top: 12px;
    padding: 12px;
    background: white;
    border-radius: 10px;
    border: 2px solid var(--border-color, #e9ecef);
}

.guess-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.history-title {
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.history-log {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-log li {
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--secondary-color, #2c3e50);
}

.history-log li.mine {
    background: #ecf7ff;
    border-color: #cbe7ff;
}

.history-log li.guess-entry {
    font-weight: 800;
}

.history-log .empty-note {
    color: var(--text-muted, #666);
    font-style: italic;
    font-weight: 500;
}

.game-over-panel {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.game-over-details {
    margin: 14px auto 0;
    color: var(--secondary-color, #2c3e50);
    font-weight: 700;
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.game-over-details .reveal-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.game-over-details .portrait {
    width: 56px;
    height: 56px;
}

.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: 900px) {
    .mf-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .game-area,
    .mf-panel,
    .board-section,
    .action-section {
        padding: 14px;
    }

    .face-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .portrait {
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 420px) {
    .face-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .face-card {
        transition: none;
    }

    .face-card:hover {
        transform: none;
    }
}
