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

body {
    font-family: 'Arial', sans-serif;
    background: url('bg.png') no-repeat center center;
    background-size: cover;
    background-attachment: fixed;
    color: #eee;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px 60px;
}

/* ── Container ── */
.container, footer {
    width: 100%;
    max-width: 560px;
	position: relative;
	background: rgba(22, 33, 62, 0.8);
	border-radius: 15px;
	box-shadow: 0 0 30px rgb(33, 123, 219);
	padding: 30px;
	margin-bottom: 40px;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

footer { margin-top: 30px;}

/* ── Header ── */
.header-row {
    margin-bottom: 10px;
}
h1 { font-size: 2rem; font-weight: 900; color: #fff; }
.subtitle { color: #aaa; margin-bottom: 14px; font-size: 0.95rem; }

/* ── Score-Boxen ── */
.scores-row { display: flex; gap: 8px; justify-content: center;}
.score-box {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 6px 14px;
    text-align: center;
    min-width: 80px;
}
.score-box span   { display: block; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; color: #aaa; }
.score-box strong { display: block; font-size: 1.3rem; color: #ffd700; }

/* ── Info-Zeile ── */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.player-chip {
    display: inline-block;
    width: 18px; height: 18px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 2px;
}
.player-chip.red    { background: #e74c3c; box-shadow: 0 0 6px #e74c3c; }
.player-chip.yellow { background: #f1c40f; box-shadow: 0 0 6px #f1c40f; }

#newGameBtn, .logout-link {
    padding: 7px 14px; border-radius: 7px; border: none;
    cursor: pointer; font-weight: 700; font-size: 0.88rem;
    text-decoration: none; transition: opacity 0.2s;
}
#newGameBtn    { background: #0f3460; color: #eee; margin-right: 6px; }
.logout-link   { background: #e74c3c; color: #fff; }
#newGameBtn:hover, .logout-link:hover { opacity: 0.82; }

/* ── Schwierigkeit ── */
.difficulty-row {
    font-size: 0.88rem; color: #aaa; margin-bottom: 10px;
}
select {
    background: #16213e; color: #eee;
    border: 1px solid #0f3460; border-radius: 6px;
    padding: 3px 8px; margin-left: 6px; font-size: 0.88rem;
}

/* ── Status ── */
.status-msg {
    text-align: center;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.06);
    min-height: 2.2em;
    transition: color 0.3s;
}
.status-red    { color: #e74c3c; }
.status-yellow { color: #f1c40f; }
.status-none   { color: #aaa; }

/* ── Spielfeld ── */
#board-wrapper {
    position: relative;
    width: 100%;
}

#board {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 8px;
    background: #1565c0;
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    width: 100%;
    /* Höhe = 6/7 der Breite damit Zellen quadratisch sind */
    aspect-ratio: 7 / 6;
}

/* ── Zellen ── */
.cell {
    background: #1a1a2e;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    position: relative;
    overflow: hidden;
    /* Zelle füllt den Grid-Slot komplett aus */
    width: 100%;
    height: 100%;
}
.cell:hover { background: #222244; }

/* ── Chips (die eigentlichen runden Spielsteine) ── */
.chip {
    width: 88%;
    height: 88%;
    border-radius: 50%;
    background: transparent;
    transition: background 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}
.chip.red {
    background: #e74c3c;
    box-shadow: inset 0 -4px 8px rgba(0,0,0,0.3), 0 0 10px rgba(231,76,60,0.4);
    animation: dropIn 0.25s cubic-bezier(.4,1.6,.6,1) both;
}
.chip.yellow {
    background: #f1c40f;
    box-shadow: inset 0 -4px 8px rgba(0,0,0,0.3), 0 0 10px rgba(241,196,15,0.4);
    animation: dropIn 0.25s cubic-bezier(.4,1.6,.6,1) both;
}
.chip.preview {
    background: rgba(231, 76, 60, 0.35);
}

/* Gewinn-Markierung */
.chip.winner {
    animation: pulse 0.6s ease infinite alternate;
}
@keyframes pulse {
    from { box-shadow: inset 0 -4px 8px rgba(0,0,0,0.3), 0 0 10px currentColor; transform: scale(1); }
    to   { box-shadow: inset 0 -4px 8px rgba(0,0,0,0.3), 0 0 28px currentColor; transform: scale(1.1); }
}

/* Fall-Animation */
@keyframes dropIn {
    0%   { transform: translateY(-120px); opacity: 0; }
    60%  { transform: translateY(6px); }
    100% { transform: translateY(0); opacity: 1; }
}

/* ── Ergebnis-Overlay ── */
#result-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.72);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: fadeIn 0.3s ease;
}
#result-overlay.hidden { display: none; }
@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}
.result-box {
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
#result-text {
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 18px;
    line-height: 1.4;
}
#result-text small { font-size: 1rem; color: #aaa; display: block; margin-top: 4px; }
#playAgainBtn {
    background: #0f3460; color: #fff;
    border: none; border-radius: 8px;
    padding: 10px 28px; font-size: 1rem;
    font-weight: 700; cursor: pointer;
    transition: opacity 0.2s;
}
#playAgainBtn:hover { opacity: 0.82; }

/* ── Login ── */
.login-form {
    display: flex; flex-direction: column;
    gap: 10px; margin: 16px 0; align-items: center;
}
.login-form input {
    font-size: 1rem; padding: 10px 16px;
    border-radius: 8px; border: 2px solid #0f3460;
    width: 280px; background: #16213e; color: #eee;
    outline: none; transition: border-color 0.2s;
}
.login-form input:focus { border-color: #ffd700; }
.login-form button {
    background: #0f3460; color: #fff; border: none;
    border-radius: 8px; padding: 10px 30px;
    font-size: 1rem; font-weight: 700; cursor: pointer;
    transition: opacity 0.2s;
}
.login-form button:hover { opacity: 0.82; }
.hint  { color: #aaa; font-size: 0.85rem; text-align: center; }
.error { color: #e74c3c; font-weight: bold; margin: 8px 0; text-align: center; }

/* ── Regelbox ── */
.rules-box {
    padding: 16px 20px;
    margin-top: 18px;
    text-align: left;
    max-width: 400px;
    margin-left: auto; margin-right: auto;
}
.rules-box h3 { color: #ffd700; margin-bottom: 10px; }
.rules-box ul { padding-left: 18px; }
.rules-box li { margin: 6px 0; color: #ccc; font-size: 0.9rem; line-height: 1.4; }

/* ── Highscore ── */
.highscore-box {
    width: 100%; max-width: 560px;
    margin-top: 28px; background: rgba(22, 33, 62, 0.8);
    border-radius: 10px; padding: 20px;
    border: 1px solid #0f3460;
}
.highscore-box h2 { margin-bottom: 12px; color: #ffd700; }
.highscore-box table { width: 100%; border-collapse: collapse; }
.highscore-box th, .highscore-box td {
    padding: 8px 10px; text-align: center;
    border-bottom: 1px solid #0f3460; color: #eee;
}
.highscore-box th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px; color: #aaa; }
tr.rank-1 { background: rgba(255,215,0,0.15); }
tr.rank-2 { background: rgba(192,192,192,0.1); }
tr.rank-3 { background: rgba(205,127,50,0.1); }
tr.own-score td { color: #ffd700; font-weight: bold; }

/* ── Responsive ── */
@media (max-width: 420px) {
    #board { gap: 5px; padding: 7px; }
    h1 { font-size: 1.6rem; }
}