/* твой CSS без изменений */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    padding: 20px;
    box-sizing: border-box;
    transition: opacity 0.3s ease;

    /* CSS Variables for theming - Default (Space) theme */
    --bg-from: #0a0e27;
    --bg-to: #1a1f3a;
    --text-primary: #00ff88;
    --text-secondary: #00ddff;
    --panel-bg: rgba(10, 20, 40, 0.8);
    --border-color: #00ff88;
    --shadow-color: rgba(0, 255, 136, 0.2);
    --shadow-glow: rgba(0, 255, 136, 0.3);

    background: linear-gradient(135deg, var(--bg-from) 0%, var(--bg-to) 100%);
    color: var(--text-primary);
}

/* Theme: Dark */
body.theme-dark {
    --bg-from: #000000;
    --bg-to: #1a1a1a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --panel-bg: rgba(20, 20, 20, 0.9);
    --border-color: #404040;
    --shadow-color: rgba(255, 255, 255, 0.1);
    --shadow-glow: rgba(255, 255, 255, 0.15);
}

.container {
    max-width: 1500px;
    width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    grid-template-rows: auto 1fr;
    column-gap: 20px;
    row-gap: 10px;
    height: 100%;
}

.right-panels {
    align-self: stretch;
    min-height: 0;
    overflow: hidden;
}

.mobile-settings-panel {
    display: none; /* Hidden on desktop, shown only on mobile with .mobile-visible */
}

.panel {
    background: var(--panel-bg);
    border: 2px solid var(--text-primary);
    border-radius: 8px;
    padding: 12px;
    overflow: hidden;
    box-shadow: 0 0 20px var(--shadow-color);
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    margin-right: -12px;
    padding-right: 12px;
}

.main-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
}

.log-panel {
    flex-shrink: 0;
    margin-top: auto;
    width: 100%;
    height: auto !important;
    display: block !important;
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.log-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.log-filters {
    display: flex;
    gap: 4px;
}

.log-filter {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--shadow-glow);
    color: var(--text-primary);
    width: 26px;
    height: 26px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: all 0.2s;
}

.log-filter.active {
    opacity: 1;
    background: var(--shadow-color);
    border-color: var(--text-primary);
}

.log-filter:hover {
    background: var(--shadow-glow);
}

h1 {
    font-family: 'Orbitron', sans-serif;
    color: var(--text-primary);
    text-align: center;
    font-size: 24px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px var(--text-primary);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h2 {
    font-family: 'Orbitron', sans-serif;
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--text-primary);
    padding-bottom: 5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stat-block {
    margin-bottom: 0;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--shadow-color);
}

.stat-block:last-child {
    border-bottom: none;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.stat-name {
    color: var(--text-secondary);
    font-weight: bold;
    font-size: 13px;
}

.stat-multiplier {
    color: #ffcc00;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
}

.stat-row {
    display: flex;
    gap: 6px;
    align-items: baseline;
    font-size: 11px;
    margin: 2px 0;
}

.stat-label {
    color: var(--text-secondary);
    opacity: 0.8;
}

.stat-exp {
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    font-weight: bold;
}

.stat-lvl {
    color: var(--text-secondary);
    margin-left: auto;
    font-size: 10px;
    opacity: 0.7;
}

.stat-bonus-tooltip {
    display: none;
    position: fixed;
    width: max-content;
    background: rgba(5, 10, 20, 0.97);
    border: 1px solid rgba(255, 204, 0, 0.4);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: #ddd;
    white-space: nowrap;
    z-index: 10000;
    font-family: 'JetBrains Mono', monospace;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7), 0 0 8px rgba(255, 204, 0, 0.15);
}

.stat-bonus-tooltip .tooltip-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 2px 0;
    line-height: 1.4;
}

.stat-bonus-tooltip .tooltip-value {
    color: #ffcc00;
    font-weight: bold;
}

