* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --main-bg-color: #2c3e50;
    --canvas-bg-color: #34495e;
    --control-bg-color: #1a2530;
    --button-color: #aa2516;
    --button-hover-color: #e9331f;
    --text-light-color: #ecf0f1;
    --highlight-color: #f1c40f;
}

/* Telegram WebApp Theme Support */
html.telegram-dark-theme {
    --main-bg-color: #1c2733;
    --canvas-bg-color: #253444;
    --control-bg-color: #0f1620;
}

html.telegram-light-theme {
    --main-bg-color: #f0f0f0;
    --canvas-bg-color: #e0e0e0;
    --control-bg-color: #d0d0d0;
    --text-light-color: #333333;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--main-bg-color);
    color: var(--text-light-color);
    height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    touch-action: manipulation; /* Prevent zoom on double-tap for touch devices */
}

.game-container {
    width: 100vw; /* اشغال کل عرض ویوپورت */
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    padding: 0;
}

#dice-canvas, .object-section {
    width: 100%;
    flex: 1;
    height: auto;
    min-height: 55vh; /* کمی کوتاه‌تر شود */
    position: relative;
    overflow: hidden;
    margin-bottom: 5px; /* کاهش مارژین پایین */
}

#dice-canvas canvas, .object-section canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.controls {
    background-color: var(--control-bg-color);
    padding: 12px 10px; /* کاهش پدینگ */
    min-height: 150px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
    flex-direction: column;
    max-height: 40vh;
    overflow-y: auto;
}

/* Reorganize content for the new layout */
.controls-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    width: 100%;
    flex-wrap: nowrap; /* جلوگیری از انتقال به خط بعد */
}

/* Adjust for mobile */
@media (max-width: 768px) {
    .controls-row {
        flex-direction: row;
        gap: 10px;
        justify-content: space-between;
    }
}

/* Area for future additional content */
.controls-extra {
    width: 100%;
    min-height: 0; /* کاهش ارتفاع */
    margin-bottom: 5px;
}

/* Dice styling removed as we're not using separate display */

#roll-button, .invite-button {
    flex-shrink: 1; /* اجازه کوچک شدن به دکمه‌ها */
    min-width: 0; /* اجازه می‌دهد کمتر از محتوا کوچک شود */
    overflow: hidden; /* محتوای بیش از اندازه را پنهان می‌کند */
    white-space: nowrap; /* متن در یک خط باقی می‌ماند */
}

#roll-button {
    background-color: var(--button-color);
    color: white;
    border: none;
    padding: 8px 15px; /* کاهش پدینگ دکمه */
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    outline: none; /* Remove outline */
    user-select: none; /* Prevent text selection */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    display: flex;
    align-items: center;
    justify-content: center;
}

#roll-button:hover {
    background-color: var(--button-hover-color);
}

#roll-button:active {
    transform: scale(0.98);
}

/* Loading overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 16px;
    z-index: 1000;
    gap: 20px;
}

.loading-status {
    font-size: 14px;
    opacity: 0.7;
    text-align: center;
    max-width: 80%;
}

.loader {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* User information styles */
.user-info {
    display: flex;
    flex-direction: column;
    margin-top: 5px; /* کاهش مارژین */
    padding: 8px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    width: 100%;
    direction: ltr; /* Ensure left-to-right for English text */
    gap: 10px;
    max-height: 30vh; /* Ensure UI is compact enough */
    overflow-y: auto; /* Add scrolling if needed */
}

.info-section {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-bottom: 6px; /* کاهش فاصله */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.info-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--highlight-color);
    margin-bottom: 4px; /* کاهش مارژین */
    letter-spacing: 1px;
}

.user-detail, .result-detail {
    font-size: 14px;
    margin-bottom: 2px; /* کاهش مارژین */
    color: var(--text-light-color);
    display: flex;
    justify-content: space-between;
}

.detail-label {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
}

.detail-value {
    font-weight: normal;
    color: var(--text-light-color);
}

.detail-value.highlight {
    color: var(--highlight-color);
    font-weight: bold;
    font-size: 16px;
}

.roll-time {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    border-top: 1px dotted rgba(255, 255, 255, 0.1);
    padding-top: 5px;
}

