/* Reset */
* { 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; }

/* Settings */
.settings-container {
    max-width: 540px; margin: auto; padding: 40px;
    background: rgba(0,0,0,0.3); border-radius: 20px; text-align: center;
}
.settings-container h1 { font-size: 3.5rem; margin-bottom: 10px; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); }
.settings-container h2 { font-size: 2rem; margin-bottom: 35px; font-weight: normal; opacity: 0.9; }
.setting-group { margin-bottom: 28px; }
.setting-group label { display: block; font-size: 1.4rem; margin-bottom: 12px; }
.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;
}
.player-input:focus { outline: 4px solid #f39c12; outline-offset: 2px; }
.button-group { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.setting-btn {
    padding: 14px 22px; font-size: 1.15rem;
    border: 3px solid #fff; background: transparent; color: #fff;
    border-radius: 12px; cursor: pointer; transition: all 0.2s;
    min-width: 130px; min-height: 60px;
    display: inline-flex; align-items: center; justify-content: center;
}
.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: 20px; padding: 20px 50px; font-size: 1.8rem;
    background: #e74c3c; color: #fff; border: none; border-radius: 15px;
    cursor: pointer; font-weight: bold; transition: all 0.2s;
    min-height: 70px; display: block; width: 100%;
}
.primary-btn:hover { background: #c0392b; transform: scale(1.03); box-shadow: 0 5px 20px rgba(231,76,60,0.5); }
.primary-btn:focus { outline: 4px solid #f39c12; outline-offset: 3px; }
.secondary-btn { margin-top: 15px; background: rgba(255,255,255,0.2); border: 3px solid #fff; }
.secondary-btn:hover { background: rgba(255,255,255,0.35); transform: scale(1.03); box-shadow: 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 25px; 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; flex-direction: column; align-items: center; gap: 6px; }
.header-right { display: flex; gap: 12px; flex-wrap: wrap; }
.player-indicator {
    display: flex; align-items: center; gap: 12px;
    background: rgba(255,255,255,0.15); padding: 12px 22px;
    border-radius: 12px; font-size: 1.4rem; font-weight: bold;
    border: 3px solid rgba(255,255,255,0.3);
}
.player-color-dot {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    border: 3px solid rgba(255,255,255,0.5); transition: background 0.3s;
}
.player-color-dot.red    { background: #e74c3c; }
.player-color-dot.yellow { background: #f1c40f; }
.turn-label { font-weight: normal; opacity: 0.85; }
.action-btn {
    padding: 14px 22px; font-size: 1.1rem;
    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: 52px;
    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: 15px; gap: 12px; overflow: auto;
}

/* Player Info Panels */
.player-info {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 20px; background: rgba(0,0,0,0.2);
    border-radius: 12px; width: 100%; max-width: 560px;
    border: 3px solid transparent; transition: all 0.3s; min-height: 56px;
}
.player1-info.active { border-color: #e74c3c; background: rgba(231,76,60,0.2); box-shadow: 0 0 15px rgba(231,76,60,0.4); }
.player2-info.active { border-color: #f1c40f; background: rgba(241,196,15,0.2); box-shadow: 0 0 15px rgba(241,196,15,0.4); }
.player-disc {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    box-shadow: inset 0 -3px 6px rgba(0,0,0,0.3);
}
.disc-red    { background: radial-gradient(circle at 35% 35%, #ff6b6b, #c0392b); border: 2px solid #922b21; }
.disc-yellow { background: radial-gradient(circle at 35% 35%, #f9e04b, #d4ac0d); border: 2px solid #b7950b; }
.player-name-display { font-size: 1.2rem; font-weight: bold; }

/* Board Container */
.board-container { display: flex; flex-direction: column; align-items: center; }

/* Column Buttons */
.col-buttons {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 6px;
    width: 100%;
}
.col-btn {
    font-size: 1.6rem;
    padding: 10px 0;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 52px;
    line-height: 1;
}
.col-btn:hover  { background: rgba(255,255,255,0.35); transform: scale(1.08); }
.col-btn:focus  { outline: 4px solid #f39c12; outline-offset: 2px; }
.col-btn.full   { opacity: 0.3; cursor: default; pointer-events: none; }
.col-btn.preview-red    { background: rgba(231,76,60,0.5); border-color: #e74c3c; }
.col-btn.preview-yellow { background: rgba(241,196,15,0.5); border-color: #f1c40f; }

/* Board */
.board {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    background: #1a3670;
    padding: 12px;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5), inset 0 2px 10px rgba(0,0,0,0.3);
}

/* Cells */
.cell {
    width: clamp(52px, 9vw, 72px);
    height: clamp(52px, 9vw, 72px);
    border-radius: 50%;
    background: rgba(0,0,0,0.35);
    box-shadow: inset 0 4px 12px rgba(0,0,0,0.5);
    transition: all 0.15s;
    position: relative;
    display: flex; align-items: center; justify-content: center;
}
.cell.red {
    background: radial-gradient(circle at 35% 35%, #ff6b6b, #c0392b);
    box-shadow: inset 0 -3px 8px rgba(0,0,0,0.3), 0 2px 8px rgba(231,76,60,0.4);
}
.cell.yellow {
    background: radial-gradient(circle at 35% 35%, #f9e04b, #d4ac0d);
    box-shadow: inset 0 -3px 8px rgba(0,0,0,0.3), 0 2px 8px rgba(241,196,15,0.4);
}
/* Column highlight */
.cell.col-hover {
    cursor: pointer;
}
.cell.col-hover:not(.red):not(.yellow):not(.preview-red):not(.preview-yellow) {
    background: rgba(255,255,255,0.12);
    box-shadow: inset 0 4px 12px rgba(0,0,0,0.45);
}
.cell.red.col-hover {
    box-shadow: inset 0 -3px 8px rgba(0,0,0,0.3), 0 2px 8px rgba(231,76,60,0.4), 0 0 0 3px rgba(255,255,255,0.3);
}
.cell.yellow.col-hover {
    box-shadow: inset 0 -3px 8px rgba(0,0,0,0.3), 0 2px 8px rgba(241,196,15,0.4), 0 0 0 3px rgba(255,255,255,0.3);
}
/* Preview */
.cell.preview-red    { background: rgba(231,76,60,0.45); box-shadow: inset 0 -2px 6px rgba(0,0,0,0.2), 0 0 14px rgba(231,76,60,0.55), 0 0 0 3px rgba(255,255,255,0.25); }
.cell.preview-yellow { background: rgba(241,196,15,0.45); box-shadow: inset 0 -2px 6px rgba(0,0,0,0.2), 0 0 14px rgba(241,196,15,0.55), 0 0 0 3px rgba(255,255,255,0.25); }
/* Winning cells */
.cell.win {
    box-shadow: 0 0 0 4px #fff, 0 0 20px rgba(255,255,255,0.8);
    animation: win-pulse 0.6s infinite alternate;
}
@keyframes win-pulse {
    from { box-shadow: 0 0 0 4px #fff, 0 0 15px rgba(255,255,255,0.6); }
    to   { box-shadow: 0 0 0 4px #fff, 0 0 30px rgba(255,255,255,1); }
}
/* Drop animation */
@keyframes drop-in {
    from { transform: translateY(-300px); opacity: 0.5; }
    to   { transform: translateY(0);     opacity: 1; }
}
.cell.dropping { animation: drop-in 0.25s ease-out; }

/* 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.6rem; margin-bottom: 15px; opacity: 0.9; }

/* Responsive */
@media (max-width: 768px) {
    .game-header { justify-content: center; }
    .header-left { display: none; }
    .header-center, .header-right { width: 100%; justify-content: center; }
}
@media (max-width: 480px) {
    .board { gap: 4px; padding: 8px; }
    .col-buttons { gap: 4px; }
}