.stat-sublabel {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 10px;
    margin-top: 4px;
    margin-bottom: 1px;
    opacity: 0.8;
}

.stat-bar {
    width: 100%;
    height: 6px;
    background: var(--shadow-color);
    border: 1px solid var(--text-primary);
    margin: 2px 0;
    border-radius: 3px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--text-primary), var(--text-secondary));
    transition: width 0.3s ease;
}

.stat-fill.permanent {
    background: linear-gradient(90deg, #ffd700, #ffaa00);
}

/* Resources section */
.resources-section {
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(180, 130, 255, 0.1);
    border: 1px solid rgba(180, 130, 255, 0.3);
    border-radius: 4px;
}

.resource-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.resource-icon {
    font-size: 16px;
}

.resource-name {
    color: #b482ff;
    font-size: 11px;
    flex: 1;
}

.resource-value {
    color: #e0c0ff;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(180, 130, 255, 0.5);
}

/* Inventory section */
.inventory-section {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.inventory-title {
    color: #ffd700;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.inventory-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, 32px);
    gap: 5px;
    max-height: 130px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.inventory-item {
    width: 32px;
    height: 32px;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid #ffd700;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.inventory-item:hover {
    background: rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    transform: scale(1.1);
}

.inventory-tooltip-global {
    position: fixed;
    background: rgba(10, 15, 30, 0.98);
    border: 1px solid #ffd700;
    border-radius: 4px;
    padding: 8px 12px;
    min-width: 150px;
    max-width: 300px;
    z-index: 10000;
    display: none;
    font-size: 11px;
    text-align: left;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    pointer-events: none;
}

.inventory-tooltip-global .item-name {
    color: #ffd700;
    font-weight: bold;
    margin-bottom: 5px;
    white-space: normal;
    word-wrap: break-word;
}

.inventory-tooltip-global .item-bonus {
    color: var(--text-primary);
    font-size: 10px;
    white-space: normal;
    word-wrap: break-word;
}

.scene {
    flex: 0 0 auto;
    background: rgba(20, 30, 60, 0.6);
    border: 2px solid var(--text-secondary);
    border-radius: 8px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 0 20px rgba(0, 221, 255, 0.2);
}

.scene-title {
    font-family: 'Orbitron', sans-serif;
    color: var(--text-secondary);
    font-size: 20px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px var(--text-secondary);
}

.scene-description {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.time-display {
    grid-column: 1 / -1;
}

.time-bar {
    width: 100%;
    height: 28px;
    background: var(--shadow-color);
    border: 1px solid var(--text-primary);
    border-radius: 3px;
    position: relative;
}

.time-fill {
    height: 100%;
    background: #0088ff;
    transition: width 0.1s linear;
    border-radius: 3px 0 0 3px;
    position: absolute;
    top: 0;
    left: 0;
}


.oxygen-text {
    font-family: 'Orbitron', sans-serif;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    text-shadow: 0 0 4px #000, 0 0 8px #000;
    font-weight: bold;
    font-size: 13px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    z-index: 2;
}

.oxygen-save-badge {
    color: #00ff64;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
}

.oxygen-save-tooltip {
    display: none;
    position: fixed;
    width: max-content;
    background: rgba(5, 10, 20, 0.97);
    border: 1px solid rgba(0, 255, 100, 0.4);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: #ddd;
    white-space: nowrap;
    z-index: 10000;
    font-family: 'JetBrains Mono', monospace;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7), 0 0 8px rgba(0, 255, 100, 0.15);
}

.oxygen-save-tooltip .tooltip-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 2px 0;
    line-height: 1.4;
}

.oxygen-save-tooltip .tooltip-value {
    color: #00ff64;
    font-weight: bold;
}

.nitrogen-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.nitrogen-bar {
    flex: 1;
    position: relative;
    height: 22px;
    background: rgba(0, 200, 255, 0.08);
    border: 1px solid rgba(0, 200, 255, 0.25);
    border-radius: 3px;
    overflow: hidden;
}

.nitrogen-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: rgba(0, 200, 255, 0.3);
    transition: width 0.3s ease;
}

.nitrogen-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    color: #66ccff;
    font-size: 11px;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    z-index: 1;
}

