/* 16-bit Retro Styling for Sandkings Game */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Press Start 2P', cursive;
    background: #1a1a2e;
    color: #eee;
    overflow-x: hidden;
    line-height: 1.6;
}

.game-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 10px;
}

header {
    text-align: center;
    margin-bottom: 8px;
    padding: 5px 10px;
    background: linear-gradient(180deg, #2a2a4e 0%, #1a1a2e 100%);
    border: 3px solid #4a4a6e;
    box-shadow: 0 2px 0 #0a0a1e;
    position: relative;
}

.github-link {
    position: absolute;
    top: 8px;
    left: 10px;
    font-size: 0.45rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.github-link a {
    color: #4ecdc4;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.github-link a:hover {
    color: #6bffef;
    transform: translateY(-1px);
}

.github-icon {
    font-size: 0.6rem;
}

.author-credit {
    color: #888;
    font-size: 0.38rem;
    margin-left: 2px;
}

.story-credit {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.45rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.story-credit .credit-label {
    color: #888;
    font-size: 0.38rem;
}

.story-credit a {
    color: #6bcf7f;
    text-decoration: none;
    border-bottom: 1px dotted #6bcf7f;
    transition: all 0.2s;
}

.story-credit a:hover {
    color: #8fff9f;
    border-bottom-color: #8fff9f;
    transform: translateY(-1px);
}

h1 {
    font-size: 1.2rem;
    color: #ff6b6b;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 3px;
}

.subtitle {
    font-size: 0.45rem;
    color: #aaa;
    margin-top: 3px;
}

.main-content {
    display: flex;
    gap: 20px;
}

/* Stats Panel */
.stats-panel {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-section {
    background: #2a2a4e;
    border: 3px solid #4a4a6e;
    padding: 8px;
    box-shadow: 0 4px 0 #0a0a1e;
}

.stat-section h2 {
    font-size: 0.75rem;
    color: #ffd93d;
    margin-bottom: 10px;
    border-bottom: 2px solid #4a4a6e;
    padding-bottom: 5px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.6rem;
}

.stat-item .label {
    color: #aaa;
}

.stat-item .value {
    color: #6bcf7f;
    font-weight: bold;
}

.stat-item .value.danger {
    color: #ff6b6b;
}

/* Colony Stats */
.colony-stat {
    margin-bottom: 10px;
    padding: 8px;
    background: #1a1a2e;
    border: 2px solid #4a4a6e;
    position: relative;
}

.colony-stat.dead {
    background: #0a0a1a;
    opacity: 0.6;
    filter: grayscale(0.8);
}

.death-icon {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 1rem;
    opacity: 0.9;
    color: #888;
}

.colony-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 0.65rem;
    color: #ffd93d;
}

.colony-dot {
    width: 10px;
    height: 10px;
    border: 2px solid #000;
    display: inline-block;
}

.colony-dot.red { background: #ff4444; }
.colony-dot.white { background: #ffffff; }
.colony-dot.black { background: #333; border-color: #fff; }
.colony-dot.orange { background: #ff9944; }

.colony-info {
    font-size: 0.55rem;
    color: #aaa;
    line-height: 1.6;
}

/* Action Buttons */
.action-btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.65rem;
    background: #4ecdc4;
    color: #1a1a2e;
    border: 4px solid #3aa99f;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 4px 0 #2a8980;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-btn:hover {
    background: #6ee7de;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #2a8980;
}

.action-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #2a8980;
}

.action-btn.danger-btn {
    background: #ff6b6b;
    border-color: #ff4444;
    box-shadow: 0 4px 0 #cc3333;
}

.action-btn.danger-btn:hover {
    background: #ff8888;
    box-shadow: 0 6px 0 #cc3333;
}

.action-btn.danger-btn:active {
    box-shadow: 0 2px 0 #cc3333;
}

.action-btn:disabled {
    background: #555;
    border-color: #444;
    box-shadow: 0 2px 0 #333;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-icon {
    font-size: 1rem;
}

/* Event Log */
.event-log-section {
    flex: 1;
    min-height: 150px;
}

.event-log {
    max-height: 140px;
    overflow-y: auto;
    font-size: 0.5rem;
    line-height: 1.6;
    color: #ccc;
}

.event-log::-webkit-scrollbar {
    width: 8px;
}

.event-log::-webkit-scrollbar-track {
    background: #1a1a2e;
}

.event-log::-webkit-scrollbar-thumb {
    background: #4a4a6e;
    border: 2px solid #2a2a4e;
}

.event-entry {
    margin-bottom: 8px;
    padding: 5px;
    border-left: 3px solid #4a4a6e;
    padding-left: 8px;
}

.event-entry.warning {
    border-left-color: #ffd93d;
    color: #ffd93d;
}

.event-entry.danger {
    border-left-color: #ff6b6b;
    color: #ff6b6b;
}

.event-entry.info {
    border-left-color: #4ecdc4;
    color: #4ecdc4;
}

/* Tank Display */
.tank-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Toolbar */
.toolbar {
    background: #2a2a4e;
    border: 4px solid #4a4a6e;
    border-bottom: none;
    padding: 8px;
    display: flex;
    gap: 15px;
    align-items: center;
    box-shadow: 0 2px 0 #0a0a1e;
    flex-wrap: wrap;
}

.tool-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.tool-group.tool-divider {
    border-left: 2px solid #4a4a6e;
    padding-left: 15px;
}

.env-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.env-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.45rem;
    color: #aaa;
}

.env-value {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.4rem;
    color: #4ecdc4;
    margin-top: 2px;
}

.env-slider {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #3a3a5e;
    outline: none;
    border-radius: 2px;
    border: 2px solid #4a4a6e;
}

.env-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #4ecdc4;
    cursor: pointer;
    border-radius: 2px;
    border: 2px solid #2a8980;
}

.env-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #4ecdc4;
    cursor: pointer;
    border-radius: 2px;
    border: 2px solid #2a8980;
}

.tool-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5rem;
    padding: 8px 10px;
    background: #3a3a5e;
    color: #aaa;
    border: 3px solid #4a4a6e;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 60px;
    box-shadow: 0 3px 0 #1a1a3e;
}

.tool-btn:hover {
    background: #4a4a6e;
    transform: translateY(-1px);
    box-shadow: 0 4px 0 #1a1a3e;
}

.tool-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 #1a1a3e;
}

