/* ===================================
   CUSTOM DICE POOL GAME TESTER
   Main Stylesheet - Optimized for single-screen view
   =================================== */

/* === CSS Variables === */
:root {
    --primary-bg: #1a1a2e;
    --secondary-bg: #16213e;
    --accent-color: #0f3460;
    --highlight-color: #e94560;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --success-color: #00ff88;
    --failure-color: #ff4444;
    --warning-color: #ffaa00;
    --border-radius: 8px;
    --transition-speed: 0.3s;
}

/* === Global Styles === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 10px;
    font-size: 14px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

/* === Header === */
header {
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--accent-color);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* === Comparison Stats === */
.comparison-stats {
    background: var(--accent-color);
    padding: 10px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.comparison-stats h2 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 1rem;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.comparison-item {
    background: var(--secondary-bg);
    padding: 8px;
    border-radius: 6px;
    text-align: center;
}

.comparison-item .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.comparison-item .value {
    display: block;
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-primary);
}

.predicted-winner {
    grid-column: 1 / -1;
    background: var(--highlight-color);
}

.predicted-winner .value {
    font-size: 1.1rem;
}

/* === Player Sections === */
.player-section {
    background: var(--secondary-bg);
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

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

.section-header h2 {
    font-size: 1.1rem;
    margin: 0;
}

/* === Dice Container === */
.dice-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    background: var(--primary-bg);
    border-radius: 6px;
}

.die {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    min-height: 50px;
}

.die:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.die.selected {
    border-color: var(--success-color);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
    transform: translateY(-3px);
}

.die-number {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-primary);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.die-label {
    font-size: 0.6rem;
    color: var(--text-primary);
    margin-top: 2px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Die size scaling based on die number */
.die[data-die="1"] { transform: scale(0.85); }
.die[data-die="2"] { transform: scale(0.87); }
.die[data-die="3"] { transform: scale(0.89); }
.die[data-die="4"] { transform: scale(0.91); }
.die[data-die="5"] { transform: scale(0.93); }
.die[data-die="6"] { transform: scale(0.95); }
.die[data-die="7"] { transform: scale(0.97); }
.die[data-die="8"] { transform: scale(0.99); }
.die[data-die="9"] { transform: scale(1.01); }
.die[data-die="10"] { transform: scale(1.03); }
.die[data-die="11"] { transform: scale(1.05); }
.die[data-die="12"] { transform: scale(1.07); }

.die.selected[data-die="1"] { transform: scale(0.85) translateY(-3px); }
.die.selected[data-die="2"] { transform: scale(0.87) translateY(-3px); }
.die.selected[data-die="3"] { transform: scale(0.89) translateY(-3px); }
.die.selected[data-die="4"] { transform: scale(0.91) translateY(-3px); }
.die.selected[data-die="5"] { transform: scale(0.93) translateY(-3px); }
.die.selected[data-die="6"] { transform: scale(0.95) translateY(-3px); }
.die.selected[data-die="7"] { transform: scale(0.97) translateY(-3px); }
.die.selected[data-die="8"] { transform: scale(0.99) translateY(-3px); }
.die.selected[data-die="9"] { transform: scale(1.01) translateY(-3px); }
.die.selected[data-die="10"] { transform: scale(1.03) translateY(-3px); }
.die.selected[data-die="11"] { transform: scale(1.05) translateY(-3px); }
.die.selected[data-die="12"] { transform: scale(1.07) translateY(-3px); }

/* === Statistics Panel === */
.stats-panel {
    background: var(--accent-color);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.stats-panel h3 {
    margin-bottom: 8px;
    font-size: 0.95rem;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.stat-item {
    text-align: center;
    padding: 6px;
    background: var(--secondary-bg);
    border-radius: 4px;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.stat-value {
    display: block;
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--success-color);
}

/* === Results Container === */
.results-container {
    min-height: 60px;
    display: none;
}

.results-container.visible {
    display: block;
}

.results-header {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
    color: var(--warning-color);
}

.results-dice {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
}

.result-die {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    border: 2px solid;
    position: relative;
    animation: diceAppear 0.5s ease;
}

@keyframes diceAppear {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.result-die.success {
    background: var(--success-color);
    border-color: var(--success-color);
    color: #000;
}

.result-die.failure {
    background: var(--failure-color);
    border-color: var(--failure-color);
    color: #fff;
}

.result-die.critical {
    animation: criticalPulse 1s ease infinite;
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.8);
}

@keyframes criticalPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 255, 0, 0.8);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(255, 255, 0, 1);
    }
}

.result-die.fumble {
    animation: fumbleShake 0.5s ease;
}

@keyframes fumbleShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px) rotate(-5deg); }
    75% { transform: translateX(5px) rotate(5deg); }
}

.result-symbol {
    font-size: 1.5rem;
}

.result-number {
    font-size: 0.85rem;
    margin-top: 3px;
}

.results-summary {
    text-align: center;
    padding: 8px;
    background: var(--accent-color);
    border-radius: 6px;
    font-size: 0.9rem;
}

/* === Outcome Section === */
.outcome-section {
    background: var(--highlight-color);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: outcomeAppear 0.8s ease;
}

@keyframes outcomeAppear {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.outcome-section h2 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.outcome-message {
    font-size: 1rem;
    font-weight: bold;
}

/* === Controls === */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

/* Buttons */
button {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.roll-button {
    background: var(--success-color);
    color: #000;
}

.roll-button:hover:not(:disabled) {
    background: #00cc6a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.4);
}

.roll-button:active:not(:disabled) {
    transform: translateY(0);
}

.compare-button {
    background: var(--warning-color);
    color: #000;
}

.compare-button:hover {
    background: #ff9900;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 170, 0, 0.4);
}

.reset-button {
    background: var(--failure-color);
    color: #fff;
}

.reset-button:hover {
    background: #cc0000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background: var(--accent-color);
    border-radius: 24px;
    transition: background var(--transition-speed);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-speed);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--success-color);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(26px);
}

.toggle-label {
    font-size: 0.85rem;
    font-weight: bold;
}

/* === Rolling Animation === */
.rolling {
    animation: rollAnimation 0.1s linear infinite;
}

@keyframes rollAnimation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === Footer === */
footer {
    text-align: center;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* === Responsive Design === */
@media (max-width: 1200px) {
    .dice-container {
        grid-template-columns: repeat(6, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.2rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .section-header h2 {
        text-align: center;
    }

    .dice-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    button {
        width: 100%;
    }

    .controls {
        flex-direction: column;
    }
}