.nitro-btn {
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 12px;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid #ffaa00;
    background: rgba(255, 170, 0, 0.15);
    color: #ffaa00;
    transition: all 0.2s;
}

.nitro-btn:hover {
    background: rgba(255, 170, 0, 0.3);
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.4);
}

.nitro-btn.nitro-active {
    background: rgba(255, 170, 0, 0.4);
    box-shadow: 0 0 12px rgba(255, 170, 0, 0.6), inset 0 0 8px rgba(255, 170, 0, 0.2);
    color: #fff;
    animation: nitro-pulse 0.5s ease-in-out infinite alternate;
}

.nitro-btn:disabled {
    opacity: 0.3;
    cursor: default;
    box-shadow: none;
}

@keyframes nitro-pulse {
    from { box-shadow: 0 0 8px rgba(255, 170, 0, 0.4); }
    to { box-shadow: 0 0 16px rgba(255, 170, 0, 0.8); }
}

.activities-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    flex: 1;
    overflow-y: auto;
    width: 100%;
    max-width: 100%;
    align-items: start;
    align-content: start;
}

.activity-btn {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
    padding: 14px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 11px;
    transition: all 0.2s;
    position: relative;
    min-height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    text-align: left;
    align-items: stretch;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
}

.activity-btn:hover:not(:disabled) {
    background: var(--shadow-color);
    box-shadow: 0 0 10px var(--shadow-glow);
}

.activity-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #666;
    border-color: #666;
}

.activity-progress {
    width: 100%;
    height: 4px;
    background: var(--shadow-color);
    margin-top: 8px;
    border-radius: 2px;
    overflow: hidden;
}

.activity-progress-bar {
    height: 100%;
    background: var(--text-primary);
    transition: width 0.1s linear;
}

.activity-active {
    background: rgba(0, 221, 255, 0.2);
    border-color: var(--text-secondary);
    box-shadow: 0 0 15px rgba(0, 221, 255, 0.4);
}

/* Таблица лога */
.log-row {
    display: grid;
    grid-template-columns: 58px 55px 50px 1fr;
    gap: 8px;
    font-size: 11px;
    padding: 4px 6px;
    background: rgba(0, 255, 136, 0.05);
    border-left: 2px solid var(--text-primary);
    border-radius: 2px;
    margin-bottom: 2px;
    align-items: center;
}

.log-row.power {
    border-left-color: #ffff00;
}

.log-row.stat {
    border-left-color: var(--text-secondary);
}

.log-row.complete {
    border-left-color: #ff6b6b;
}

