/* ============================================================================
   DICE BASEBALL WEB VERSION - STYLES
   ============================================================================ */

/* CSS Variables */
:root {
    /* Colors */
    --color-sky-light: #87ceeb;
    --color-sky-soft: #add8e6;
    --color-sunset: #f5deb3;
    --color-field-green: #228b22;
    --color-dark-green: #1a472a;
    --color-darker-green: #0d2818;

    --color-away: #e69900;
    --color-away-light: #ffcc00;
    --color-home: #3366cc;

    --color-white: #ffffff;
    --color-black: #000000;
    --color-gray-light: rgba(255, 255, 255, 0.7);
    --color-gray-dark: rgba(0, 0, 0, 0.6);

    /* Typography */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 40px;

    /* Borders */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;
    --radius-full: 50%;

    /* Ad Sizes */
    --ad-top-height: 60px;
    --ad-side-width: 160px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: var(--font-main);
    background: var(--color-dark-green);
    color: var(--color-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

/* Screen Management */
.screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.screen.hidden {
    display: none;
}

.outcome-display.hidden {
    display: none !important;
}

/* ============================================================================
   AD CONTAINERS
   ============================================================================ */

.ad-container {
    display: none;
    background: rgba(0, 0, 0, 0.2);
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.ad-placeholder {
    font-size: 10px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
}

/* Top Ad (Small banner for mobile portrait) */
.ad-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--ad-top-height);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Side Ads (Sky-scrapers for desktop) */
.ad-side {
    position: fixed;
    top: 0;
    bottom: 0;
    width: var(--ad-side-width);
    background: rgba(0, 0, 0, 0.3);
}

.ad-left {
    left: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.ad-right {
    right: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

/* Response Adjustments for Ads */

/* Mobile Portrait - Only show ads when .show-ads is on body */
@media (max-width: 767px) and (orientation: portrait) {
    body.show-ads .ad-top {
        display: flex;
    }

    /* Push the fixed screen down to make room for the top ad */
    body.show-ads .screen {
        top: var(--ad-top-height);
    }
}

/* Desktop (min-width: 1024px or similar) - Only show ads when .show-ads is on body */
@media (min-width: 1024px) {
    body.show-ads .ad-side {
        display: flex;
    }

    body.show-ads .screen {
        left: var(--ad-side-width);
        right: var(--ad-side-width);
        width: calc(100% - (var(--ad-side-width) * 2));
    }
}

/* Mobile Landscape - No Ads (ads never shown in landscape due to default display: none) */

/* ============================================================================
   HOME SCREEN
   ============================================================================ */

#home-screen {
    background: linear-gradient(to bottom,
            var(--color-sky-light) 0%,
            var(--color-sky-soft) 30%,
            var(--color-sunset) 60%,
            var(--color-field-green) 100%);
}

.home-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-lg);
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.hero-section {
    margin-bottom: var(--spacing-xl);
}

.logo-container {
    background: transparent;
    border-radius: var(--radius-lg);
    padding: 0;
    text-align: center;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

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

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

.logo-image {
    width: 280px;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 5px 15px rgba(0, 0, 0, 0.2);
}

.logo-icon {
    font-size: 80px;
    margin-bottom: var(--spacing-sm);
}

.logo-title {
    font-size: 42px;
    font-weight: 900;
    color: var(--color-dark-green);
    line-height: 1;
    letter-spacing: -2px;
}

.mode-selection {
    width: 100%;
}

.mode-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 3px;
    text-align: center;
    margin-bottom: var(--spacing-md);
    color: var(--color-white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.mode-card {
    display: flex;
    align-items: center;
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(135deg, rgba(30, 40, 50, 0.9), rgba(20, 30, 40, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.mode-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.mode-card:active {
    transform: translateY(0);
}

.mode-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 24px;
    margin-right: var(--spacing-md);
}

.pvp-icon {
    background: linear-gradient(135deg, #2e8b57, #228b22);
}

.pvc-icon {
    background: linear-gradient(135deg, #4a7dd4, #3366cc);
}

.mode-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.mode-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--color-white);
}

.mode-subtitle {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-gray-light);
}

.mode-arrow {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.5);
}

/* App Store Download Button */
.app-store-link {
    display: block;
    margin: var(--spacing-lg) auto;
    text-align: center;
}

.app-store-badge {
    height: 44px;
    width: auto;
}

/* Hide on desktop - only show on mobile */
@media (min-width: 768px) {
    .app-store-link {
        display: none;
    }
}

/* Legal Footer */
.legal-footer {
    margin-top: auto;
    padding: var(--spacing-lg) 0;
    text-align: center;
    font-size: 12px;
}

.legal-footer a {
    color: rgba(255, 255, 255, 0.85);
    /* Higher contrast for accessibility */
    text-decoration: underline;
}

.legal-footer a:hover {
    color: var(--color-white);
}

.footer-divider {
    color: rgba(255, 255, 255, 0.5);
    margin: 0 var(--spacing-sm);
}

/* ============================================================================
   SETUP SCREEN
   ============================================================================ */

#setup-screen {
    background: linear-gradient(to bottom,
            #66b3ff 0%,
            #1a6633 100%);
}

.setup-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md) var(--spacing-lg);
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    overflow-y: auto;
}

.setup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    padding-top: env(safe-area-inset-top);
}

.back-btn {
    background: none;
    border: none;
    color: var(--color-white);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: var(--spacing-sm);
}

.setup-title {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.setup-label {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
}

.setup-heading {
    font-size: 28px;
    font-weight: 900;
}

.setup-icon {
    font-size: 32px;
    opacity: 0.3;
}

.setup-sections {
    flex: 1;
}

.setup-section {
    margin-bottom: var(--spacing-lg);
}

.section-label {
    display: block;
    font-size: 12px;
    font-weight: 900;
    color: #ffcc00;
    letter-spacing: 1px;
    margin-bottom: var(--spacing-sm);
}

/* Innings Selector */
.innings-selector {
    display: flex;
    gap: var(--spacing-xs);
    background: rgba(0, 0, 0, 0.4);
    padding: var(--spacing-xs);
    border-radius: var(--radius-sm);
}

.innings-btn {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-white);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.innings-btn.active {
    background: var(--color-white);
    color: var(--color-black);
}

/* Stadium Selector */
.stadium-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.stadium-arrow {
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: var(--radius-full);
    color: var(--color-white);
    font-size: 24px;
    cursor: pointer;
    transition: background 0.2s;
}

.stadium-arrow:hover {
    background: rgba(0, 0, 0, 0.5);
}

.stadium-card {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.stadium-preview-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-sm);
}

.stadium-badge {
    display: inline-block;
    background: rgba(255, 204, 0, 0.2);
    color: #ffcc00;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: var(--spacing-sm);
}

.stadium-name {
    font-size: 18px;
    font-weight: 900;
    margin-bottom: var(--spacing-sm);
}

.stadium-description {
    font-size: 13px;
    color: var(--color-gray-light);
    line-height: 1.4;
    margin-bottom: var(--spacing-sm);
}

.stadium-counter {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* Rules Card */
.rules-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rule-label {
    font-size: 14px;
    font-weight: 700;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    cursor: pointer;
    transition: background 0.3s;
}

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

.toggle-switch input:checked+.toggle-slider {
    background: #22c55e;
}

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

/* Play Ball Button */
.play-ball-btn {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-xl);
    background: #ffcc00;
    border: none;
    border-radius: var(--radius-xl);
    color: var(--color-black);
    font-size: 22px;
    font-weight: 900;
    cursor: pointer;
    margin-top: var(--spacing-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.play-ball-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.play-ball-btn:active {
    transform: translateY(0);
}

/* ============================================================================
   GAME SCREEN
   ============================================================================ */

.game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.stadium-bg {
    position: absolute;
    inset: 0;
    background-color: #2e7d32;
    z-index: 0;
}

/* Field Container - constrains stadium and runners to same 1:1 aspect ratio */
.field-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
}

/* Inner wrapper maintains the 1:1 aspect ratio of the stadium image */
.field-container::before {
    content: '';
    display: block;
}

.stadium-img {
    position: absolute;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

/* Runners Overlay - positions runners on the stadium's diamond */
.runners-overlay {
    position: absolute;
    /* Size must match the rendered stadium image for percentage positioning */
    max-width: 100%;
    max-height: 100%;
    width: 100vmin;
    height: 100vmin;
    aspect-ratio: 1 / 1;
    z-index: 2;
    pointer-events: none;
}

.runner-sprite {
    position: absolute;
    /* Scale with the stadium (6% of the smaller viewport dimension) */
    width: 6vmin;
    height: auto;
    filter: drop-shadow(2px 2px 6px rgba(0, 0, 0, 0.6));
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease;
}

.runner-sprite.hidden {
    display: none;
}

/* Position runners to match stadium image diamond locations */
/* Calculated from pixel positions: 1st(1282,1249) 2nd(1024,1116) 3rd(768,1249) on 2048x2048 image */
.runner-first {
    top: 59%;
    left: 62.6%;
}

.runner-second {
    top: 51.95%;
    left: 49%;
}

.runner-third {
    top: 59%;
    left: 37.5%;
}

/* Scoreboard */
.scoreboard-container {
    position: relative;
    z-index: 10;
    padding: var(--spacing-md);
    padding-top: calc(var(--spacing-md) + env(safe-area-inset-top));
}

.scoreboard {
    display: flex;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.score-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: all 0.3s;
}

.score-box.active {
    background: var(--color-home);
}

#away-box.active {
    background: var(--color-away);
}

#away-box.active .team-name,
#away-box.active .team-score {
    color: var(--color-black);
}

.team-name {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.team-score {
    font-size: 36px;
    font-weight: 900;
    font-family: monospace;
}

.inning-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 var(--spacing-md);
    min-width: 70px;
}

.inning-label {
    font-size: 9px;
    font-weight: 700;
    opacity: 0.7;
}

.inning-number {
    font-size: 20px;
    font-weight: 900;
}

.inning-half {
    font-size: 9px;
    font-weight: 700;
    opacity: 0.7;
}

.exit-game-btn {
    margin-top: var(--spacing-xs);
    background: none;
    border: none;
    color: var(--color-black);
    font-size: 8px;
    font-weight: 900;
    text-decoration: underline;
    cursor: pointer;
    opacity: 0.7;
}

/* Line Score */
.line-score {
    margin-top: var(--spacing-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.line-score-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.line-score-table th,
.line-score-table td {
    padding: var(--spacing-xs);
    text-align: center;
    min-width: 20px;
}

.line-score-table th {
    font-weight: 700;
    opacity: 0.7;
}

.line-score-table .team-label {
    text-align: left;
    font-weight: 700;
}

.line-score-table .total {
    font-weight: 900;
    background: rgba(255, 255, 255, 0.1);
}

.line-score-table .current {
    background: rgba(255, 204, 0, 0.3);
}

/* Outcome Display */
.outcome-display {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 15;
    background: rgba(0, 0, 0, 0.85);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-size: 24px;
    font-weight: 900;
    text-align: center;
    animation: popIn 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

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

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

/* Control Cluster */
.control-cluster {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: var(--spacing-md);
    padding-bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    /* Gradient background so controls don't overlap stadium */
    background: linear-gradient(to top,
            rgba(26, 71, 42, 0.95) 0%,
            rgba(26, 71, 42, 0.8) 60%,
            transparent 100%);
    padding-top: var(--spacing-xl);
}

/* Outs Indicator */
.outs-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.5);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-xl);
}

.outs-label {
    font-size: 10px;
    font-weight: 900;
}

.outs-dots {
    display: flex;
    gap: var(--spacing-xs);
}

.out-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: background 0.3s, box-shadow 0.3s;
}

