/* Color Palette */
:root {
    --bg-color: #121213;
    --tile-color: #3a3a3c;
    --red-color: #dc2626;
    --green-color: #538d4e;
    --gray-color: #787c7e;
    --white-color: #ffffff;
}

/* Base Styles - Mobile First */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--white-color);
    min-height: 100vh;
    padding: 10px;
    line-height: 1.4;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Header - Mobile First */
.header {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.title {
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 0.15em;
    margin-bottom: 6px;
}

.date {
    color: var(--gray-color);
    font-size: 12px;
}

/* Game Container - Mobile First */
.game-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    max-width: 100%;
}

/* Chart Section - Mobile First */
.chart-section {
    background-color: var(--tile-color);
    border-radius: 6px;
    padding: 12px;
    height: 240px;
    position: relative;
    touch-action: none;
}

/* Start Overlay */
.start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--tile-color);
    border-radius: 6px;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.start-content {
    text-align: center;
    max-width: 280px;
    padding: 20px;
}

.start-instructions {
    color: var(--gray-color);
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 20px;
}

.start-btn {
    background-color: var(--green-color);
    color: var(--white-color);
    border: none;
    border-radius: 8px;
    padding: 20px 40px;
    font-family: inherit;
    font-size: 24px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(83, 141, 78, 0.3);
}

.start-btn:hover {
    background-color: var(--green-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(83, 141, 78, 0.4);
}

.start-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(83, 141, 78, 0.3);
}

#priceChart {
    width: 100% !important;
    height: 100% !important;
}


