/* ── Reset ─────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ── Base ──────────────────────────────────────── */
body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: #0d0d1a;
    overflow: hidden;
    color: #fff;
    height: 100vh;
    width: 100vw;
}

/* ── Canvas ────────────────────────────────────── */
canvas {
    display: block;
    outline: none;
}

/* ── Game Container ────────────────────────────── */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* ── HUD ───────────────────────────────────────── */
#ui-overlay {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 10;
    pointer-events: none;
    user-select: none;
}

#inventory-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    background: rgba(10, 15, 30, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(80, 220, 200, 0.3);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.inv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.inv-icon { 
    font-size: 20px;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.2));
}

#controls-hint {
    margin-top: 15px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(10, 15, 30, 0.65);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(80, 220, 200, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
}

/* ── Crosshair ─────────────────────────────────── */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

#crosshair.visible { opacity: 1; }

.ch-h, .ch-v {
    position: absolute;
    background: rgba(255,255,255,0.8);
    border-radius: 2px;
}

.ch-h {
    width: 100%;
    height: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.ch-v {
    width: 2px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
}

/* ── Loading ───────────────────────────────────── */
#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', monospace;
    font-size: 22px;
    color: #ffcc00;
    text-shadow: 0 0 10px #ffcc00;
    animation: pulse 1s infinite;
    z-index: 5;
}

/* ── Overlays ──────────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 8, 22, 0.75);
    backdrop-filter: blur(10px);
}

.overlay.hidden { display: none; }

.overlay-panel {
    background: rgba(15, 15, 38, 0.85);
    border: 1px solid rgba(0, 255, 213, 0.2);
    border-radius: 20px;
    padding: 50px 60px;
    text-align: center;
    box-shadow: 0 0 60px rgba(0, 255, 213, 0.08), 0 20px 60px rgba(0,0,0,0.5);
    max-width: 480px;
    width: 90%;
    animation: fadeInUp 0.4s ease;
}

.crafting-panel {
    max-width: 600px;
    padding: 40px;
}

/* ── Crafting Grid ─────────────────────────────── */
.craft-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.craft-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 20px;
    transition: background 0.2s;
}

.craft-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.craft-info h3 {
    font-family: 'Orbitron', monospace;
    font-size: 18px;
    color: #00ffd5;
    margin-bottom: 4px;
}

.craft-info p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

.craft-cost {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.craft-btn {
    background: rgba(0, 255, 213, 0.15);
    color: #00ffd5;
    border: 1px solid rgba(0, 255, 213, 0.4);
    padding: 10px 24px;
    border-radius: 8px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.craft-btn:hover:not(:disabled) {
    background: #00ffd5;
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 213, 0.4);
}

.craft-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
}

/* ── Game Title ────────────────────────────────── */
.game-title {
    font-family: 'Orbitron', monospace;
    font-size: 56px;
    font-weight: 900;
    letter-spacing: 4px;
    color: #fff;
    text-shadow: 0 0 20px rgba(255,255,255,0.3);
    margin-bottom: 6px;
    line-height: 1;
}

.game-title span {
    color: #00ffd5;
    text-shadow: 0 0 20px #00ffd5aa, 0 0 50px #00ffd533;
}

.game-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.45);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 36px;
}

/* ── Instructions ──────────────────────────────── */
.instructions-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 24px;
    margin-bottom: 36px;
}

.instr-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
}

kbd {
    display: inline-block;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 3px 8px;
    font-family: 'Orbitron', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #00ffd5;
    letter-spacing: 1px;
    min-width: 60px;
    text-align: center;
}

/* ── Overlay Title ─────────────────────────────── */
.overlay-title {
    font-family: 'Orbitron', monospace;
    font-size: 40px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 4px;
    margin-bottom: 28px;
    text-shadow: 0 0 20px rgba(255,255,255,0.25);
}

.win-icon {
    font-size: 64px;
    margin-bottom: 12px;
    animation: spin-bob 2s ease-in-out infinite;
}

.win-message {
    color: rgba(255,255,255,0.55);
    font-size: 15px;
    margin-bottom: 32px;
}

/* ── Buttons ───────────────────────────────────── */
.primary-btn {
    display: inline-block;
    background: linear-gradient(135deg, #00ffd5, #00b4ff);
    color: #0a0a1a;
    font-family: 'Orbitron', monospace;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 14px 40px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    box-shadow: 0 0 24px rgba(0, 255, 213, 0.35);
}

.primary-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 0 40px rgba(0, 255, 213, 0.55);
    filter: brightness(1.1);
}

.primary-btn:active { transform: scale(0.97); }

.secondary-btn {
    display: inline-block;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.7);
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    padding: 13px 36px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.secondary-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    transform: translateY(-1px);
}

.btn-group {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Animations ────────────────────────────────── */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin-bob {
    0%   { transform: rotate(0deg)   translateY(0px); }
    25%  { transform: rotate(10deg)  translateY(-6px); }
    50%  { transform: rotate(0deg)   translateY(0px); }
    75%  { transform: rotate(-10deg) translateY(-4px); }
    100% { transform: rotate(0deg)   translateY(0px); }
}