body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1400px;
    margin: 20px auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    padding: 20px;
    min-height: 100vh;
}
#game-start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
}
.start-screen-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 480px;
    max-width: calc(100vw - 40px);
    margin: 20px auto;
    box-sizing: border-box;
}
.start-screen-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
}
.start-screen-form {
    flex: 1;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Make all form inputs fit dynamically */
.start-screen-form input[type="number"],
.start-screen-form input[type="date"],
.start-screen-form select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.start-screen-form input[type="number"]:focus,
.start-screen-form input[type="date"]:focus,
.start-screen-form select:focus {
    outline: none;
    border-color: #4682B4;
    box-shadow: 0 0 3px rgba(70, 130, 180, 0.3);
}

.start-screen-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    width: 100%;
    box-sizing: border-box;
}

.start-screen-form > div {
    width: 100%;
    box-sizing: border-box;
}

#kids-ages-inputs input[type="number"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#state-selection-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#us-map-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.start-screen-content h2 {
    color: #4682B4;
    margin-top: 0;
    margin-bottom: 10px;
    word-wrap: break-word;
}
.container {
    background-color: #FFFFFF;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 100px);
    max-height: 900px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    width: 480px;
    margin-left: auto;
    margin-right: auto;
    border-left: 2px solid #4682B4;
    border-right: 2px solid #4682B4;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

.container > * {
    border-radius: 8px;
}
h1 {
    color: #4682B4;
    font-size: 20px;
    margin-bottom: 5px;
    margin-top: 5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}
#game-container {
    display: flex;
    width: 100%;
    gap: 20px;
    flex: 1;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
    align-items: flex-start;
    height: 100%;
    margin-top: 8px;
    justify-content: flex-start;
}
#left-sidebar {
    width: 480px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    flex-shrink: 0;
    box-sizing: border-box;
    max-height: 100%;
    flex: 0 0 auto;
    -webkit-overflow-scrolling: touch;
}
#right-sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    min-height: 0;
    flex-shrink: 0;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
    -webkit-overflow-scrolling: touch;
}

#bookkeeping {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    max-height: 100%;
}

#bookkeeping-transactions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.bookkeeping-entry {
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
    border-left: 3px solid;
}

.bookkeeping-entry.income {
    background: #E8F5E9;
    border-left-color: #4CAF50;
}

.bookkeeping-entry.expense {
    background: #FFEBEE;
    border-left-color: #d32f2f;
}

.bookkeeping-entry-date {
    color: #666;
    font-size: 12px;
    margin-bottom: 2px;
}

.bookkeeping-entry-amount {
    font-weight: bold;
    float: right;
}