/* Stats Section - Mobile First */
.stats-section {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.stat-item {
    background-color: var(--tile-color);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 60px;
    justify-content: center;
}

.stat-label {
    font-size: 10px;
    color: var(--gray-color);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-value {
    font-size: 14px;
    font-weight: bold;
    word-break: break-all;
}

.stat-value.positive {
    color: var(--green-color);
}

.stat-value.negative {
    color: var(--red-color);
}

/* Timer Section - Mobile First */
.timer-section {
    margin: 4px 0;
    flex-shrink: 0;
}

.timer {
    font-size: 16px;
    font-weight: bold;
    color: var(--gray-color);
}

.timer.warning {
    color: #fbbf24; /* Yellow */
}

.timer.danger {
    color: var(--red-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Actions Section - Mobile First */
.actions-section {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
    padding-top: 4px;
}

.action-btn {
    min-height: 60px;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-family: inherit;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--white-color);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Main trade buttons - larger */
.buy-btn, .sell-btn {
    flex: 2;
}

/* Multi-trade buttons - smaller */
.buy-multi-btn, .sell-multi-btn {
    flex: 1;
    font-size: 16px;
    letter-spacing: 0;
}

.buy-btn {
    background-color: var(--green-color);
}

.buy-btn:hover {
    background-color: var(--green-color);
}

.buy-btn:active {
    transform: scale(0.95);
}

.sell-btn {
    background-color: var(--red-color);
}

.sell-btn:hover {
    background-color: var(--red-color);
}

.sell-btn:active {
    transform: scale(0.95);
}

.buy-multi-btn {
    background-color: var(--green-color);
}

.buy-multi-btn:hover {
    background-color: var(--green-color);
}

.buy-multi-btn:active {
    transform: scale(0.95);
}

.sell-multi-btn {
    background-color: var(--red-color);
}

.sell-multi-btn:hover {
    background-color: var(--red-color);
}

.sell-multi-btn:active {
    transform: scale(0.95);
}

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

.share-game-btn {
    width: 100%;
    min-height: 60px;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--white-color);
    background-color: var(--green-color);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.share-game-btn:hover {
    background-color: var(--green-color);
}

.share-game-btn:active {
    transform: scale(0.95);
}

/* Modal - Mobile First */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 15px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: var(--tile-color);
    border-radius: 6px;
    padding: 20px;
    max-width: 100%;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    margin-bottom: 15px;
}

.modal-close-x {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    color: var(--gray-color);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: color 0.15s ease;
}

.modal-close-x:hover {
    color: var(--white-color);
}

.result-summary {
    margin-bottom: 15px;
}

.final-pnl {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 8px;
    word-break: break-all;
}

.final-pnl.positive {
    color: var(--green-color);
}

.final-pnl.negative {
    color: var(--red-color);
}

.stock-reveal {
    color: var(--gray-color);
    font-size: 14px;
    margin-bottom: 15px;
}

.trade-dots {
    font-size: 20px;
    line-height: 1.3;
    margin: 15px 0;
    word-break: break-all;
}

.share-text {
    background-color: var(--bg-color);
    border-radius: 4px;
    padding: 12px;
    font-family: monospace;
    font-size: 10px;
    text-align: left;
    white-space: pre-line;
    margin: 15px 0;
    overflow-x: auto;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s ease;
}

.share-btn {
    background-color: var(--green-color);
    color: var(--white-color);
}

.share-btn:hover {
    background-color: var(--green-color);
}

.close-btn {
    background-color: var(--gray-color);
    color: var(--white-color);
}

.close-btn:hover {
    background-color: var(--gray-color);
}

/* Daily Complete */
.daily-complete {
    text-align: center;
    padding: 40px 20px;
}

.daily-complete h2 {
    font-size: 24px;
    margin-bottom: 15px;
}

.daily-complete p {
    color: var(--gray-color);
    margin-bottom: 20px;
}

.next-game {
    font-size: 18px;
    font-weight: bold;
    color: var(--gray-color);
}

/* Dev Footer */
.dev-footer {
    position: fixed;
    bottom: 5px;
    left: 5px;
    right: 5px;
    text-align: center;
    font-size: 10px;
    color: var(--gray-color);
    opacity: 0.7;
    font-family: monospace;
    z-index: 1;
}

/* Tablet Styles - 768px and up */
@media (min-width: 768px) {
    body {
        padding: 20px;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .container {
        max-width: 500px;
        min-height: auto;
    }
    
    .header {
        margin-bottom: 25px;
    }
    
    .title {
        font-size: 32px;
        letter-spacing: 0.18em;
        margin-bottom: 8px;
    }
    
    .date {
        font-size: 14px;
    }
    
    .game-container {
        gap: 18px;
    }
    
    .chart-section {
        height: 300px;
        padding: 18px;
    }
    
    .stats-section {
        gap: 12px;
    }
    
    .stat-item {
        padding: 15px;
        min-height: 70px;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    .stat-value {
        font-size: 16px;
    }
    
    .timer {
        font-size: 18px;
    }
    
    .action-btn {
        height: 55px;
        font-size: 13px;
        max-width: 140px;
        letter-spacing: 0.1em;
    }
    
    .modal {
        max-width: 420px;
        padding: 25px;
    }
    
    .modal-header h2 {
        font-size: 22px;
    }
    
    .final-pnl {
        font-size: 26px;
    }
    
    .stock-reveal {
        font-size: 15px;
    }
    
    .trade-dots {
        font-size: 22px;
    }
    
    .share-text {
        font-size: 11px;
        padding: 14px;
    }
}

/* Desktop Styles - 1024px and up */
@media (min-width: 1024px) {
    .title {
        font-size: 36px;
        letter-spacing: 0.2em;
    }
    
    .chart-section {
        height: 330px;
        padding: 20px;
    }
    
    .stat-item {
        padding: 18px;
        min-height: 80px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .action-btn {
        height: 58px;
        font-size: 14px;
    }
    
    .modal {
        max-width: 450px;
        padding: 30px;
    }
    
    .modal-header h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .final-pnl {
        font-size: 28px;
        margin-bottom: 10px;
    }
    
    .stock-reveal {
        font-size: 16px;
        margin-bottom: 20px;
    }
    
    .trade-dots {
        font-size: 24px;
        line-height: 1.5;
        margin: 20px 0;
    }
    
    .share-text {
        font-size: 12px;
        padding: 15px;
        margin: 20px 0;
    }
}