/* Stadt Land Fluss - Styles */

/* ========== BASE LAYOUT ========== */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

.game-section {
    display: none;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    opacity: 0;
}

.game-section.active {
    display: block;
    animation: sectionEnter 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes sectionEnter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

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

/* ========== GLASS CONTAINERS ========== */
.glass-container {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    margin: 1rem 0;
}

.glass-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.glass-container h3 {
    color: var(--text);
    margin-bottom: 1rem;
}

/* ========== LOBBY ========== */
.lobby-container {
    max-width: 440px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

.player-setup {
    margin-bottom: 1.5rem;
}

.player-setup label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 500;
}

.player-setup input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-size: 1.1rem;
    transition: border-color 0.3s ease;
}

.player-setup input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Avatar Grid */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.avatar-btn {
    width: 100%;
    aspect-ratio: 1;
    font-size: 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar-btn:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.avatar-btn.selected {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.3);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.5);
}

/* Join Input */
.join-input-group {
    display: flex;
    gap: 0.5rem;
}

.join-input-group input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
}

.join-input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Dividers */
.or-divider {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

/* ========== WAITING ROOM ========== */
.waiting-container {
    max-width: 750px;
    margin: 0 auto;
}

.waiting-area-wrapper {
    position: relative;
    max-width: 750px;
    margin: 0 auto;
}

.players-sidebar {
    margin-top: 1rem;
    padding: 1.5rem;
}

@media (min-width: 1200px) {
    .players-sidebar {
        position: absolute;
        left: 105%;
        top: 0;
        width: 300px;
        margin-top: 0;
        max-height: 80vh;
        overflow-y: auto;
    }
}

.invite-flex {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.invite-flex input {
    flex: 1;
    padding: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
}

/* Players List */
.players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.player-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    min-width: 100px;
}

.player-card.host {
    border-color: gold;
}

.player-card .avatar {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.player-card .name {
    font-weight: 500;
    color: var(--text);
    text-align: center;
    word-break: break-word;
}

.player-card .host-badge {
    font-size: 0.75rem;
    color: gold;
    margin-top: 0.25rem;
}

/* Host Settings */
.host-settings {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

/* Hide host-only elements for guests */
body:not(.is-host) #start-game-btn,
body:not(.is-host) #allow-guest-settings-label {
    display: none !important;
}

.settings-group {
    margin-bottom: 1rem;
}

.settings-group label:not(.category-checkbox) {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 500;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
}

label.category-checkbox {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
    font-size: 0.9rem;
    line-height: normal;
    margin-bottom: 0 !important;
    font-weight: 400;
    /* Reset from potential 500 in settings-group label */
}

.category-checkbox:hover {
    background: rgba(255, 255, 255, 0.1);
}

.category-checkbox input {
    accent-color: var(--primary);
    margin: 0 !important;
    padding: 0 !important;
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    top: 0;
}

.category-checkbox.custom {
    border: 1px dashed rgba(255, 255, 255, 0.3);
}

.custom-category-input {
    display: flex;
    gap: 0.5rem;
}

.custom-category-input input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text);
}

.custom-category-input input:focus {
    outline: none;
    border-color: var(--primary);
}

.settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-select {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: var(--text);
    padding: 0.75rem;
    border-radius: 10px;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: none;
}

.form-select option {
    background: #1a1a2e;
    color: var(--text);
}

/* ========== LETTER REVEAL ========== */
.letter-container {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.letter-display {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
}

.letter-roulette {
    font-size: 8rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: 0 0 30px rgba(var(--primary-rgb), 0.5);
    animation: letterPulse 0.5s ease infinite;
    font-family: 'Montserrat', sans-serif;
}

.letter-roulette.revealed {
    animation: letterReveal 0.5s ease forwards;
}

@keyframes letterPulse {

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

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

@keyframes letterReveal {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
        text-shadow: 0 0 50px rgba(var(--primary-rgb), 0.8);
    }

    100% {
        transform: scale(1.1);
    }
}

/* ========== GAME SECTION ========== */
.game-container {
    max-width: 700px;
    margin: 0 auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.round-info {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
}

.current-letter {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(var(--primary-rgb), 0.5);
}

.timer-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.timer-display.warning {
    color: #ff6b6b;
    animation: timerPulse 1s ease infinite;
}

@keyframes timerPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Category Inputs */
.categories-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-input-group label {
    min-width: 100px;
    font-weight: 500;
    color: var(--text);
}

.category-input-group input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.category-input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.category-input-group input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.category-input-group input.submitted {
    background: rgba(var(--primary-rgb), 0.2);
    border-color: var(--primary);
    pointer-events: none;
}

#round-end-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(var(--primary-rgb), 0.95);
    padding: 2rem;
    border-radius: 20px;
    z-index: 100;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    display: none;
    pointer-events: none;
    min-width: 300px;
}

#round-end-overlay.active {
    display: block;
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#round-end-overlay h2 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
}

#round-end-overlay p {
    margin: 0.5rem 0 0;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
}