#main-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    max-width: 100%;
    max-height: 100%;
}
#debug-log {
    background: linear-gradient(135deg, #E6E6FA 0%, #D8BFD8 100%);
    border-radius: 10px;
    font-size: 12px;
    color: #2F4F4F;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    width: 480px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
    flex-shrink: 0;
    max-width: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
    margin: 0;
}
#debug-log-header {
    background: linear-gradient(135deg, #800080 0%, #9C27B0 100%);
    color: #FFFFFF;
    padding: 10px 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
#debug-log-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 15px;
    display: block;
    min-height: 0;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
}
#debug-log-content.expanded {
    display: block;
}
#debug-log p {
    margin: 3px 0;
    padding: 2px 0;
    border-bottom: 1px solid rgba(128, 0, 128, 0.1);
    font-size: 11px;
}
.highlight-bar {
    background: linear-gradient(135deg, #FFF9C4 0%, #FFE082 100%);
    padding: 5px 8px;
    border-radius: 6px;
    margin-bottom: 5px;
    font-size: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    width: 480px;
    max-width: 100%;
    box-sizing: border-box;
}
.highlight-bar strong {
    color: #F57C00;
    font-size: 11px;
}
.tab-button {
    width: 100%;
    max-width: 100%;
    padding: 6px 8px;
    background: linear-gradient(135deg, #4682B4 0%, #4169E1 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    margin-bottom: 0;
    transition: all 0.3s ease;
    text-align: left;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
}

.tab-button > span:first-child {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tab-button:hover {
    background: linear-gradient(135deg, #4169E1 0%, #4682B4 100%);
    transform: translateX(3px);
}
.tab-button.active {
    background: linear-gradient(135deg, #2E7D32 0%, #4CAF50 100%);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
.tab-button .tab-stats {
    font-size: 9px;
    font-weight: normal;
    opacity: 0.9;
    margin-left: 4px;
    margin-top: 0;
    white-space: nowrap;
    flex-shrink: 0;
}
.tab-content {
    display: none !important;
    background: linear-gradient(135deg, #F5F5F5 0%, #E0E0E0 100%);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

.tab-content.active {
    display: block !important;
}

#tab-content-container {
    display: none;
}

#tab-bank-content {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 100%;
    -webkit-overflow-scrolling: touch;
}
.tab-content.active {
    display: flex !important;
    flex-direction: column;
    min-height: 0;
}
#tab-planner-content {
    background: linear-gradient(135deg, #C1E1C1 0%, #90EE90 100%);
}
.tabs-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    flex-shrink: 0;
    width: 480px;
    max-width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    max-height: 100%;
    -webkit-overflow-scrolling: touch;
}
#stats-education-container {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
#stats {
    background: linear-gradient(135deg, #E6F0FA 0%, #B0E0E6 100%);
    padding: 10px;
    border-radius: 10px;
    font-size: 11px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 100%;
    width: 480px;
    max-width: 100%;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}
#stats h2 {
    color: #4682B4;
    font-size: 14px;
    margin: 0 0 6px;
    border-bottom: 2px solid #4682B4;
    padding-bottom: 3px;
}
#stats p {
    margin: 2px 0;
    color: #2F4F4F;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
}
#stats span {
    font-weight: bold;
    color: #4682B4;
}
#career-planner-container {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
#planner {
    flex: 1;
    min-width: 300px;
    background: linear-gradient(135deg, #C1E1C1 0%, #90EE90 100%);
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
#planner h2 {
    color: #355E3B;
    font-size: 14px;
    margin: 0 0 10px;
    border-bottom: 2px solid #355E3B;
    padding-bottom: 5px;
}
#planner label {
    display: block;
    margin: 8px 0 5px;
    color: #355E3B;
    font-weight: 500;
}
#planner input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 2px solid #4682B4;
    border-radius: 5px;
    background-color: #FFFFFF;
    color: #333;
    font-size: 14px;
}
#planner input:focus {
    outline: none;
    border-color: #4169E1;
    box-shadow: 0 0 5px rgba(65, 105, 225, 0.3);
}
#planner select {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 2px solid #4682B4;
    border-radius: 5px;
    background-color: #FFFFFF;
    color: #333;
    font-size: 14px;
}
#planner select:focus {
    outline: none;
    border-color: #4169E1;
    box-shadow: 0 0 5px rgba(65, 105, 225, 0.3);
}
#education-section {
    flex: 1;
    min-width: 300px;
    background: linear-gradient(135deg, #FFF4E6 0%, #FFE0B2 100%);
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
#career-section {
    flex: 1;
    min-width: 300px;
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
#career-section h2 {
    color: #2E7D32;
    font-size: 14px;
    margin: 0 0 10px;
    border-bottom: 2px solid #2E7D32;
    padding-bottom: 5px;
}
#career-section label {
    display: block;
    margin: 8px 0 5px;
    color: #2E7D32;
    font-weight: 500;
}
#career-section select {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 2px solid #4682B4;
    border-radius: 5px;
    background-color: #FFFFFF;
    color: #333;
    font-size: 14px;
}
.career-info {
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 5px;
    margin: 10px 0;
    font-size: 12px;
}
.career-position {
    padding: 5px;
    margin: 3px 0;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    border-left: 3px solid #4CAF50;
}
.career-position.unavailable {
    opacity: 0.6;
    border-left-color: #CCCCCC;
    background-color: rgba(200, 200, 200, 0.3);
    color: #666;
}
.career-position.available {
    border-left-color: #FF9800;
    cursor: pointer;
}
.career-position.current {
    border-left-color: #2196F3;
    font-weight: bold;
}
.position-requirements {
    font-size: 11px;
    color: #666;
    margin-top: 3px;
}
#bank-section {
    background: linear-gradient(135deg, #FFF9C4 0%, #FFE082 100%);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
#bank-section h2 {
    color: #F57C00;
    font-size: 14px;
    margin: 0 0 10px;
    border-bottom: 2px solid #F57C00;
    padding-bottom: 5px;
}
#bank-section label {
    display: block;
    margin: 8px 0 5px;
    color: #F57C00;
    font-weight: 500;
}
#bank-section select, #bank-section input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 2px solid #4682B4;
    border-radius: 5px;
    background-color: #FFFFFF;
    color: #333;
    font-size: 14px;
}
.loan-info {
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 5px;
    margin: 10px 0;
    font-size: 12px;
}
.active-loan {
    padding: 5px;
    margin: 3px 0;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    border-left: 3px solid #F57C00;
}
.loan-type {
    font-weight: bold;
    color: #F57C00;
}
.interest-rate {
    color: #C62828;
    font-weight: bold;
}
#education-section h2 {
    color: #E65100;
    font-size: 14px;
    margin: 0 0 10px;
    border-bottom: 2px solid #E65100;
    padding-bottom: 5px;
}
#education-section label {
    display: block;
    margin: 8px 0 5px;
    color: #E65100;
    font-weight: 500;
}
#education-status {
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 5px;
    margin: 10px 0;
    font-weight: bold;
}
#education-status.enrolled {
    color: #2E7D32;
}
#education-status.not-enrolled {
    color: #C62828;
}
#total-hours {
    font-weight: bold;
    margin-top: 10px;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    text-align: center;
}
#total-hours.over {
    color: #FF0000;
    background-color: rgba(255, 200, 200, 0.5);
}
#total-hours.valid {
    color: #355E3B;
}
button {
    display: block;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #4682B4 0%, #4169E1 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    margin: 10px 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}
button:hover:not(:disabled) {
    background: linear-gradient(135deg, #4169E1 0%, #4682B4 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
}
button:active:not(:disabled) {
    transform: translateY(0);
}
button:disabled {
    background: #CCCCCC;
    cursor: not-allowed;
    opacity: 0.6;
}
#update-total {
    width: auto;
    margin: 10px 0;
    padding: 8px 20px;
    font-size: 14px;
    background: linear-gradient(135deg, #355E3B 0%, #2E4D2E 100%);
}
#update-total:hover:not(:disabled) {
    background: linear-gradient(135deg, #2E4D2E 0%, #355E3B 100%);
}
.stat-bar {
    display: flex;
    align-items: center;
    margin: 4px 0;
}
.stat-bar-label {
    min-width: 60px;
}
.stat-bar-fill {
    flex: 1;
    height: 14px;
    background-color: #E0E0E0;
    border-radius: 7px;
    margin: 0 5px;
    overflow: hidden;
    position: relative;
}
.stat-bar-value {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 100%);
    transition: width 0.3s ease;
}
.stat-bar-value.health {
    background: linear-gradient(90deg, #F44336 0%, #FF9800 100%);
}
.stat-bar-value.energy {
    background: linear-gradient(90deg, #2196F3 0%, #03A9F4 100%);
}
.stat-bar-value.happiness {
    background: linear-gradient(90deg, #FFC107 0%, #FFEB3B 100%);
}
.stat-bar-value.balance {
    background: linear-gradient(90deg, #9C27B0 0%, #E91E63 100%);
}

/* Unlock animation for newly available jobs */
@keyframes unlockPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
        transform: scale(1);
    }
}

.career-position.newly-unlocked {
    border: 2px solid #4CAF50;
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
}

/* Mobile responsive - improved phone interface */
@media (max-width: 768px) {
    body {
        padding: 5px;
        margin: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .container {
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        width: 100%;
        min-width: 0;
        padding: 10px;
        height: calc(100vh - 10px);
        max-height: calc(100vh - 10px);
        border-radius: 10px;
        box-sizing: border-box;
    }
    
    h1 {
        font-size: 16px;
        margin: 5px 0;
    }
    
    #game-container {
        overflow-x: hidden;
        overflow-y: visible;
        flex-wrap: wrap;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        min-width: 0;
        gap: 10px;
        flex-direction: column;
    }
    
    #left-sidebar {
        flex-shrink: 0;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        font-size: 12px;
        gap: 6px;
        box-sizing: border-box;
    }
    
    #right-sidebar,
    #debug-log {
        flex-shrink: 0;
        min-width: 250px;
        width: 250px;
    }
    
    #main-content {
        flex-shrink: 0;
        min-width: 300px;
        flex: 1;
    }
    
    /* Tab buttons - make them scrollable on mobile */
    .tabs-container {
        grid-template-columns: 1fr 1fr;
        gap: 4px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .tab-button {
        min-width: 0;
        width: 100%;
        max-width: 100%;
        font-size: 10px;
        padding: 6px 8px;
        white-space: nowrap;
        box-sizing: border-box;
    }
    
    /* Stats section - more compact */
    #stats {
        font-size: 11px;
        padding: 10px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    #stats h2 {
        font-size: 14px;
        margin: 0 0 8px 0;
    }
    
    #stats p {
        font-size: 11px;
        margin: 4px 0;
        line-height: 1.3;
    }
    
    /* Tab content - better spacing */
    .tab-content {
        padding: 10px;
        font-size: 12px;
    }
    
    .tab-content h2 {
        font-size: 16px;
        margin: 0 0 10px 0;
    }
    
    /* Buttons - touch-friendly */
    button {
        min-height: 36px;
        padding: 8px 12px;
        font-size: 12px;
        touch-action: manipulation;
    }
    
    /* Inputs and sliders - larger touch targets */
    input[type="range"] {
        min-height: 36px;
    }
    
    input[type="number"],
    input[type="text"],
    select {
        min-height: 36px;
        font-size: 14px;
        padding: 8px;
    }
    
    /* Start screen - mobile optimized */
    .start-screen-content {
        padding: 15px;
        width: 95%;
        max-width: 100%;
        margin: 10px auto;
        box-sizing: border-box;
    }
    
    .start-screen-wrapper {
        flex-direction: column;
        gap: 15px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .start-screen-form {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .start-screen-form input[type="number"],
    .start-screen-form input[type="date"],
    .start-screen-form select {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        font-size: 14px;
        padding: 10px;
    }
    
    #us-map-container {
        height: 300px !important;
    }
    
    
    /* Banner - compact on mobile */
    #banner-state-info {
        font-size: 9px;
        padding: 4px 6px;
    }
    
    /* Game log - smaller font */
    #debug-log-content {
        font-size: 10px;
        padding: 8px;
    }
    
    /* Expense categories - stack better */
    .expense-category {
        padding: 8px;
        margin-bottom: 8px;
    }
    
    /* Planning sliders - more compact */
    #weekly-planner label {
        font-size: 11px;
    }
    
    #weekly-planner input[type="range"] {
        width: 100%;
    }
}