.checkbox-label {
    position: relative;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-label .checkbox-icon {
    opacity: 0.5;
}

.checkbox-label input[type="checkbox"]:checked ~ .checkbox-icon {
    opacity: 1;
}

.checkbox-label input[type="checkbox"]:checked ~ .tool-label {
    color: #4ecdc4;
}

.checkbox-label:hover input[type="checkbox"]:checked ~ .checkbox-icon {
    filter: brightness(1.2);
}

.tool-btn.active {
    background: #4ecdc4;
    color: #1a1a2e;
    border-color: #3aa99f;
    box-shadow: 0 3px 0 #2a8980;
}

.tool-icon {
    font-size: 1rem;
}

.tool-label {
    font-size: 0.45rem;
    white-space: nowrap;
}

.toolbar-info {
    flex: 1;
    font-size: 0.5rem;
    color: #ffd93d;
    padding-left: 15px;
    border-left: 2px solid #4a4a6e;
}

.tank-frame {
    position: relative;
    background: #0a0a1e;
    border: 6px solid #4a4a6e;
    border-top: none;
    box-shadow: 
        0 0 0 2px #2a2a4e,
        inset 0 0 50px rgba(0,0,0,0.8),
        0 8px 0 #0a0a1e;
    padding: 5px;
}

#tank-canvas {
    display: block;
    width: 100%;
    height: auto;
    background: linear-gradient(180deg, #1a0f0f 0%, #0f0505 100%);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: crosshair;
}

#tank-canvas.cursor-hand {
    cursor: grab;
}

#tank-canvas.cursor-hand:active {
    cursor: grabbing;
}

#tank-canvas.cursor-feed {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><text y="20" font-size="20">🍖</text></svg>'), auto;
}

#tank-canvas.cursor-spray {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><text y="20" font-size="20">�</text></svg>'), auto;
}

.tank-controls {
    margin-top: 10px;
    padding: 10px;
    background: #2a2a4e;
    border: 4px solid #4a4a6e;
    box-shadow: 0 4px 0 #0a0a1e;
}

.help-text {
    font-size: 0.5rem;
    color: #aaa;
    line-height: 1.6;
}

