/* Dice Challenge Game Styles */

/* Main Container */
.dice-challenge-main {
    min-height: calc(100vh - 80px - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: #F9FAFB;
}

.dice-challenge-container {
    width: 100%;
    max-width: 1200px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
}

/* Screen Management */
.screen {
    display: none;
    padding: 3rem 2rem;
    min-height: 500px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.screen.active {
    display: block;
    opacity: 1;
}

/* Setup Screen */
.setup-content {
    text-align: center;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.game-title {
    font-size: 3rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 0.5rem;
}

.game-subtitle {
    font-size: 1.25rem;
    color: #666;
    margin-bottom: 2rem;
    font-weight: 500;
}

.setup-section {
    margin-bottom: 2rem;
    text-align: left;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #333;
    text-align: center;
}

/* Mode Buttons */
.mode-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.mode-btn {
    padding: 1.5rem 1rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mode-btn:hover {
    border-color: #3B82F6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.mode-btn.active {
    background: #3B82F6;
    border-color: #3B82F6;
    color: white;
}

.mode-name {
    font-size: 1.125rem;
    font-weight: 700;
}

.mode-desc {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Dice Count Buttons */
.dice-count-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.dice-count-btn {
    flex: 1;
    max-width: 150px;
    padding: 2rem 1rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.dice-count-btn:hover {
    border-color: #3B82F6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.dice-count-btn.active {
    background: #3B82F6;
    border-color: #3B82F6;
    color: white;
}

.dice-count-number {
    font-size: 2.5rem;
    font-weight: 800;
}

.dice-count-label {
    font-size: 1rem;
    font-weight: 500;
}

/* Buttons */
.game-btn {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 56px;
    font-family: inherit;
}

.game-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.game-btn:active:not(:disabled) {
    transform: translateY(0);
}

.game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.game-btn-primary {
    background: #3B82F6;
    color: white;
}

.game-btn-primary:hover:not(:disabled) {
    background: #2563EB;
}

.game-btn-secondary {
    background: #f3f4f6;
    color: #333;
}

.game-btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
}

.back-btn {
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    color: #666;
    font-size: 0.938rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #e5e7eb;
    color: #333;
}

/* Game Screen */
.game-content {
    width: 100%;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.game-screen-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.card:hover {
    border-color: #3B82F6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.card.selected {
    background: #3B82F6;
    border-color: #3B82F6;
    color: white;
}

.card-name {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card-description {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.card.selected .card-description {
    color: rgba(255, 255, 255, 0.9);
}

.card-points {
    font-size: 1rem;
    font-weight: 600;
    color: #3B82F6;
}

.card.selected .card-points {
    color: white;
}

.card.used {
    position: relative;
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.used-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #EF4444;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Selected Card Display */
.selected-card-display {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.selected-card-display h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #333;
}

.selected-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.selected-card-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.selected-card-desc {
    font-size: 0.938rem;
    color: #666;
}

.selected-card-points {
    font-size: 1.125rem;
    font-weight: 700;
    color: #3B82F6;
}

/* Dice Section (Normal Mode) */
.dice-section {
    margin-top: 2rem;
}

.dice-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.dice-display {
    background: #f9fafb;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

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

.die {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 3px solid #3B82F6;
    border-radius: 12px;
    font-size: 2rem;
    font-weight: 700;
    color: #3B82F6;
    animation: diceRoll 0.6s ease backwards;
}

@keyframes diceRoll {
    0% {
        transform: rotateX(0) rotateY(0);
        opacity: 0;
    }
    50% {
        transform: rotateX(180deg) rotateY(180deg);
    }
    100% {
        transform: rotateX(360deg) rotateY(360deg);
        opacity: 1;
    }
}

.dice-sum {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.dice-display.match-success {
    background: #D1FAE5;
    border: 2px solid #10B981;
}

.dice-display.match-fail {
    background: #FEE2E2;
    border: 2px solid #EF4444;
}

/* Team Mode */
.team-section {
    margin-top: 2rem;
}

.current-team-display {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.current-team-name {
    font-size: 1.5rem;
    font-weight: 700;
}

.current-team-score {
    font-size: 1.25rem;
    font-weight: 600;
    opacity: 0.9;
}

.teams-scoreboard {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.teams-scoreboard h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #333;
    text-align: center;
}

.teams-score-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.team-score-item {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.team-score-item.current-team {
    border-color: #3B82F6;
    background: #EFF6FF;
    font-weight: 700;
}

.team-score-name {
    font-size: 0.938rem;
    font-weight: 600;
    color: #333;
}

.team-score-item.current-team .team-score-name {
    color: #3B82F6;
}

.team-score-value {
    font-size: 1rem;
    font-weight: 700;
    color: #3B82F6;
}

.player-count-section {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.player-count-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.player-count-input {
    width: 100%;
    max-width: 200px;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    font-family: inherit;
}

.player-count-input:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.player-count-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    flex-wrap: wrap;
    justify-content: center;
}

.card-points-display,
.player-count-display {
    color: #3B82F6;
    font-weight: 700;
    font-size: 1.5rem;
}

.multiply-symbol,
.equals-symbol {
    color: #666;
    font-size: 1.25rem;
}

.calculated-points {
    color: #10B981;
    font-weight: 700;
    font-size: 1.75rem;
}

.points-label {
    color: #666;
    font-size: 1rem;
}

.team-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.team-count-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.team-count-input {
    width: 100px;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    font-family: inherit;
}

.team-count-input:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.team-count-label {
    font-size: 1.125rem;
    font-weight: 600;
    color: #333;
}


/* Responsive Design */

/* Tablet */
@media (max-width: 768px) {
    .dice-challenge-main {
        padding: 1rem 0.5rem;
    }

    .screen {
        padding: 2rem 1.5rem;
        min-height: 400px;
    }

    .game-title {
        font-size: 2.5rem;
    }

    .mode-buttons {
        grid-template-columns: 1fr;
    }

    .dice-count-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .dice-count-btn {
        max-width: 100%;
    }

    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 0.75rem;
    }

    .game-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .dice-challenge-main {
        padding: 0.5rem 0.25rem;
        min-height: calc(100vh - 70px - 150px);
    }

    .dice-challenge-container {
        border-radius: 16px;
    }

    .screen {
        padding: 1.5rem 1rem;
        min-height: 350px;
    }

    .game-title {
        font-size: 2rem;
    }

    .game-subtitle {
        font-size: 1rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1rem;
    }

    .dice-results {
        gap: 0.5rem;
    }

    .die {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .player-count-input {
        max-width: 100%;
        font-size: 1.5rem;
    }

    .player-count-info {
        font-size: 1rem;
    }

    .card-points-display,
    .player-count-display {
        font-size: 1.25rem;
    }

    .calculated-points {
        font-size: 1.5rem;
    }

    .host-controls {
        flex-direction: column;
    }

    .game-btn {
        width: 100%;
    }
}

/* Touch-friendly enhancements */
@media (hover: none) and (pointer: coarse) {
    .game-btn,
    .mode-btn,
    .dice-count-btn,
    .card {
        -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
    }
}

/* Accessibility */
.game-btn:focus,
.card:focus,
.mode-btn:focus,
.dice-count-btn:focus {
    outline: 3px solid #3B82F6;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