.log-real-time {
    color: #666;
    font-family: monospace;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.log-time {
    color: #888;
    font-family: monospace;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.log-diff {
    font-family: monospace;
    font-size: 10px;
    text-align: center;
}

.log-diff.diff-faster {
    color: var(--text-primary);
}

.log-diff.diff-slower {
    color: #ff6b6b;
}

.log-diff.diff-same {
    color: #888;
}

.log-text {
    color: var(--text-primary);
}

.log-row.power .log-text {
    color: #ffff00;
}

.log-row.stat .log-text {
    color: var(--text-secondary);
}

.log-row.complete .log-text {
    color: #ff8e53;
}

.demo-stub {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-primary);
    border: 1px dashed var(--shadow-glow);
    border-radius: 8px;
    background: rgba(0, 255, 136, 0.05);
}

.demo-stub h2 {
    font-size: 20px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.demo-stub p {
    font-size: 14px;
    line-height: 1.8;
    color: #aaffcc;
    opacity: 0.85;
}

.loop-btn {
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    border: 2px solid var(--text-primary);
    color: #000;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    margin-top: 15px;
    width: 100%;
    transition: all 0.3s;
}

.loop-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.prestige-bonus {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid #ffd700;
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 12px;
    color: #ffd700;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 255, 136, 0.1);
}

::-webkit-scrollbar-thumb {
    background: var(--text-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Стили автоматизации */
.automation-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.automation-label {
    color: var(--text-secondary);
    font-size: 11px;
    margin-top: 8px;
    opacity: 0.8;
}

.auto-controls {
    display: flex;
    gap: 6px;
}

.auto-btn {
    background: var(--shadow-color);
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s;
    flex: 1;
}

.auto-btn:hover {
    background: var(--shadow-glow);
    box-shadow: 0 0 10px var(--shadow-glow);
}

.auto-btn.active {
    background: rgba(255, 100, 100, 0.3);
    border-color: #ff6464;
    color: #ff6464;
}

.auto-repeat-btn {
    background: rgba(0, 221, 255, 0.2);
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    opacity: 0.5;
}

.auto-repeat-btn:hover {
    background: rgba(0, 221, 255, 0.3);
}

.auto-repeat-btn.active {
    background: rgba(0, 221, 255, 0.4);
    opacity: 1;
    box-shadow: 0 0 8px rgba(0, 221, 255, 0.5);
}

.automation-queue {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 4px;
}

.queue-item {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--shadow-glow);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 11px;
}

.queue-item.queue-active {
    background: rgba(0, 221, 255, 0.2);
    border-color: var(--text-secondary);
    box-shadow: 0 0 8px rgba(0, 221, 255, 0.3);
}

.queue-item.queue-skipped {
    opacity: 0.5;
    border-style: dashed;
}

.queue-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.queue-item-name {
    color: var(--text-primary);
    font-weight: bold;
}

.queue-item-progress {
    color: #ffaa00;
    font-size: 10px;
}

.queue-item-controls {
    display: flex;
    gap: 3px;
}

.queue-item-controls button {
    background: var(--shadow-color);
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
    width: 22px;
    height: 22px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.queue-item-controls button:hover:not(:disabled) {
    background: rgba(0, 255, 136, 0.4);
}

.queue-item-controls button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.queue-item-controls .remove-btn {
    border-color: #ff6464;
    color: #ff6464;
    background: rgba(255, 100, 100, 0.2);
}

.queue-item-controls .remove-btn:hover {
    background: rgba(255, 100, 100, 0.4);
}

/* Activity card inner elements — desktop */
.act-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.act-name {
    font-weight: bold;
    color: var(--text-primary);
    font-size: 16px;
}

.act-stats {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 2px;
}

.act-timer {
    color: #aaffcc;
    font-size: 12px;
    margin-bottom: 3px;
    font-variant-numeric: tabular-nums;
}

.act-desc {
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.3;
    opacity: 0.8;
    margin-bottom: 3px;
}

.act-completed {
    color: #ffaa00;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    margin-bottom: 3px;
}

/* Индикатор автоматизации на карточке активности */
.auto-indicator {
    font-size: 14px;
    cursor: default;
    padding: 2px 4px;
    border-radius: 3px;
}

.auto-indicator.locked {
    opacity: 0.4;
    min-width: 32px;
    text-align: right;
}

.auto-indicator.can-add {
    cursor: pointer;
    background: rgba(0, 221, 255, 0.2);
    border-radius: 4px;
    transition: all 0.2s;
}

.auto-indicator.can-add:hover {
    background: rgba(0, 221, 255, 0.5);
    transform: scale(1.2);
}

.auto-indicator.in-queue {
    color: var(--text-primary);
    background: var(--shadow-color);
}

/* Settings button */
.settings-btn {
    background: rgba(0, 221, 255, 0.2);
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    margin-top: 8px;
    width: 100%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.settings-btn:hover {
    background: rgba(0, 221, 255, 0.4);
    box-shadow: 0 0 10px rgba(0, 221, 255, 0.4);
}

/* Modal overlay */
.modal-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;
}

.modal-content {
    background: rgba(10, 20, 40, 0.95);
    border: 2px solid var(--text-secondary);
    border-radius: 8px;
    padding: 25px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 0 30px rgba(0, 221, 255, 0.4);
}

.modal-content h2 {
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 1px solid var(--text-secondary);
    padding-bottom: 10px;
}

/* Item modal */
.item-modal-content {
    border-color: #ffd700 !important;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4) !important;
}

.item-modal-content h2 {
    color: #ffd700 !important;
    border-color: #ffd700 !important;
}

.item-display {
    text-align: center;
    margin: 20px 0;
}

.item-icon-large {
    font-size: 64px;
    margin-bottom: 10px;
    animation: itemGlow 1.5s ease-in-out infinite;
}

@keyframes itemGlow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5)); }
    50% { filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8)); }
}