/* Golden score box */
.golden-score-box {
    background: linear-gradient(135deg, #f1c40f, #ffb900 50%, #f39c12);
    color: #7f5700;
    border: 2px solid #e2b007;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2), inset 0 1px 3px rgba(255,255,255,0.3);
    text-shadow: 0 1px 1px rgba(255,255,255,0.3);
    min-width: 32px;
    flex-shrink: 0; /* جلوگیری از کوچک شدن */
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    body {
        font-size: 14px;
        width: 100%;
        overflow-x: hidden;
    }
    
    .game-container {
        width: 100%;
        max-width: 100vw;
        padding: 0;
        margin: 0;
        overflow-x: hidden;
    }
    
    #dice-canvas {
        min-height: 45vh;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    #dice-canvas canvas {
        width: 100% !important;
        height: 100% !important;
    }
    
    .controls {
        padding: 10px 8px;
        min-height: 120px;
        max-height: 35vh;
    }
    
    .controls-row {
        gap: 4px;
        margin-bottom: 6px;
    }
    
    #roll-button, .invite-button {
        padding: 6px 10px;
        font-size: 15px;
        white-space: nowrap;
    }
    
    .golden-score-box {
        padding: 4px 5px;
        font-size: 14px;
        min-width: 26px;
    }
    
    .user-info {
        margin-top: 3px;
        padding: 6px;
        max-height: 35vh;
    }
    
    .info-section {
        gap: 2px;
        padding-bottom: 4px;
    }
    
    .info-title {
        font-size: 12px;
        margin-bottom: 3px;
    }
    
    .user-detail, .result-detail {
        font-size: 12px;
        margin-bottom: 1px;
    }
    
    .detail-value.highlight {
        font-size: 14px;
    }
    
    .roll-time {
        font-size: 10px;
        margin-top: 4px;
        padding-top: 3px;
    }
}

/* Adjustments for very small screens (most mobile phones) */
@media screen and (max-width: 360px) {
    .controls {
        padding: 10px;
        min-height: 130px;
    }
    
    .controls-row {
        margin-bottom: 8px;
    }
    
    #roll-button {
        width: 100%;
    }
    
    #dice-canvas {
        min-height: 250px;
    }
    
    .controls-extra {
        min-height: 20px; /* Smaller on very small screens */
    }
    
    .golden-score-box {
        font-size: 14px;
        padding: 6px 10px;
    }
}

/* Add some neon effects to the dots to make them stand out */
.dice-dot {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}
    
/* Styles for invite button */
.invite-button {
    background-color: #339436;
    color: white;
    border: none;
    padding: 8px 15px; /* کاهش پدینگ دکمه */
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px; /* کاهش مارژین */
}

.invite-button:hover {
    background-color: #28c930;
}

.invite-button:active {
    transform: scale(0.98);
}

.invite-button .icon {
    margin-right: 5px;
    font-size: 16px;
}

/* Icon for roll button and other buttons */
.icon {
    margin-right: 3px; /* کاهش مارژین آیکون */
    font-size: 16px;
}

/* Footer styles */
.footer {
    position: fixed;
    bottom: 1px;
    right: 5px;
    text-align: right;
    padding: 1px;
    z-index: 100;
    /* Make sure it doesn't interfere with game elements */
    pointer-events: none;
}

.privacy-link {
    color: rgba(255, 255, 255, 0.5);
    font-size: 8px;
    text-decoration: none;
    padding: 3px 8px;
    border-radius: 3px;
    background-color: rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    /* Enable interaction just for the link */
    pointer-events: auto;
}

.privacy-link:hover {
    color: rgba(255, 255, 255, 0.8);
    background-color: rgba(0, 0, 0, 0.4);
}

/* For dark backgrounds */
@media (prefers-color-scheme: dark) {
    .privacy-link {
        background-color: rgba(255, 255, 255, 0.05);
    }
    
    .privacy-link:hover {
        background-color: rgba(255, 255, 255, 0.15);
    }
}

/* General Page Layout */
.page-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 16px;
    box-sizing: border-box;
    padding-top: 8px;
}

.page-header {
    text-align: center;
    margin-bottom: 8px;
    padding: 16px 16px 8px;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    color: var(--tg-theme-text-color, #000);
}

.content-section {
    flex: 1;
    margin-bottom: 20px;
    padding: 8px 16px;
}

.actions-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 16px 16px;
}

