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

body {
    overflow: hidden;
    background: #111;
    color: #eee;
    font-family: 'Courier New', monospace;
}

#game-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

/* HUD */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#hud-top {
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    font-size: 14px;
}

#server-info {
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 4px;
}

#player-info {
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 4px;
}

#hud-bottom {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    flex-direction: column;
    align-items: center;
}

#health-bar, #stamina-bar {
    width: 300px;
    height: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

#health-fill {
    height: 100%;
    background: #c33;
    transition: width 0.3s;
}

#stamina-fill {
    height: 100%;
    background: #39c;
    transition: width 0.3s;
}

#health-bar span, #stamina-bar span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    text-shadow: 1px 1px 2px #000;
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 0 0 2px #000;
}

/* Chat */
#chat-panel {
    position: fixed;
    bottom: 80px;
    left: 20px;
    width: 400px;
    z-index: 20;
    pointer-events: none;
}

#chat-messages {
    max-height: 200px;
    overflow-y: auto;
    padding: 5px;
    font-size: 13px;
    text-shadow: 1px 1px 2px #000;
}

#chat-messages .msg {
    margin: 2px 0;
    opacity: 0.8;
}

#chat-messages .msg.system {
    color: #ff0;
}

#chat-input {
    width: 100%;
    padding: 8px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #eee;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    pointer-events: auto;
}

/* Connect dialog */
#connect-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 30px 40px;
    z-index: 100;
    min-width: 480px;
}

#connect-dialog h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #7af;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #aaa;
}

.form-group input {
    width: 100%;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: #eee;
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.form-group input:focus {
    border-color: #7af;
}

#connect-btn {
    width: 100%;
    padding: 10px;
    background: #37a;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

#connect-btn:hover {
    background: #48b;
}

/* Server browser */
#server-browser {
    margin-bottom: 15px;
}

#server-browser label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #aaa;
}

#server-list {
    max-height: 220px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

#server-list::-webkit-scrollbar {
    width: 6px;
}

#server-list::-webkit-scrollbar-track {
    background: transparent;
}

#server-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.server-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.server-row:last-child {
    border-bottom: none;
}

.server-row:hover {
    background: rgba(255, 255, 255, 0.07);
}

.server-row.selected {
    background: rgba(55, 120, 200, 0.25);
}

.server-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #555;
}

.server-status-dot.online {
    background: #4c4;
    box-shadow: 0 0 4px #4c4;
}

.server-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-region {
    width: 50px;
    text-align: center;
    color: #888;
    flex-shrink: 0;
}

.server-players {
    width: 60px;
    text-align: right;
    flex-shrink: 0;
}

.server-tps {
    width: 50px;
    text-align: right;
    color: #888;
    flex-shrink: 0;
}

#server-list-loading,
#server-list-empty {
    padding: 16px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

#connect-status {
    margin-top: 10px;
    text-align: center;
    font-size: 13px;
    color: #f88;
}

/* Inventory */
#inventory {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 20px;
    z-index: 50;
}

#inventory h3 {
    margin-bottom: 15px;
    color: #7af;
}

#inventory-slots {
    display: grid;
    grid-template-columns: repeat(8, 50px);
    gap: 4px;
}

.inv-slot {
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #ccc;
}

/* Build toolbar */
#build-toolbar {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 30, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 8px 15px;
    z-index: 30;
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
}

.build-btn {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    color: #ccc;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
}

.build-btn.active {
    background: #37a;
    color: #fff;
}

.build-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
