/* Mühle - Game Styles */
/* Modern Glassmorphism Design */

/* ========== BASE LAYOUT ========== */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--body-bg-color, #0B1020);
    background-image: var(--body-bg-image,
            radial-gradient(at 0% 0%, hsla(253, 60%, 25%, 0.4) 0px, transparent 50%),
            radial-gradient(at 100% 100%, hsla(280, 70%, 30%, 0.5) 0px, transparent 50%));
    background-attachment: fixed;
    color: var(--text-color, #f0f0f0);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 0.5rem;
}

#page-title {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 700;
    text-align: center;
    margin: 0.5rem 0;
    background: linear-gradient(135deg, var(--primary, #a24cff), var(--akzent, #ffc800));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

/* ========== DIALOG BOXES ========== */
.dialog-box {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
}

.dialog-box h2 {
    margin: 0 0 1.5rem;
    font-size: 1.5rem;
    color: var(--text-color, #f0f0f0);
}

/* ========== DIFFICULTY SELECTOR ========== */
.difficulty-selector {
    margin-bottom: 1.5rem;
    text-align: center;
}

.difficulty-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.difficulty-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-color, #f0f0f0);
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-btn:hover {
    background: rgba(162, 76, 255, 0.15);
    border-color: var(--primary, #a24cff);
}

.difficulty-btn.active {
    background: rgba(162, 76, 255, 0.25);
    border-color: var(--primary, #a24cff);
    box-shadow: 0 0 15px rgba(162, 76, 255, 0.3);
}

/* ========== MODE BUTTONS ========== */
.mode-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 1.25rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    color: var(--text-color, #f0f0f0);
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn i {
    font-size: 1.8rem;
    color: var(--primary, #a24cff);
}

.mode-btn span {
    font-weight: 600;
    font-size: 1rem;
}

.mode-btn small {
    font-size: 0.75rem;
    opacity: 0.7;
}

.mode-btn:hover {
    background: rgba(162, 76, 255, 0.15);
    border-color: var(--primary, #a24cff);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: rgba(162, 76, 255, 0.2);
    border-color: var(--primary, #a24cff);
    box-shadow: 0 0 20px rgba(162, 76, 255, 0.3);
}

/* ========== BUTTONS ========== */
.btn-start,
.btn-online {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary, #a24cff), rgba(162, 76, 255, 0.7));
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.75rem;
}

.btn-start:hover,
.btn-online:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(162, 76, 255, 0.4);
}

.btn-start:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    background: none;
    border: none;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.btn-back:hover {
    color: var(--text-color, #f0f0f0);
}

.btn-lobby {
    width: 100%;
    padding: 0.6rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color, #f0f0f0);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-lobby:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary, #a24cff);
}

.btn-copy {
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color, #f0f0f0);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-copy:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary, #a24cff);
}

/* ========== JOIN SECTION ========== */
.or-divider {
    color: rgba(255, 255, 255, 0.4);
    margin: 1rem 0;
    font-size: 0.9rem;
}

.join-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.game-code-input {
    flex: 1 1 100%;
    min-width: 0;
    padding: 0.75rem 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-color, #f0f0f0);
    outline: none;
    transition: border-color 0.3s ease;
}

.game-code-input:focus {
    border-color: var(--primary, #a24cff);
}

.btn-join {
    flex: 1 1 100%;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary, #a24cff), rgba(162, 76, 255, 0.7));
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-join:hover {
    filter: brightness(1.15);
    box-shadow: 0 5px 20px rgba(162, 76, 255, 0.4);
}

/* ========== LOBBY ========== */
.game-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.game-code-display span {
    color: rgba(255, 255, 255, 0.6);
}

.code-box {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 4px;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--primary, #a24cff);
    border-radius: 10px;
    color: var(--akzent, #ffc800);
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.player-slot {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.player-slot.occupied {
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06);
}

.slot-piece {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.slot-piece.white {
    background: linear-gradient(145deg, #ffffff, #e0e0e0);
}

.slot-piece.black {
    background: linear-gradient(145deg, #444444, #222222);
}

.slot-name {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

.lobby-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* ========== GAME SECTION ========== */
#game-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
}

.status-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    margin-bottom: 0.5rem;
}

.turn-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.turn-indicator.white {
    background: linear-gradient(145deg, #ffffff, #e0e0e0);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.turn-indicator.black {
    background: linear-gradient(145deg, #444444, #222222);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#status-text {
    font-weight: 600;
    font-size: 1rem;
}

.phase-indicator {
    padding: 0.25rem 0.75rem;
    background: rgba(162, 76, 255, 0.2);
    border: 1px solid rgba(162, 76, 255, 0.3);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--primary, #a24cff);
}

/* ========== PIECES INFO ========== */
.pieces-info {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.pieces-count {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
}

.pieces-count .piece-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.3);
}

.pieces-count.white .piece-icon {
    background: linear-gradient(145deg, #ffffff, #e0e0e0);
}

.pieces-count.black .piece-icon {
    background: linear-gradient(145deg, #444444, #222222);
}

.separator {
    opacity: 0.3;
    margin: 0 0.25rem;
}

/* ========== GAME CONTAINER ========== */
.game-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.5rem;
}

/* ========== GAME BOARD ========== */
#game-board {
    position: relative;
    width: min(calc(100vw - 20px), calc(100vh - 250px), 500px);
    height: min(calc(100vw - 20px), calc(100vh - 250px), 500px);
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.board-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, 0.25);
    pointer-events: none;
}

#points-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ========== BOARD POINTS ========== */
.board-point {
    position: absolute;
    width: 12%;
    height: 12%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.point-base {
    width: 60%;
    height: 60%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.board-point:hover .point-base {
    background: rgba(162, 76, 255, 0.3);
    border-color: var(--primary, #a24cff);
    transform: scale(1.1);
}

.board-point.valid .point-base {
    background: linear-gradient(145deg, rgba(76, 175, 80, 0.5), rgba(56, 142, 60, 0.4));
    border-color: rgba(76, 175, 80, 0.7);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
    animation: pulse-valid 1s infinite;
}

.board-point.removable .point-base {
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.8);
}

@keyframes pulse-valid {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* ========== PIECES ========== */
.piece {
    position: absolute;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 20;
}

.piece.white {
    background: linear-gradient(145deg, #ffffff, #d0d0d0);
    border: 3px solid #bbb;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.5);
}

.piece.black {
    background: linear-gradient(145deg, #444444, #1a1a1a);
    border: 3px solid #333;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

.piece:hover {
    transform: scale(1.1);
}

.piece.selected {
    transform: scale(1.15);
    box-shadow: 0 0 20px rgba(162, 76, 255, 0.8);
}

.piece.in-mill {
    animation: mill-glow 0.5s ease;
}

@keyframes mill-glow {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(162, 76, 255, 0.5);
    }

    50% {
        box-shadow: 0 0 25px rgba(162, 76, 255, 1);
    }
}

.piece.removable {
    cursor: pointer;
    animation: shake 0.3s infinite;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

/* ========== REMOVE HINT ========== */
.remove-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.4);
    border-radius: 10px;
    color: #ff6b6b;
    font-weight: 500;
    animation: pulse-hint 1s infinite;
}

@keyframes pulse-hint {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ========== GAME CONTROLS ========== */
.game-controls {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.btn-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-control:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary, #a24cff);
    color: var(--text-color, #f0f0f0);
}

/* ========== WINNER MODAL ========== */
.winner-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.winner-content {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.trophy {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.winner-content h2 {
    margin: 0 0 0.5rem;
    font-size: 1.8rem;
    color: var(--akzent, #ffc800);
}

.winner-content p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
}

.winner-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-winner {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary, #a24cff), rgba(162, 76, 255, 0.7));
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-winner:hover {
    filter: brightness(1.15);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(162, 76, 255, 0.4);
}

.btn-winner.secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-color, #f0f0f0);
}

.btn-winner.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========== CUSTOM MODAL ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: rgba(30, 30, 50, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    margin: 0 0 1rem;
    color: var(--text-color, #f0f0f0);
}

.modal-content p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-buttons .btn {
    padding: 0.6rem 1.25rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 480px) {
    body {
        padding: 0.25rem;
    }

    #page-title {
        font-size: 1.3rem;
        margin: 0.25rem 0;
    }

    .dialog-box {
        padding: 1rem 1.25rem;
    }

    .mode-btn {
        padding: 1rem 0.5rem;
    }

    .mode-btn i {
        font-size: 1.5rem;
    }

    .pieces-info {
        gap: 0.75rem;
        font-size: 0.75rem;
    }

    .status-display {
        padding: 0.4rem 1rem;
        font-size: 0.9rem;
    }

    #game-section {
        height: calc(100vh - 50px);
        height: calc(100dvh - 50px);
    }

    #game-board {
        width: min(calc(100vw - 10px), calc(100vh - 220px));
        height: min(calc(100vw - 10px), calc(100vh - 220px));
    }
}

@media (min-width: 768px) {
    .dialog-box {
        padding: 2rem 2.5rem;
    }

    #game-board {
        width: min(calc(100vw - 40px), calc(100vh - 280px), 550px);
        height: min(calc(100vw - 40px), calc(100vh - 280px), 550px);
    }
}

@media (min-width: 1200px) {
    #game-board {
        width: min(calc(100vw - 60px), calc(100vh - 300px), 600px);
        height: min(calc(100vw - 60px), calc(100vh - 300px), 600px);
    }
}