.out-dot.filled {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
}

/* Dice Container */
.dice-container {
    display: flex;
    gap: var(--spacing-xl);
}

.dice-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.dice-label {
    font-size: 11px;
    font-weight: 800;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.bat-label {
    background: var(--color-away);
    color: var(--color-black);
}

.field-label {
    background: var(--color-home);
    color: var(--color-white);
}

.dice {
    /* Responsive dice size - scales with viewport */
    width: min(80px, 18vmin);
    height: min(80px, 18vmin);
    background: linear-gradient(135deg, #ffffff, #f0f0f0);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.15),
        inset 0 2px 3px rgba(255, 255, 255, 0.5);
    font-size: min(32px, 7vmin);
    font-weight: 900;
    color: var(--color-gray-dark);
    transition: transform 0.2s;
}

.dice.rolling {
    animation: diceRoll 0.1s linear infinite;
}

@keyframes diceRoll {
    0% {
        transform: rotate(0deg) scale(1);
    }

    25% {
        transform: rotate(5deg) scale(1.02);
    }

    50% {
        transform: rotate(0deg) scale(1);
    }

    75% {
        transform: rotate(-5deg) scale(1.02);
    }

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

.dice-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: min(6px, 1.3vmin);
    width: min(60px, 13vmin);
    height: min(60px, 13vmin);
}

.dice-dot {
    width: min(14px, 3vmin);
    height: min(14px, 3vmin);
    border-radius: 50%;
    background: transparent;
    transition: background 0.2s;
}

.dice-dot.visible {
    background: #1a1a1a;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Roll Button */
.roll-button-container {
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

.roll-placeholder {
    height: 60px;
}

.roll-btn {
    padding: var(--spacing-md) var(--spacing-xl);
    border: none;
    border-radius: var(--radius-xl);
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    min-width: 200px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.roll-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

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

.roll-btn:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.bat-btn {
    background: var(--color-away);
    color: var(--color-black);
}

.field-btn {
    background: var(--color-home);
    color: var(--color-white);
}

.ai-btn {
    opacity: 0.7;
    animation: aiPulse 1s ease-in-out infinite;
}

@keyframes aiPulse {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }
}

/* Fireworks */
.fireworks-container {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    pointer-events: none;
}

.firework-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: firework 1s ease-out forwards;
    animation-delay: var(--delay);
}

@keyframes firework {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--x), var(--y)) scale(0);
        opacity: 0;
    }
}

