html, body {
    touch-action: pan-x pan-y;
}

.button {
    height:200px;
    width:200px;
    touch-action: manipulation;
}

/* Save/Load Buttons */
#saveload {
    margin-top: 20px;
}

.saveload-btn {
    padding: 10px 20px;
    margin-right: 10px;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid #666;
    border-radius: 4px;
    background-color: #f0f0f0;
}

.saveload-btn:hover {
    background-color: #e0e0e0;
}

/* Main Layout */
#main-container {
    padding: 20px;
    padding-bottom: 60px;
}

/* Engineer Sidebar */
#engineer-sidebar {
    background-color: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

#engineer-sidebar h2 {
    margin-top: 0;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
}

#engineer-sidebar h3 {
    margin-bottom: 10px;
    color: #555;
}

.engineer-card {
    background: white;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.engineer-card.hired {
    border-left: 4px solid #4CAF50;
}

.engineer-card.available {
    border-left: 4px solid #2196F3;
}

.engineer-info {
    flex: 1;
}

.engineer-info strong {
    font-size: 14px;
}

.engineer-stats {
    font-size: 11px;
    color: #666;
}

.hire-btn, .fire-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.hire-btn {
    background-color: #4CAF50;
    color: white;
}

.hire-btn:hover {
    background-color: #45a049;
}

.fire-btn {
    background-color: #f44336;
    color: white;
}

.fire-btn:hover {
    background-color: #da190b;
}

.no-engineers {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* News Ticker */
#ticker-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background-color: #1a1a1a;
    overflow: hidden;
    border-top: 2px solid #333;
}

#ticker {
    display: flex;
    white-space: nowrap;
    animation: ticker-scroll 30s linear infinite;
    padding-top: 6px;
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.ticker-item {
    font-family: "Courier New", monospace;
    font-size: 24px;
    padding: 0 40px;
    display: inline-block;
}

.ticker-news {
    color: white;
}

.ticker-price {
    color: #00ff00;
}

.ticker-cantaloupe {
    color: orange;
}

.ticker-ad {
    color: #0066ff;
    cursor: pointer;
    text-decoration: underline;
}

.ticker-ad:hover {
    color: #3399ff;
}

.ticker-ad.clicked {
    color: purple;
}

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

/* Level Display */
#level-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

#level-name {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
}

#level-progress-container {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 5px;
}

#level-progress {
    background: linear-gradient(90deg, #00ff88 0%, #00d4ff 100%);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease-out;
    border-radius: 10px;
}

#level-progress-text {
    font-size: 12px;
    opacity: 0.9;
}

/* Stat Value with Delta */
.stat-value {
    position: relative;
    display: inline-block;
}

/* Ephemeral Delta Displays */
.delta-display {
    position: absolute;
    font-size: 14px;
    font-weight: bold;
    margin-left: 10px;
    opacity: 0;
    pointer-events: none;
}

.delta-positive {
    color: #00cc00;
}

.delta-negative {
    color: #ff4444;
}

.delta-animate {
    animation: delta-fade 1s ease-out forwards;
}

@keyframes delta-fade {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Overlay Modals */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.overlay-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    animation: overlay-pop 0.3s ease-out;
}

@keyframes overlay-pop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.overlay-content h2 {
    margin-top: 0;
    font-size: 28px;
}

.overlay-btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transition: transform 0.1s;
}

.overlay-btn:hover {
    transform: scale(1.05);
}

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

.bankruptcy-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    color: white;
}

.bankruptcy-content h2 {
    color: #ff4444;
    font-size: 36px;
}

.restart-btn {
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
}

/* Sticky Notes */
#sticky-notes-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    pointer-events: none;
}

.sticky-note {
    position: absolute;
    width: 220px;
    min-height: 140px;
    background: #ffffa5;
    border-radius: 4px;
    box-shadow: 3px 3px 12px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    animation: sticky-pop 0.3s ease-out;
}

@keyframes sticky-pop {
    0% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.sticky-note-header {
    background: linear-gradient(180deg, #e6e600 0%, #cccc00 100%);
    padding: 4px 8px;
    border-radius: 4px 4px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

.sticky-note-title {
    font-size: 12px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.sticky-note-close {
    width: 20px;
    height: 20px;
    background: #ff6b6b;
    border: none;
    border-radius: 3px;
    color: white;
    font-size: 14px;
    line-height: 18px;
    cursor: pointer;
    padding: 0;
    margin-left: 5px;
}

.sticky-note-close:hover {
    background: #ff4444;
}

.sticky-note-body {
    padding: 12px;
    font-size: 15px;
    font-weight: bold;
    color: #333;
    text-align: center;
    word-wrap: break-word;
}

/* Discoveries Sidebar */
#discoveries-sidebar {
    width: 250px;
    background-color: #f9f5e8;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #d4c9a8;
}

#discoveries-sidebar h2 {
    margin-top: 0;
    border-bottom: 2px solid #8b7355;
    padding-bottom: 10px;
    color: #5c4a32;
}

.discovery-card {
    background: white;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #d4c9a8;
}

.discovery-card.unlocked {
    border-left: 4px solid #4CAF50;
    background: #f0fff0;
}

.discovery-card.locked {
    border-left: 4px solid #999;
    opacity: 0.7;
}

.discovery-title {
    font-weight: bold;
    font-size: 13px;
    color: #333;
}

.discovery-author {
    font-size: 11px;
    color: #666;
    font-style: italic;
}

.discovery-effect {
    font-size: 11px;
    color: #4CAF50;
    margin-top: 5px;
}

.discovery-progress {
    margin-top: 8px;
}

.discovery-progress-bar {
    background: #ddd;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.discovery-progress-fill {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    height: 100%;
    transition: width 0.3s ease;
}

.discovery-progress-text {
    font-size: 10px;
    color: #666;
    text-align: center;
    margin-top: 2px;
}

/* Shop Sidebar */
#shop-sidebar {
    background-color: #e8f4f8;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #b8d4e3;
}

#shop-sidebar h2 {
    margin-top: 0;
    border-bottom: 2px solid #2196F3;
    padding-bottom: 10px;
    color: #1565C0;
}

