/* ── OVERRIDE ROOT BODY FOR FULL-HEIGHT APP ─────────────── */
body {
    overflow: hidden;
    height: 100vh;
}

/* ── MAIN LAYOUT ─────────────────────────────────────────── */
.craft-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ── TOOLBAR ─────────────────────────────────────────────── */
.craft-toolbar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.5rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.craft-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.01em;
}
.craft-stats {
    display: flex;
    gap: 0.75rem;
    margin-left: auto;
}
.craft-stat {
    font-size: 0.82rem;
    background: var(--surface-2);
    color: var(--muted);
    padding: 0.2rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--border);
}
.craft-stat strong {
    color: var(--accent);
    font-weight: 700;
}
.craft-reset-btn {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.3rem 0.9rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.craft-reset-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface);
}

/* ── GAME LAYOUT: INVENTORY + CANVAS ────────────────────── */
.craft-app {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* ── INVENTORY (LEFT SIDEBAR) ────────────────────────────── */
.craft-inventory {
    width: 220px;
    background: var(--surface-2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.craft-inv-title {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    padding: 0.625rem 0.75rem 0.4rem;
    border-bottom: 1px solid var(--border);
}
.craft-inv-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.3rem 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.craft-inv-list::-webkit-scrollbar { width: 4px; }
.craft-inv-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.craft-inv-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    cursor: grab;
    transition: background 0.1s;
    font-size: 0.75rem;
    border: 1px solid transparent;
    color: var(--text);
}
.craft-inv-item:hover {
    background: var(--surface);
    border-color: var(--border);
}
.craft-inv-item:active {
    cursor: grabbing;
    background: var(--surface);
}
.craft-inv-item .emoji {
    font-size: 0.9rem;
    width: 1.2rem;
    text-align: center;
    flex-shrink: 0;
}
.craft-inv-item .name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── CANVAS (CENTER) ─────────────────────────────────────── */
.craft-workbench {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    min-width: 0;
    background: var(--bg);
}
.craft-drop-zone {
    position: relative;
    flex: 1;
    border: 3px dashed var(--border);
    border-radius: 14px;
    transition: border-color 0.25s, background 0.25s;
    background: var(--surface);
    min-height: 160px;
    overflow: hidden;
}
.craft-drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-bg);
}

/* ── PLACEHOLDER (empty canvas) ──────────────────────────── */
.craft-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
    pointer-events: none;
    line-height: 1.6;
}
.craft-big-emoji {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* ── CANVAS CARDS ────────────────────────────────────────── */
.craft-card {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    cursor: grab;
    font-size: 0.82rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    transition: box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
    user-select: none;
    white-space: nowrap;
    z-index: 1;
    min-width: 60px;
}
.craft-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.16);
    border-color: var(--border-strong);
    z-index: 3;
}
.craft-card:active {
    cursor: grabbing;
    box-shadow: 0 6px 20px rgba(0,0,0,0.20);
}
.craft-card.drag-hover {
    border-color: var(--accent);
    background: var(--accent-bg);
    box-shadow: 0 0 0 2px var(--accent), 0 4px 16px rgba(0,0,0,0.16);
    z-index: 2;
}
.craft-card-emoji {
    font-size: 1.3rem;
    flex-shrink: 0;
    line-height: 1;
}
.craft-card-name {
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* ── TOAST / DISCOVERY POPUP ─────────────────────────────── */
.craft-toast-container {
    position: fixed;
    top: 90px;
    right: 1.5rem;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    max-width: 360px;
    pointer-events: none;
}
.craft-toast {
    background: var(--surface);
    border-left: 4px solid var(--accent);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    animation: craftSlideIn 0.35s ease;
    pointer-events: auto;
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    border: 1px solid var(--border);
}
.craft-toast .emoji {
    font-size: 2rem;
    flex-shrink: 0;
}
.craft-toast .content {
    flex: 1;
}
.craft-toast .content .name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent);
}
.craft-toast .content .def {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.125rem;
    line-height: 1.45;
}
.craft-toast .content .tier {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

@keyframes craftSlideIn {
    from {
        opacity: 0;
        transform: translateX(2.5rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 720px) {
    .craft-inventory {
        width: 150px;
    }
    .craft-workbench {
        padding: 0.5rem;
    }
    .craft-card {
        font-size: 0.72rem;
        padding: 0.35rem 0.65rem;
        gap: 0.35rem;
    }
    .craft-card-emoji {
        font-size: 1.05rem;
    }
    .craft-card-name {
        max-width: 80px;
    }
    .craft-toolbar {
        padding: 0.4rem 0.75rem;
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    .craft-title {
        font-size: 1rem;
    }
    .craft-stat {
        font-size: 0.72rem;
        padding: 0.15rem 0.5rem;
    }
    .craft-toast-container {
        right: 0.75rem;
        left: 0.75rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .craft-inventory {
        width: 120px;
    }
    .craft-inv-item {
        font-size: 0.68rem;
        padding: 0.15rem 0.25rem;
    }
    .craft-inv-item .emoji {
        font-size: 0.78rem;
        width: 1rem;
    }
    .craft-stats {
        flex-direction: column;
        gap: 0.25rem;
    }
}