/* ============================================================================
   OVERLAYS
   ============================================================================ */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: var(--spacing-lg);
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.overlay-title {
    font-size: 32px;
    font-weight: 900;
    margin-bottom: var(--spacing-sm);
}

.overlay-subtitle {
    font-size: 14px;
    font-weight: 700;
    opacity: 0.7;
    letter-spacing: 2px;
}

/* Coin Flip */
.coin-flip-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
}

.coin-container {
    perspective: 1000px;
    height: 160px;
    margin: var(--spacing-lg) 0;
}

.coin {
    width: 140px;
    height: 140px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s;
}

.coin.flipping {
    animation: coinFlip 1.5s ease-out forwards;
}

@keyframes coinFlip {
    0% {
        transform: rotateX(0deg) translateY(0);
    }

    25% {
        transform: rotateX(720deg) translateY(-100px);
    }

    50% {
        transform: rotateX(1440deg) translateY(-50px);
    }

    100% {
        transform: rotateX(1800deg) translateY(0);
    }
}

.coin-front,
.coin-back {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 70px;
    background: linear-gradient(135deg, #ffffff, #e0e0e0);
    border-radius: 50%;
    backface-visibility: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.coin-back {
    transform: rotateX(180deg);
}

.coin-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.winner-name {
    font-size: 36px;
    font-weight: 900;
}

.wins-text {
    font-size: 16px;
    font-weight: 700;
    opacity: 0.7;
}

/* Side Switch */
.side-switch-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    background: var(--color-darker-green);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
}

.side-switch-title {
    font-size: 40px;
    font-weight: 900;
}

.switch-icon {
    font-size: 80px;
    color: #ffcc00;
}

.ready-text {
    font-size: 20px;
    font-weight: 700;
}

.next-batter {
    font-size: 18px;
    font-weight: 700;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-sm);
}