/* Extra small phones */
@media (max-width: 480px) {
    body {
        padding: 3px;
    }
    
    .container {
        padding: 8px;
        height: calc(100vh - 6px);
        max-height: calc(100vh - 6px);
    }
    
    h1 {
        font-size: 14px;
    }
    
    #left-sidebar {
        min-width: 0;
        width: 100%;
        max-width: 100%;
        font-size: 11px;
        box-sizing: border-box;
    }
    
    #stats {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .tabs-container {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .tab-button {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .highlight-bar {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    #right-sidebar,
    #debug-log {
        min-width: 220px;
        width: 220px;
    }
    
    .tab-button {
        min-width: 70px;
        font-size: 10px;
        padding: 5px 8px;
    }
    
    #stats {
        padding: 8px;
        font-size: 10px;
    }
    
    #stats h2 {
        font-size: 12px;
    }
    
    #stats p {
        font-size: 10px;
        margin: 3px 0;
    }
    
    .tab-content {
        padding: 8px;
        font-size: 11px;
    }
    
    .tab-content h2 {
        font-size: 14px;
    }
    
    button {
        min-height: 40px;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* Hide less critical info on very small screens */
    #banner-state-info {
        display: none;
    }
    
    .tab-stats {
        display: none; /* Hide stats in tab buttons on very small screens */
    }
}

