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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh; color: #fff;
}
.screen { min-height: 100vh; display: flex; flex-direction: column; }
.screen.hidden { display: none !important; }
.hidden { display: none !important; }

/* Settings */
.settings-container {
    max-width: 580px; margin: auto; padding: 40px;
    background: rgba(0,0,0,0.3); border-radius: 20px; text-align: center;
}
.settings-container h1 { font-size: 3rem; margin-bottom: 10px; }
.settings-container h2 { font-size: 2rem; margin-bottom: 30px; font-weight: normal; opacity: 0.9; }
.setting-group { margin-bottom: 24px; }
.setting-group label { display: block; font-size: 1.3rem; margin-bottom: 10px; }
.player-input {
    width: 100%; padding: 14px 18px; font-size: 1.3rem;
    border: 3px solid #fff; border-radius: 10px;
    background: rgba(255,255,255,0.9); color: #2c3e50; text-align: center; display: block;
}
.player-input:focus { outline: 4px solid #f39c12; outline-offset: 2px; }
.button-group { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.setting-btn {
    padding: 12px 18px; font-size: 1.05rem;
    border: 3px solid #fff; background: transparent; color: #fff;
    border-radius: 12px; cursor: pointer; transition: all 0.2s;
    min-width: 110px; min-height: 56px;
}
.setting-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }
.setting-btn:focus { outline: 4px solid #f39c12; outline-offset: 2px; }
.setting-btn.active { background: #fff; color: #2c3e50; font-weight: bold; }
.primary-btn {
    margin-top: 18px; padding: 18px 40px; font-size: 1.7rem;
    background: #e74c3c; color: #fff; border: none; border-radius: 15px;
    cursor: pointer; font-weight: bold; transition: all 0.2s;
    min-height: 70px; display: flex; width: 100%; align-items: center; justify-content: center;
    text-decoration: none;
}
.primary-btn:hover { background: #c0392b; transform: scale(1.03); }
.primary-btn:focus { outline: 4px solid #f39c12; outline-offset: 3px; }
.secondary-btn { margin-top: 12px; background: rgba(255,255,255,0.2); border: 3px solid #fff; }
.secondary-btn:hover { background: rgba(255,255,255,0.35); }
.back-btn { text-decoration: none; }

.rules-summary {
    background: rgba(255,255,255,0.1); border-radius: 12px;
    padding: 18px 22px; margin: 20px 0; text-align: left;
}
.rules-summary h3 { font-size: 1.3rem; margin-bottom: 10px; }
.rules-summary ul { list-style: none; }
.rules-summary li { font-size: 1.05rem; padding: 5px 0; opacity: 0.9; }
.rules-summary li::before { content: '• '; color: #f39c12; font-weight: bold; }

/* Header */
.game-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 20px; background: rgba(0,0,0,0.3);
    flex-wrap: wrap; gap: 10px; min-height: 80px;
}
.game-header h1 { font-size: 1.8rem; }
.header-center { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; gap: 10px; flex-wrap: wrap; }

.player-panel {
    display: flex; flex-direction: column; align-items: center;
    padding: 10px 18px; border-radius: 12px;
    background: rgba(255,255,255,0.1); border: 3px solid transparent;
    transition: all 0.3s; font-size: 1.1rem;
}
.player-panel.active {
    border-color: #f39c12; background: rgba(243,156,18,0.2);
    box-shadow: 0 0 15px rgba(243,156,18,0.4);
}
.player-score { font-size: 2rem; font-weight: bold; font-variant-numeric: tabular-nums; }
.solo-stats { display: flex; gap: 20px; font-size: 1.3rem; font-weight: bold; align-items: center; }

.action-btn {
    padding: 12px 18px; font-size: 1.05rem;
    background: rgba(255,255,255,0.9); color: #2c3e50;
    border: none; border-radius: 10px; cursor: pointer;
    font-weight: bold; transition: all 0.2s; min-height: 48px;
    text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.action-btn:hover { background: #fff; transform: scale(1.05); }
.action-btn:focus { outline: 4px solid #f39c12; outline-offset: 2px; }

/* Game Area */
.game-area {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 16px; gap: 14px; overflow: auto;
}

.turn-indicator {
    font-size: 1.4rem; font-weight: bold;
    padding: 10px 24px; border-radius: 10px;
    background: rgba(243,156,18,0.25); border: 2px solid #f39c12;
}

/* Card Grid */
.card-grid { display: grid; gap: 10px; }

/* Card flip */
.card { perspective: 600px; cursor: pointer; }
.card-inner {
    width: 100%; height: 100%;
    position: relative; transform-style: preserve-3d;
    transition: transform 0.4s ease; border-radius: 12px;
}
.card.flipped .card-inner,
.card.matched .card-inner { transform: rotateY(180deg); }

.card-front, .card-back {
    position: absolute; width: 100%; height: 100%;
    backface-visibility: hidden; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}
.card-back {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: 3px solid rgba(255,255,255,0.4);
    color: rgba(255,255,255,0.6); font-size: 2rem;
}
.card-front {
    background: rgba(255,255,255,0.95);
    border: 3px solid rgba(255,255,255,0.8);
    transform: rotateY(180deg);
}
.card.matched .card-front {
    background: rgba(46,204,113,0.3);
    border-color: #2ecc71;
    box-shadow: 0 0 15px rgba(46,204,113,0.5);
}
.card:not(.flipped):not(.matched):hover .card-back {
    background: linear-gradient(135deg, #5dade2, #3498db);
    border-color: rgba(255,255,255,0.7);
}
.card:focus { outline: 4px solid #f39c12; outline-offset: 3px; border-radius: 14px; }

/* End Screen */
.result-container {
    max-width: 500px; margin: auto; padding: 60px 40px;
    background: rgba(0,0,0,0.4); border-radius: 20px; text-align: center;
}
.result-container h1 { font-size: 3rem; margin-bottom: 20px; }
.result-container p { font-size: 1.5rem; margin-bottom: 15px; opacity: 0.9; }

@media (max-width: 768px) {
    .game-header { justify-content: center; }
    .header-left { display: none; }
    .header-center, .header-right { width: 100%; justify-content: center; }
}