.next-batter.home-team {
    background: var(--color-home);
}

.next-batter.away-team {
    background: var(--color-away);
    color: var(--color-black);
}

/* Game Over */
.game-over-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    background: linear-gradient(135deg, #143314, #0d1f0d);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.game-over-title {
    font-size: 36px;
    font-weight: 900;
}

.final-score {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.final-team {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.final-score-num {
    font-size: 48px;
    font-weight: 900;
    font-family: monospace;
    transition: color 0.3s;
}

.final-score-num.winner {
    color: #ffcc00;
}

.final-team-name {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.7;
}

.score-divider {
    font-size: 36px;
    font-weight: 300;
    opacity: 0.5;
}

.game-summary-card {
    background: rgba(255, 255, 255, 0.1);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    width: 100%;
}

.game-summary-text {
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-gray-light);
}

.game-stats {
    display: flex;
    gap: var(--spacing-md);
}

.stat-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
}

.stat-value {
    font-size: 18px;
    font-weight: 900;
}

.stat-label {
    font-size: 10px;
    opacity: 0.7;
}

.game-over-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    width: 100%;
}

/* Buttons */
.primary-btn {
    width: 100%;
    padding: var(--spacing-md);
    background: #ffcc00;
    border: none;
    border-radius: var(--radius-xl);
    color: var(--color-black);
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
}

.secondary-btn {
    width: 100%;
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-xl);
    color: var(--color-white);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

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

.tertiary-btn {
    width: 100%;
    padding: var(--spacing-sm);
    background: none;
    border: none;
    color: var(--color-gray-light);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 380px) {
    .logo-title {
        font-size: 36px;
    }

    .logo-icon {
        font-size: 60px;
    }

    .mode-title {
        font-size: 16px;
    }

    .team-score {
        font-size: 28px;
    }

    .outcome-display {
        font-size: 20px;
    }

    .dice {
        width: 65px;
        height: 65px;
    }

    .dice-grid {
        width: 50px;
        height: 50px;
        gap: 4px;
    }

    .dice-dot {
        width: 12px;
        height: 12px;
    }

    .roll-btn {
        min-width: 160px;
        font-size: 16px;
    }
}