#shop-sidebar h3 {
    margin-bottom: 10px;
    color: #555;
}

.saas-card {
    background: white;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.saas-card.subscribed {
    border-left: 4px solid #4CAF50;
}

.saas-card.available {
    border-left: 4px solid #2196F3;
}

.saas-info {
    margin-bottom: 8px;
}

.saas-info strong {
    font-size: 14px;
    color: #333;
}

.saas-description {
    font-size: 11px;
    color: #666;
    display: block;
    margin: 4px 0;
}

.saas-cost {
    font-size: 11px;
    color: #e65100;
}

.saas-effect {
    font-size: 11px;
    color: #4CAF50;
    font-weight: bold;
}

.subscribe-btn, .cancel-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    width: 100%;
}

.subscribe-btn {
    background-color: #2196F3;
    color: white;
}

.subscribe-btn:hover {
    background-color: #1976D2;
}

.subscribe-btn.disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.cancel-btn {
    background-color: #ff9800;
    color: white;
}

.cancel-btn:hover {
    background-color: #f57c00;
}

.no-saas {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 10px;
}

/* Upgrades Panel */
#upgrades-panel {
    margin-top: 20px;
    padding: 15px;
    background-color: #f0f8e8;
    border-radius: 8px;
    border: 1px solid #c5e1a5;
}

#upgrades-panel h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #558b2f;
}

#upgrade-stats {
    margin-bottom: 10px;
    padding: 8px;
    background: white;
    border-radius: 4px;
    font-size: 14px;
}

.upgrade-formula {
    color: #888;
    font-size: 12px;
}

.upgrade-card {
    background: white;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upgrade-card.purchased {
    border-left: 4px solid #4CAF50;
    background: #f0fff0;
    padding: 8px 10px;
}

.upgrade-card.available {
    border-left: 4px solid #8bc34a;
}

.upgrade-info {
    flex: 1;
}

.upgrade-info strong {
    font-size: 13px;
}

.upgrade-description {
    font-size: 11px;
    color: #666;
    display: block;
    margin: 2px 0;
}

.upgrade-effect {
    font-size: 12px;
    color: #4CAF50;
    font-weight: bold;
}

.buy-upgrade-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    background-color: #8bc34a;
    color: white;
}

.buy-upgrade-btn:hover {
    background-color: #7cb342;
}

.buy-upgrade-btn.disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.no-upgrades {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 8px;
    font-size: 12px;
}

/* Constants Panel */
#constants-panel {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background-color: #fff3e0;
    border-radius: 8px;
    border: 1px solid #ffcc80;
}

#constants-panel h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #e65100;
    border-bottom: 2px solid #ffcc80;
    padding-bottom: 8px;
}

.constant-card {
    background: white;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 6px;
    border: 1px solid #ffcc80;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.constant-label {
    font-weight: bold;
    font-size: 13px;
    color: #333;
}

.constant-description {
    font-size: 11px;
    color: #666;
}

.constant-input {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    width: 120px;
}

.constant-input:focus {
    outline: none;
    border-color: #ff9800;
    box-shadow: 0 0 3px rgba(255, 152, 0, 0.3);
}

/* Tech Debt Upgrades */
.td-upgrades-header {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #c5e1a5;
    color: #d84315;
}

.upgrade-card.td-upgrade {
    border-left-color: #ff7043;
}

.upgrade-card.td-upgrade.purchased {
    border-left-color: #4CAF50;
    background: #fff3e0;
}

.upgrade-effect.td-effect {
    color: #d84315;
}

.buy-upgrade-btn.td-btn {
    background-color: #ff7043;
}

.buy-upgrade-btn.td-btn:hover {
    background-color: #f4511e;
}

/* Tooltip Styles */
.brrnout-tooltip {
    position: absolute;
    background: #222;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    max-width: 280px;
    z-index: 2000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.brrnout-tooltip::before {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0 8px;
    border-style: solid;
    border-color: #222 transparent transparent transparent;
}

.brrnout-tooltip.tooltip-below::before {
    bottom: auto;
    top: -8px;
    border-width: 0 8px 8px 8px;
    border-color: transparent transparent #222 transparent;
}

.brrnout-tooltip strong {
    color: #fff;
    display: block;
    margin-bottom: 4px;
}

/* Mobile Responsive */
@media (max-width: 767px) {
    .button {
        height: 100px;
        width: 100px;
        font-size: 14px;
    }

    #playbuttons {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    #ticker-container {
        height: 30px;
    }

    .ticker-item {
        font-size: 14px;
        padding: 0 20px;
    }

    #ticker {
        padding-top: 4px;
    }

    #level-name {
        font-size: 18px;
    }

    .sticky-note {
        width: 180px;
        min-height: 100px;
    }

    #main-container {
        padding: 10px;
        padding-bottom: 50px;
    }

    #engineer-sidebar,
    #shop-sidebar {
        margin-top: 20px;
    }

    .overlay-content {
        padding: 20px;
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .saveload-btn {
        padding: 12px 16px;
        margin-bottom: 8px;
    }

    .hire-btn, .fire-btn {
        padding: 12px 20px;
    }

    .subscribe-btn, .cancel-btn,
    .buy-upgrade-btn {
        padding: 10px 16px;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991px) {
    .button {
        height: 150px;
        width: 150px;
    }

    #engineer-sidebar,
    #shop-sidebar {
        margin-top: 20px;
    }
}