/* Landscape phone orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        height: calc(100vh - 10px);
    }
    
    #game-container {
        flex-direction: row;
    }
    
    #left-sidebar {
        width: 200px;
        min-width: 200px;
    }
    
    #right-sidebar,
    #debug-log {
        width: 220px;
        min-width: 220px;
    }
}

/* Tab Modal Styles */
.tab-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.tab-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tab-modal-footer {
    padding: 15px 20px;
    background: #f5f5f5;
    border-top: 1px solid #ddd;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.tab-modal-footer button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-modal-footer .next-week-btn {
    background: #4CAF50;
    color: white;
}

.tab-modal-footer .next-week-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.tab-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #4682B4 0%, #4169E1 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.tab-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: white;
}

.tab-modal-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    padding: 0;
    line-height: 1;
}

.tab-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.tab-modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

/* Mobile modal adjustments */
@media (max-width: 768px) {
    .tab-modal-overlay {
        padding: 10px;
    }
    
    .tab-modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 8px;
    }
    
    .tab-modal-header {
        padding: 15px;
        border-radius: 8px 8px 0 0;
    }
    
    .tab-modal-header h2 {
        font-size: 18px;
    }
    
    .tab-modal-body {
        padding: 15px;
    }
    
    .tab-modal-footer {
        padding: 10px 15px;
        flex-direction: column;
    }
    
    .tab-modal-footer button {
        width: 100%;
    }
}

/* Tooltip Icon Styles */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    cursor: help;
    position: relative;
    vertical-align: middle;
    line-height: 1;
    font-size: 14px;
}

/* Slider Styles - Red when unbalanced */
input[type="range"].unbalanced {
    accent-color: #d32f2f;
}

input[type="range"].unbalanced::-webkit-slider-thumb {
    background: #d32f2f;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(211, 47, 47, 0.4);
}

input[type="range"].unbalanced::-moz-range-thumb {
    background: #d32f2f;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(211, 47, 47, 0.4);
}

.tooltip-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 5px;
    padding: 8px 12px;
    background: #333;
    color: white;
    border-radius: 6px;
    font-size: 11px;
    white-space: normal;
    width: 250px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    pointer-events: none;
}

.tooltip-icon:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: -1px;
    border: 5px solid transparent;
    border-top-color: #333;
    z-index: 1001;
    pointer-events: none;
}