@media (min-width: 768px) {

    .home-content,
    .setup-content {
        max-width: 600px;
    }

    .logo-title {
        font-size: 56px;
    }

    .logo-icon {
        font-size: 100px;
    }

    .diamond {
        width: 280px;
        height: 280px;
    }

    .base {
        width: 40px;
        height: 40px;
    }

    .dice {
        width: 100px;
        height: 100px;
    }

    .dice-grid {
        width: 70px;
        height: 70px;
    }

    .dice-dot {
        width: 18px;
        height: 18px;
    }
}

/* Landscape Hint - hidden by default, shown only in landscape */
.landscape-hint {
    display: none;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(255, 204, 0, 0.95);
    color: var(--color-black);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-size: 11px;
    font-weight: 700;
    gap: var(--spacing-xs);
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

.rotate-icon {
    display: inline-block;
    animation: rotateHint 2s ease-in-out infinite;
}

@keyframes rotateHint {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-20deg);
    }

    75% {
        transform: rotate(20deg);
    }
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100%);
    }

    to {
        transform: translateX(-50%) translateY(0);
    }
}

/* Landscape Orientation - Compact Mode */
@media (max-height: 500px) and (orientation: landscape) {

    /* Show the landscape hint */
    .landscape-hint {
        display: flex;
    }

    /* Compact scoreboard */
    .scoreboard-container {
        padding: var(--spacing-xs);
        padding-top: calc(var(--spacing-xs) + 24px);
        /* Space for hint */
    }

    .scoreboard {
        padding: var(--spacing-xs);
    }

    .score-box {
        padding: var(--spacing-xs);
    }

    .team-score {
        font-size: 24px;
    }

    .team-name {
        font-size: 9px;
    }

    .inning-number {
        font-size: 16px;
    }

    /* Hide line score in landscape */
    .line-score {
        display: none;
    }

    /* Smaller stadium area */
    .field-container {
        top: 60px;
    }

    /* Smaller runners in landscape */
    .runner-sprite {
        width: 4vmin;
    }

    /* Compact control cluster - becomes horizontal layout */
    .control-cluster {
        position: absolute;
        bottom: auto;
        top: 50%;
        left: 0;
        right: 0;
        transform: translateY(-50%);
        padding: var(--spacing-xs);
        gap: var(--spacing-xs);
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        background: none;
        pointer-events: none;
    }

    /* Hide outs indicator in landscape to save space */
    .outs-indicator {
        display: none;
    }

    /* Dice container becomes a row spanning the full width */
    .dice-container {
        width: 100%;
        justify-content: space-between;
        padding: 0 var(--spacing-md);
        gap: 0;
    }

    /* Each dice wrapper positioned at edges and vertically centered */
    .dice-wrapper {
        pointer-events: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        padding: 0 var(--spacing-lg);
    }

    /* Dice sizing in landscape - uses viewport height for scaling */
    .dice {
        width: clamp(50px, 18vh, 80px);
        height: clamp(50px, 18vh, 80px);
        font-size: clamp(20px, 6vh, 32px);
    }

    /* Dice grid must fit within the dice */
    .dice-grid {
        width: 75%;
        height: 75%;
        gap: clamp(2px, 0.8vh, 6px);
    }

    /* Dice dots scale proportionally */
    .dice-dot {
        width: clamp(8px, 2.5vh, 14px);
        height: clamp(8px, 2.5vh, 14px);
    }

    .dice-label {
        font-size: 10px;
        padding: 3px var(--spacing-sm);
        margin-bottom: var(--spacing-xs);
    }

    /* Roll button container - positioned at bottom of stadium */
    .roll-button-container {
        position: fixed;
        bottom: clamp(10px, 5vh, 40px);
        left: 50%;
        transform: translateX(-50%);
        pointer-events: auto;
        z-index: 30;
    }

    /* Bigger roll button in landscape */
    .roll-btn {
        padding: var(--spacing-sm) var(--spacing-xl);
        font-size: 16px;
        min-width: 180px;
    }

    /* Outcome display in landscape */
    .outcome-display {
        font-size: 18px;
        padding: var(--spacing-xs) var(--spacing-md);
    }
}

/* ============================================================================
   NO GAME PLACEHOLDER (sits on top of field only)
   ============================================================================ */

.no-game-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 5;
    pointer-events: auto;
}

.no-game-placeholder.hidden {
    display: none;
}

.no-game-content {
    text-align: center;
    padding: var(--spacing-lg);
}

.no-game-icon {
    font-size: 60px;
    margin-bottom: var(--spacing-md);
    animation: float 3s ease-in-out infinite;
}

.no-game-title {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: var(--spacing-sm);
    color: var(--color-white);
}

.no-game-text {
    font-size: 14px;
    color: var(--color-gray-light);
    margin-bottom: var(--spacing-lg);
}