/* Game Over Overlay */
.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-over-overlay.hidden {
    display: none;
}

/* Magnifier Overlay */
.magnifier-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 500;
    animation: magnifierAppear 0.3s ease-out;
}

.magnifier-overlay.hidden {
    display: none;
}

@keyframes magnifierAppear {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.magnifier-frame {
    background: #2a2a4e;
    border: 4px solid #4ecdc4;
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.5), 0 4px 0 #0a0a1e;
    padding: 8px;
    border-radius: 4px;
}

.magnifier-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5rem;
    color: #4ecdc4;
    text-align: center;
    margin-bottom: 6px;
    text-shadow: 2px 2px 0 #000;
}

#magnifier-canvas {
    display: block;
    background: #1a1a2e;
    border: 2px solid #3a3a5e;
}

/* Observe Overlay */
.observe-overlay {
    position: fixed;
    z-index: 600;
    animation: observeAppear 0.2s ease-out;
}

.observe-overlay.hidden {
    display: none;
}

@keyframes observeAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.observe-panel {
    background: #2a2a4e;
    border: 4px solid #4ecdc4;
    box-shadow: 0 0 30px rgba(78, 205, 196, 0.4), 0 4px 0 #0a0a1e;
    padding: 0;
    border-radius: 4px;
    min-width: 400px;
    max-width: 500px;
}

.observe-header {
    background: linear-gradient(180deg, #3a3a5e 0%, #2a2a4e 100%);
    padding: 12px 16px;
    border-bottom: 3px solid #4ecdc4;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#observe-colony-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    color: #4ecdc4;
    text-shadow: 2px 2px 0 #000;
}

.observe-close {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    background: #ff6b6b;
    color: #fff;
    border: 2px solid #ff4444;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 2px 0 #aa0000;
}

.observe-close:hover {
    background: #ff8888;
    transform: translateY(-1px);
    box-shadow: 0 3px 0 #aa0000;
}

.observe-close:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 #aa0000;
}

.observe-content {
    padding: 16px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.5rem;
    line-height: 1.8;
    color: #eee;
}

.observe-stat {
    margin-bottom: 10px;
    padding: 6px 8px;
    background: rgba(58, 58, 94, 0.5);
    border-left: 3px solid #4ecdc4;
}

.observe-stat-label {
    color: #4ecdc4;
    display: inline-block;
    min-width: 120px;
}

.observe-stat-value {
    color: #fff;
}

.observe-stat-value.danger {
    color: #ff6b6b;
}

.observe-stat-value.warning {
    color: #ffd93d;
}

.observe-stat-value.good {
    color: #6bcf7f;
}

.game-over-content {
    text-align: center;
    padding: 40px;
    background: #2a2a4e;
    border: 6px solid #ff6b6b;
    box-shadow: 0 0 30px rgba(255, 107, 107, 0.5);
    max-width: 500px;
}

#game-over-title {
    font-size: 2rem;
    color: #ff6b6b;
    margin-bottom: 20px;
    text-shadow: 4px 4px 0 #000;
}

#game-over-message {
    font-size: 0.7rem;
    color: #eee;
    margin-bottom: 30px;
    line-height: 1.8;
}

#restart-btn {
    width: auto;
    padding: 15px 30px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .stats-panel {
        flex: 1;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-info {
        border-left: none;
        border-top: 2px solid #4a4a6e;
        padding-left: 0;
        padding-top: 10px;
        text-align: center;
    }
    
    h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.2rem;
    }
    
    .subtitle {
        font-size: 0.5rem;
    }
    
    .stat-section h2 {
        font-size: 0.7rem;
    }
    
    .action-btn {
        font-size: 0.55rem;
    }
}

/* Pixelated cursor for retro feel */
body {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><rect x="0" y="0" width="2" height="2" fill="white"/><rect x="2" y="2" width="2" height="2" fill="white"/><rect x="4" y="4" width="2" height="2" fill="white"/><rect x="6" y="6" width="2" height="2" fill="white"/><rect x="8" y="8" width="2" height="2" fill="white"/></svg>'), auto;
}

button {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><rect x="4" y="4" width="8" height="8" fill="yellow" stroke="black" stroke-width="1"/></svg>'), pointer;
}