.game-container.round-over .categories-inputs {
    opacity: 0.3;
    filter: blur(5px);
    pointer-events: none;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ========== SCORING SECTION ========== */
.scoring-container {
    max-width: 900px;
    margin: 0 auto;
}

.scoring-table-wrapper {
    overflow-x: auto;
    margin: 1rem 0;
}

.scoring-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.scoring-table th,
.scoring-table td {
    padding: 0.75rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.scoring-table th {
    background: rgba(0, 0, 0, 0.3);
    font-weight: 600;
}

.scoring-table td:first-child {
    font-weight: 500;
    text-align: left;
    background: rgba(0, 0, 0, 0.2);
}

.scoring-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.scoring-table tfoot td {
    background: rgba(0, 0, 0, 0.3);
    font-weight: 600;
}

/* Answer Cell */
.answer-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.answer-text {
    font-weight: 500;
}

.answer-text.empty {
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
}

.answer-points {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    font-weight: 600;
}

.answer-points.points-10 {
    background: rgba(76, 175, 80, 0.3);
    color: #81c784;
}

.answer-points.points-5 {
    background: rgba(255, 193, 7, 0.3);
    color: #ffd54f;
}

.answer-points.points-0 {
    background: rgba(244, 67, 54, 0.3);
    color: #e57373;
}

/* Voting Buttons */
.vote-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.25rem;
}

.vote-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.vote-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.vote-btn.downvote:hover {
    background: rgba(244, 67, 54, 0.3);
}

.vote-btn.active {
    background: rgba(244, 67, 54, 0.5);
    border-color: #f44336;
}

.vote-count {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 0.25rem;
}

/* Ready Section */
.ready-section {
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
}

.ready-players {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.ready-player {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
}

.ready-player .avatar {
    font-size: 1.2rem;
}

.ready-player.is-ready {
    border: 1px solid #4caf50;
    background: rgba(76, 175, 80, 0.2);
}

.ready-player.is-ready::after {
    content: '✓';
    color: #4caf50;
    margin-left: 0.25rem;
}

/* ========== RESULTS SECTION ========== */
.results-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1rem;
    margin: 2rem 0;
    min-height: 200px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border-radius: 15px;
    min-width: 100px;
}

.podium-place.first {
    order: 2;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 193, 7, 0.1));
    border: 2px solid gold;
}

.podium-place.second {
    order: 1;
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.3), rgba(158, 158, 158, 0.1));
    border: 2px solid silver;
}

.podium-place.third {
    order: 3;
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.3), rgba(139, 90, 43, 0.1));
    border: 2px solid #cd7f32;
}

.podium-place .rank {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.podium-place .avatar {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.podium-place .name {
    font-weight: 600;
    color: var(--text);
}

.podium-place .score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Final Scores Table */
.final-scores {
    margin-top: 2rem;
}

.final-scores table {
    width: 100%;
    border-collapse: collapse;
}

.final-scores th,
.final-scores td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.final-scores th {
    font-weight: 600;
}

/* ========== CONFETTI ========== */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

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

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: #2a2a2e;
    /* Ensure readable background */
    color: white;
    /* Ensure readable text */
}

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

/* ========== INTERMEDIATE LEADERBOARD ========== */
.intermediate-container {
    max-width: 600px;
    margin: 0 auto;
}

#intermediate-leaderboard table {
    width: 100%;
    max-width: 500px;
    border-collapse: separate;
    border-spacing: 0 10px;
    margin: 1rem auto;
}

#intermediate-leaderboard tr {
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.2s ease;
}

#intermediate-leaderboard tr:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.1);
}

#intermediate-leaderboard td {
    padding: 1rem;
}

#intermediate-leaderboard tr td:first-child {
    border-radius: 12px 0 0 12px;
}

#intermediate-leaderboard tr td:last-child {
    border-radius: 0 12px 12px 0;
}

#intermediate-leaderboard th {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
    border: none;
    text-align: center;
}

#intermediate-leaderboard th:nth-child(2) {
    text-align: center;
}

#intermediate-leaderboard td {
    padding: 1rem;
    text-align: center;
}

#intermediate-leaderboard td:nth-child(2) {
    text-align: center;
}

#intermediate-leaderboard td strong {
    font-size: 1.25rem;
    color: var(--primary);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .glass-container {
        padding: 1.5rem;
        margin: 0.5rem;
    }

    .avatar-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .letter-roulette {
        font-size: 5rem;
    }

    .game-header {
        flex-direction: column;
        gap: 1rem;
    }

    .category-input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .category-input-group label {
        min-width: auto;
    }

    .settings-row {
        grid-template-columns: 1fr;
    }

    .scoring-table {
        font-size: 0.8rem;
    }

    .scoring-table th,
    .scoring-table td {
        padding: 0.5rem;
    }

    .podium {
        flex-direction: column;
        align-items: center;
    }

    .podium-place {
        order: unset !important;
    }
}

/* ========== FRIEND INVITE LIST ========== */
.friends-invite-list {
    max-height: 300px;
    overflow-y: auto;
    text-align: left;
    margin-top: 1rem;
    padding-right: 5px;
}

/* Custom Scrollbar for invite list */
.friends-invite-list::-webkit-scrollbar {
    width: 6px;
}

.friends-invite-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.friend-invite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.friend-invite-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(2px);
}

.friend-invite-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.friend-invite-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 1.1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.friend-invite-name {
    font-weight: 500;
    color: var(--text);
}