* {
    box-sizing: border-box;
    user-select: none;
    margin: 0;
    padding: 0;
}
body, html {
    width: 100%;
    height: 100%;
    background-color: #030108;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden;
}
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #05030a;
}
canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
}
.hud-panel {
    position: absolute;
    background: rgba(18, 14, 34, 0.92);
    border: 2px solid #4a3b69;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
    pointer-events: none;
}
#hud-top-left {
    top: 14px;
    left: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 190px;
}
.res-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.bar-wrap {
    width: 80px;
    height: 9px;
    background: #0d0918;
    border: 1px solid #5a4b7c;
    border-radius: 3px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    width: 100%;
    transition: width 0.1s linear;
}
#hud-top-right {
    top: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
}
#orbit-clock {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #ffcc00;
    position: relative;
    background: radial-gradient(circle, #ffeaa7 15%, #fdcb6e 65%, #d63031 100%);
    overflow: hidden;
    box-shadow: 0 0 12px rgba(255, 204, 0, 0.4);
}
#orbit-needle {
    position: absolute;
    width: 2px;
    height: 22px;
    background: #1e272e;
    top: 0;
    left: 21px;
    transform-origin: bottom center;
}
#hud-bot-dialog {
    position: absolute;
    top: 85px;
    right: 14px;
    background: #f1f2f6;
    color: #1e1f29;
    border: 2px solid #3742fa;
    border-radius: 8px;
    padding: 8px 14px;
    max-width: 260px;
    font-size: 11px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    animation: floatBot 2.5s infinite ease-in-out;
}
@keyframes floatBot {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}
#zone-banner {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 16px;
    background: rgba(10, 5, 20, 0.88);
    border: 1px solid #70a1ff;
    border-radius: 20px;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #70a1ff;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(112, 161, 255, 0.3);
}
#build-menu {
    position: absolute;
    z-index: 5;
    bottom: 14px;
    left: 14px;
    width: 320px;
    padding: 8px;
    background: rgba(18, 14, 34, 0.97);
    border: 2px solid #5a4b7c;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.65);
}
.build-options[hidden] {
    display: none;
}
.build-menu-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 8px;
}
.build-tab {
    min-height: 36px;
    padding: 4px;
    border: 1px solid #3d2f5e;
    border-radius: 4px;
    background: #251d3b;
    color: #c8d6e5;
    font: bold 12px 'Courier New', Courier, monospace;
    cursor: pointer;
}
.build-tab.active {
    border-color: #55efc4;
    color: #9ff0c2;
    background: #25473f;
}
.build-options {
    display: grid;
    gap: 5px;
}
.build-option {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 4px 8px;
    border: 1px solid #3d2f5e;
    border-radius: 4px;
    background: #211a34;
    color: #f1f2f6;
    text-align: left;
    font: 11px 'Courier New', Courier, monospace;
    cursor: pointer;
}
.build-option > span:first-child {
    font-size: 18px;
    text-align: center;
}
.build-option small {
    color: #ffeaa7;
    white-space: nowrap;
}
.build-option:hover,
.build-option.active {
    border-color: #55efc4;
    background: #2d3d3a;
}
@media (max-width: 460px) {
    #build-menu {
        width: min(320px, calc(100vw - 20px));
    }
}
#tooltip {
    position: absolute;
    top: 50%;
    right: 14px;
    max-width: min(260px, calc(100vw - 28px));
    transform: translateY(-50%);
    background: rgba(0,0,0,0.85);
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    color: #55efc4;
    pointer-events: none;
    text-align: right;
    border: 1px solid #332b50;
}
#mining-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    background: #1e1533;
    border: 3px solid #ff7675;
    border-radius: 10px;
    padding: 16px;
    display: none;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 0 25px rgba(255, 118, 117, 0.5);
    z-index: 100;
}
#drill-bar-container {
    width: 100%;
    height: 24px;
    background: #100b1d;
    border: 2px solid #554477;
    border-radius: 6px;
    position: relative;
    margin: 14px 0;
    overflow: hidden;
}
#drill-target-zone {
    position: absolute;
    top: 0; bottom: 0;
    width: 50px; left: 130px;
    background: rgba(46, 204, 113, 0.45);
    border-left: 2px solid #2ecc71;
    border-right: 2px solid #2ecc71;
}
#drill-needle {
    position: absolute;
    top: 0; bottom: 0;
    width: 6px;
    background: #ff7675;
    left: 0;
}
.mine-btn {
    background: #ff7675;
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 5px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px #d63031;
}
.mine-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px #d63031;
}
#building-stats {
    position: absolute;
    z-index: 90;
    top: 50%;
    left: 50%;
    width: min(340px, calc(100vw - 24px));
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 14px;
    transform: translate(-50%, -50%);
    background: rgba(18, 14, 34, 0.97);
    border: 2px solid #55efc4;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75);
    color: #f1f2f6;
}
#building-stats[hidden] {
    display: none;
}
.building-stats-header {
    display: grid;
    grid-template-columns: 34px 1fr 32px;
    align-items: center;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid #4a3b69;
}
#building-stats-icon {
    font-size: 23px;
    text-align: center;
}
#building-stats-title {
    font-size: 14px;
    line-height: 1.3;
}
#building-stats-close {
    width: 32px;
    height: 32px;
    border: 1px solid #5a4b7c;
    border-radius: 4px;
    background: #251d3b;
    color: #f1f2f6;
    font: 22px 'Courier New', Courier, monospace;
    cursor: pointer;
}
#building-stats-list {
    display: grid;
    gap: 6px;
    margin: 10px 0;
}
.building-stat-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    font-size: 11px;
}
.building-stat-row dt {
    color: #aeb8c8;
}
.building-stat-row dd {
    margin: 0;
    color: #9ff0c2;
    text-align: right;
}
#building-stats-drill {
    width: 100%;
}
#building-stats-drill[hidden] {
    display: none;
}