.item-modal-name {
    color: #ffd700;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.item-modal-bonuses {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 4px;
    padding: 12px;
    margin: 15px 0;
    text-align: left;
}

.item-modal-bonuses .bonus-line {
    color: var(--text-primary);
    font-size: 13px;
    margin: 5px 0;
}

.settings-row {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.settings-row label {
    color: var(--text-primary);
    font-size: 14px;
}

.settings-row select {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
}

.settings-row select:focus {
    outline: none;
    box-shadow: 0 0 10px var(--shadow-glow);
}

.reset-loop-btn {
    background: rgba(0, 170, 255, 0.2);
    border: 1px solid #00aaff;
    color: #00aaff;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    width: 100%;
    transition: all 0.2s;
}

.reset-loop-btn:hover {
    background: rgba(0, 170, 255, 0.4);
    box-shadow: 0 0 10px rgba(0, 170, 255, 0.4);
}

.save-row {
    display: flex;
    gap: 8px;
}

.export-btn, .import-btn {
    background: rgba(0, 221, 255, 0.15);
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    flex: 1;
    transition: all 0.2s;
}

.export-btn:hover, .import-btn:hover {
    background: rgba(0, 221, 255, 0.3);
    box-shadow: 0 0 10px rgba(0, 221, 255, 0.4);
}

.reset-btn {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid #ff4444;
    color: #ff4444;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    width: 100%;
    transition: all 0.2s;
}

.reset-btn:hover {
    background: rgba(255, 0, 0, 0.4);
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
}

.close-btn {
    background: var(--shadow-color);
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    width: 100%;
    margin-top: 10px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(0, 255, 136, 0.4);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
}

/* Mobile Tabs */
.mobile-tabs {
    display: none;
}

/* Save indicator */
.save-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 24px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 100;
}

.save-indicator.saving {
    opacity: 0.5;
    animation: saveBlink 0.8s ease-in-out;
}

@keyframes saveBlink {
    0% { opacity: 0; }
    20% { opacity: 0.6; }
    50% { opacity: 0.3; }
    80% { opacity: 0.6; }
    100% { opacity: 0; }
}

/* =============== DESKTOP SCALING =============== */