.navigation-section {
    display: flex;
    justify-content: space-between;
    margin: 12px 16px;
    padding: 10px;
    background-color: var(--tg-theme-bg-color, #fff);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-link {
    color: var(--tg-theme-link-color, #2481cc);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.nav-link:hover {
    background-color: var(--tg-theme-secondary-bg-color, #f0f0f0);
}

/* Cards */
.info-card {
    background-color: var(--tg-theme-bg-color, #fff);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.info-card h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 18px;
    color: var(--tg-theme-text-color, #000);
}

.info-text {
    font-size: 14px;
    color: var(--tg-theme-hint-color, #999);
    margin-bottom: 0;
}

/* Buttons */
.action-button {
    padding: 12px 16px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    background-color: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
    cursor: pointer;
    transition: opacity 0.2s;
}

.action-button:hover {
    opacity: 0.9;
}

.action-button:active {
    opacity: 0.7;
}

.action-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.action-button.primary {
    background-color: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
}

.action-button.secondary {
    background-color: var(--tg-theme-secondary-bg-color, #f0f0f0);
    color: var(--tg-theme-text-color, #000);
}

.action-button.active {
    background-color: #22c55e;
}

/* Stats Display */
.staking-stats,
.mining-stats {
    display: flex;
    justify-content: space-between;
    margin: 16px 0;
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--tg-theme-hint-color, #999);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #000);
}

/* Points and Tokens Display */
.points-display,
.tokens-display {
    text-align: center;
    font-size: 32px;
    font-weight: bold;
    margin: 16px 0;
    color: var(--tg-theme-text-color, #000);
}

/* Timeline */
.timeline {
    margin: 20px 0;
}

.timeline-item {
    display: flex;
    margin-bottom: 16px;
    position: relative;
}

.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 8px;
    top: 24px;
    height: calc(100% + 8px);
    width: 2px;
    background-color: var(--tg-theme-hint-color, #999);
}

.timeline-date {
    flex: 0 0 80px;
    font-weight: bold;
    position: relative;
}

.timeline-date::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--tg-theme-button-color, #2481cc);
    z-index: 1;
}

.timeline-content {
    flex: 1;
    padding-left: 20px;
}

/* Wallet Status */
.status-display {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    margin: 16px 0;
    padding: 10px;
    border-radius: 8px;
}

.status-display.connected {
    color: #22c55e;
    background-color: rgba(34, 197, 94, 0.1);
}

.status-display.not-connected {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
}

/* Token Info */
.token-info {
    display: flex;
    align-items: center;
    margin: 16px 0;
}

.token-logo {
    width: 64px;
    height: 64px;
    margin-right: 16px;
    flex-shrink: 0;
}

.token-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.token-details p {
    margin: 4px 0;
    font-size: 14px;
}

/* Wallets Grid */
.wallets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.wallet-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background-color: var(--tg-theme-secondary-bg-color, #f0f0f0);
    cursor: pointer;
    transition: transform 0.2s;
}

.wallet-option:hover {
    transform: translateY(-2px);
}

.wallet-option img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-bottom: 8px;
}

.wallet-option span {
    font-size: 12px;
    text-align: center;
}

/* Mining Activities */
.activities-list {
    margin: 16px 0;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background-color: var(--tg-theme-secondary-bg-color, #f0f0f0);
    margin-bottom: 12px;
}

.activity-icon {
    flex: 0 0 40px;
    font-size: 24px;
    text-align: center;
}

.activity-details {
    flex: 1;
    margin: 0 12px;
}

.activity-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.activity-progress {
    display: flex;
    align-items: center;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-right: 8px;
}

.progress {
    height: 100%;
    background-color: var(--tg-theme-button-color, #2481cc);
    border-radius: 4px;
}

.progress-text {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #999);
}

.activity-reward {
    font-weight: 600;
    color: #22c55e;
}

/* Mining Boosts */
.boosts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.boost-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background-color: var(--tg-theme-secondary-bg-color, #f0f0f0);
    text-align: center;
}

.boost-item.locked {
    opacity: 0.7;
}

.boost-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.boost-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.boost-effect {
    font-size: 12px;
    color: #22c55e;
    margin-bottom: 8px;
}

.boost-status {
    font-size: 12px;
    font-weight: 600;
    color: var(--tg-theme-hint-color, #999);
}

/* Staking Plans */
.staking-plans {
    margin-top: 20px;
}

.staking-plans h3 {
    font-size: 16px;
    margin-bottom: 10px;
    text-align: center;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media (max-width: 480px) {
    .plan-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

.plan-card {
    border: 1px solid var(--tg-theme-hint-color, rgba(0,0,0,0.1));
    border-radius: 8px;
    overflow: hidden;
}

.plan-header {
    background-color: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
    padding: 10px;
    text-align: center;
    font-weight: 500;
}

.plan-details {
    padding: 10px;
    text-align: center;
}

.plan-rate {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.plan-period, .plan-min {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #666);
    margin-bottom: 3px;
}

.plan-button {
    width: 100%;
    border: none;
    background-color: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
    padding: 8px;
    font-weight: 500;
    cursor: pointer;
}

/* Mining statistics and config */
.mining-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin: 15px 0;
}

.stat-item {
    flex: 1;
    min-width: 30%;
    margin: 5px;
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #666);
}

.stat-value {
    font-size: 16px;
    font-weight: 500;
    margin-top: 5px;
    color: var(--tg-theme-text-color, #000);
}

.config-section {
    margin: 15px 0;
}

.config-item {
    margin-bottom: 15px;
}

.config-item label {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
    color: var(--tg-theme-text-color, #000);
}

.slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--tg-theme-secondary-bg-color, #eee);
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--tg-theme-button-color, #2481cc);
    cursor: pointer;
}

.slider-value {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    margin-top: 5px;
    color: var(--tg-theme-text-color, #000);
}

/* Loading spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid var(--tg-theme-button-color, #2481cc);
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Airdrop task styles */
.tasks-list {
    margin-top: 15px;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--tg-theme-hint-color, rgba(0,0,0,0.1));
}

.task-item:last-child {
    border-bottom: none;
}

.task-icon {
    font-size: 24px;
    margin-right: 15px;
    min-width: 30px;
    text-align: center;
}

.task-details {
    flex: 1;
}

.task-title {
    font-weight: 500;
    font-size: 14px;
    color: var(--tg-theme-text-color, #000);
}

.task-desc {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #666);
    margin-top: 2px;
}

.task-progress {
    margin-top: 6px;
}

.progress-bar {
    height: 6px;
    background-color: var(--tg-theme-secondary-bg-color, #eee);
    border-radius: 3px;
    overflow: hidden;
    margin-right: 10px;
}

.progress {
    height: 100%;
    background-color: var(--tg-theme-button-color, #2481cc);
    border-radius: 3px;
}

.progress-text {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #666);
    margin-top: 2px;
}

.task-points {
    font-size: 12px;
    font-weight: bold;
    color: var(--tg-theme-button-color, #2481cc);
    white-space: nowrap;
    margin-left: 10px;
}

.task-status {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 10px;
    margin-top: 6px;
}

.task-status.completed {
    background-color: rgba(52, 199, 89, 0.1);
    color: #34c759;
}

.task-status.not-completed {
    background-color: rgba(255, 149, 0, 0.1);
    color: #ff9500;
}

/* Referral box */
.referral-box {
    display: flex;
    margin: 15px 0;
}

.referral-box input {
    flex: 1;
    border: 1px solid var(--tg-theme-hint-color, rgba(0,0,0,0.2));
    border-radius: 8px 0 0 8px;
    padding: 10px;
    background-color: var(--tg-theme-secondary-bg-color, #f5f5f5);
    color: var(--tg-theme-text-color, #000);
}

.copy-button {
    border: none;
    background-color: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
    padding: 0 15px;
    border-radius: 0 8px 8px 0;
    font-weight: 500;
    cursor: pointer;
}

/* Airdrop status */
.airdrop-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin: 15px 0;
}

.status-item {
    flex: 1;
    min-width: 30%;
    margin: 5px;
    text-align: center;
}

.status-label {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #666);
}

.status-value {
    font-size: 18px;
    font-weight: 500;
    margin-top: 5px;
    color: var(--tg-theme-text-color, #000);
}

.status-value.active {
    color: #34c759;
}

/* Dark mode adjustments */
.dark .info-card,
.dark .navigation-section {
    background-color: var(--tg-theme-bg-color, #1c1c1e);
}

.dark .wallet-option,
.dark .activity-item,
.dark .boost-item,
.dark .stake-item {
    background-color: var(--tg-theme-secondary-bg-color, #2c2c2e);
}

.dark .plan-description {
    background-color: var(--tg-theme-bg-color, #1c1c1e);
}

/* Mobile optimizations for all pages */
@media (max-width: 480px) {
    .page-container {
        padding: 10px;
        padding-bottom: 70px;
    }
    
    .page-header h1 {
        font-size: 22px;
    }
    
    .info-card {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .info-card h2 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .action-button {
        padding: 10px 14px;
        font-size: 15px;
    }
    
    .points-display,
    .tokens-display {
        font-size: 26px;
        margin: 12px 0;
    }
    
    .navigation-section {
        margin-bottom: 15px;
        padding: 8px;
    }
    
    .nav-link {
        padding: 6px 8px;
        font-size: 13px;
    }
    
    /* Timeline adjustments for mobile */
    .timeline-date {
        flex: 0 0 60px;
        font-size: 14px;
    }
    
    .timeline-content {
        font-size: 14px;
        padding-left: 15px;
    }
    
    /* Modal adjustments for mobile */
    .modal-content {
        width: 95%;
        padding: 15px;
        max-height: 85vh;
    }
    
    .close-button {
        top: 10px;
        right: 10px;
    }
    
    .form-group input,
    .form-group select {
        padding: 10px;
        font-size: 14px;
    }
    
    /* Ensure proper vertical scroll */
    body {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* For smooth scrolling on iOS */
    }
    
    /* Fix for sticky footer in iPhone */
    .footer {
        position: fixed;
        bottom: env(safe-area-inset-bottom, 1px);
        right: 5px;
    }
}

/* Ultra small device optimizations */
@media (max-width: 360px) {
    .page-header {
        padding: 12px 12px 4px;
    }
    
    .content-section {
        padding: 4px 12px;
    }
    
    .info-card {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .navigation-section {
        margin: 8px 12px;
        padding: 8px;
    }
    
    .page-header h1 {
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .points-display,
    .tokens-display {
        font-size: 22px;
    }
    
    .navigation-section {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        gap: 5px;
    }
    
    .nav-link {
        font-size: 12px;
        white-space: nowrap;
    }
    
    /* Further compress content */
    .info-card {
        padding: 10px;
    }
}

/* Add safe areas for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .page-container {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
    
    .footer {
        bottom: calc(env(safe-area-inset-bottom) + 1px);
    }
}

/* Optimizations for any page that's too long */
.content-section {
    overflow-y: auto;
}

/* Add styling for the Telegram notice in game page */
.telegram-notice {
    text-align: center;
    padding: 12px;
    background-color: var(--tg-theme-secondary-bg-color, #f0f0f0);
    border-radius: 10px;
    color: var(--tg-theme-text-color, #000000);
    font-weight: 500;
    margin: 0 auto;
    width: 100%;
}

.dark .telegram-notice {
    background-color: var(--tg-theme-secondary-bg-color, #2c2c2e);
}

/* Improve spacing for mobile devices */
.page-header {
    padding: 16px 16px 8px;
    margin-bottom: 8px;
}

.content-section {
    padding: 8px 16px;
}

.info-card {
    margin-bottom: 16px;
    padding: 16px;
}

/* Adjust the navigation section for better mobile viewing */
.navigation-section {
    margin: 12px 16px;
    padding: 10px;
}

/* Optimize for small screens */
@media (max-width: 360px) {
    .page-header {
        padding: 12px 12px 4px;
    }
    
    .content-section {
        padding: 4px 12px;
    }
    
    .info-card {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .navigation-section {
        margin: 8px 12px;
        padding: 8px;
    }
}

/* Ensure proper spacing at the top of page container */
.page-container {
    padding-top: 8px;
}

/* Make loading overlay text more visible on mobile */
#loading-overlay {
    font-size: 16px;
}

/* Adjust action buttons spacing */
.actions-section {
    margin: 12px 16px 16px;
}

/* Section Objects */
.object-section {
    width: 100%;
    height: 180px;
    position: relative;
    overflow: hidden;
    margin: 10px 0;
    border-radius: 8px;
    background-color: var(--tg-theme-secondary-bg-color, #f5f5f5);
}

.object-section canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Game Results Box styles */
.game-results-box {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 8px;
    margin: 10px auto;
    padding: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.game-results-header {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #FFD700; /* Gold color for header */
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 8px;
}

.game-results-row {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
}

.result-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.result-value {
    font-size: 14px;
    font-weight: bold;
    color: white;
}

#total-points-display {
    color: #FFD700; /* Gold color for total points */
}