/* ===================== MOBILE ===================== */
@media (max-width: 768px) {
    html, body {
        overflow: hidden;
        height: 100vh;
        height: 100dvh;
    }

    body {
        padding: 10px 8px 0 8px;
        display: flex;
        flex-direction: column;
    }

    .container {
        display: flex;
        flex-direction: column;
        gap: 6px;
        flex: 1;
        min-height: 0;
    }

    .time-display {
        flex-shrink: 0;
        z-index: 50;
    }

    .panel {
        height: auto;
        flex: 1;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .panel .panel-scroll {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        padding-bottom: 50px;
    }

    /* Compact inventory on mobile */
    .inventory-section {
        margin-top: 8px;
    }

    .inventory-items {
        grid-template-columns: repeat(auto-fill, 28px);
        gap: 4px;
        max-height: 70px;
    }

    .inventory-item {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .inventory-title {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .main-area {
        /* 100dvh - oxygen(~40px) - log(~130px) - tabs(~48px) - padding/gaps(~30px) */
        max-height: calc(100dvh - 250px);
        overflow: hidden;
    }

    .activities-container {
        grid-template-columns: 1fr;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        gap: 6px;
    }

    .right-panels {
        overflow: visible;
    }

    .automation-queue {
        overflow: visible;
        max-height: none;
    }

    .log-row {
        grid-template-columns: 50px 45px 40px 1fr;
        gap: 4px;
        font-size: 10px;
    }

    /* Log panel - fixed above tab bar */
    .log-panel {
        position: fixed !important;
        bottom: 48px;
        left: 0;
        right: 0;
        z-index: 99;
        display: block !important;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        background: rgba(10, 20, 40, 0.95) !important;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 6px 10px;
        margin: 0;
        height: auto !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
    }

    .log-panel h2 {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .log-panel #log {
        max-height: 100px !important;
        overflow-y: auto;
    }

    .log-filters {
        gap: 2px;
    }

    .log-filter {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }

    /* Mobile Tab Bar */
    .mobile-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background: rgba(10, 14, 39, 0.95);
        border-top: 2px solid var(--text-primary);
        justify-content: stretch;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .mobile-tab {
        flex: 1;
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 22px;
        padding: 12px 0;
        cursor: pointer;
        opacity: 0.4;
        transition: all 0.2s;
    }

    .mobile-tab.active {
        opacity: 1;
        background: rgba(0, 255, 136, 0.15);
        box-shadow: 0 -2px 10px var(--shadow-glow);
    }

    /* Tab content visibility */
    .panel:not(.log-panel),
    .main-area,
    .right-panels,
    .mobile-settings-panel {
        display: none !important;
    }

    .panel.mobile-visible,
    .main-area.mobile-visible,
    .right-panels.mobile-visible,
    .mobile-settings-panel.mobile-visible {
        display: flex !important;
    }

    .right-panels.mobile-visible .panel,
    .mobile-settings-panel.mobile-visible .panel {
        display: flex !important;
        width: 100%;
    }

    .right-panels.mobile-visible {
        width: 100%;
    }

    .main-area.mobile-visible {
        display: flex !important;
    }

    .scene {
        padding: 10px;
        flex-shrink: 0;
    }

    .scene-title {
        font-size: 16px;
        margin-bottom: 8px;
    }

    /* Time display always visible */
    .time-display {
        display: block !important;
    }

    /* Modal on mobile */
    .modal-content {
        min-width: unset;
        max-width: 90vw;
        margin: 0 10px;
    }

    .activity-btn {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "header header"
            "stats timer"
            "desc completed"
            "progress progress";
        gap: 2px 8px;
        align-items: center;
        padding: 8px 10px;
        min-height: auto;
    }

    .act-header { grid-area: header; margin-bottom: 0; }
    .act-name { font-size: 14px; }
    .act-stats { grid-area: stats; font-size: 12px; margin-bottom: 0; }
    .act-timer { grid-area: timer; font-size: 11px; margin-bottom: 0; text-align: right; }
    .act-desc { grid-area: desc; font-size: 11px; margin-bottom: 0; }
    .act-completed { grid-area: completed; font-size: 10px; margin-bottom: 0; white-space: nowrap; text-align: right; }
    .activity-progress { grid-area: progress; }

    .settings-btn {
        display: none !important;
    }

    .mobile-settings-panel {
        width: 100%;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .mobile-settings-panel .panel {
        width: 100%;
        height: 100%;
    }

    .mobile-settings-content {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    h2 {
        font-size: 14px;
    }

    .stat-line {
        font-size: 12px;
    }
}
