/* ==========================================================================
   Kamos Spice Loop - Stylesheet
   Wide Atelier Studio & Circular Causal Dynamics
   ========================================================================== */

:root {
    --bg-page: #FAF8FC;
    --primary-purple: #8B5CF6;
    --primary-purple-dark: #7C3AED;
    --primary-purple-light: #DDD6FE;
    --emerald-herb: #10B981;
    --amber-spice: #F59E0B;
    --coral-chili: #EF4444;
    --cyan-fresh: #06B6D4;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(229, 231, 235, 0.85);
    --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Noto Sans JP', 'Outfit', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* --- Glassmorphic Panels --- */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
}

/* --- Main Studio Workspace Grid --- */
.studio-main-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 0.85rem;
    height: 520px;
    min-height: 480px;
}

@media (max-width: 1200px) {
    .studio-main-grid {
        grid-template-columns: 1fr 320px;
        height: 480px;
    }
}

@media (max-width: 900px) {
    .studio-main-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
    .studio-canvas-panel {
        height: 400px !important;
    }
    .studio-inspector-panel {
        max-height: 400px;
    }
}

/* --- 1. World Cuisine Carousel --- */
.cuisine-carousel {
    display: flex;
    gap: 0.65rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.35rem;
}

.cuisine-card {
    flex: 0 0 240px;
    scroll-snap-align: start;
    padding: 0.7rem 0.85rem;
    background: #ffffff;
    border: 1px solid rgba(229, 231, 235, 0.85);
    border-radius: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.cuisine-card:hover {
    border-color: var(--primary-purple-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(139, 92, 246, 0.1);
}

.cuisine-card:active {
    transform: scale(0.98);
}

.cuisine-card.active {
    background: rgba(139, 92, 246, 0.06);
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 1.5px var(--primary-purple);
}

/* --- 2. Center Graph Viewport --- */
.graph-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 280px;
    border-radius: 0.75rem;
    overflow: hidden;
    background: radial-gradient(circle at center, rgba(255,255,255,0.98) 0%, rgba(245,243,255,0.65) 100%);
    touch-action: none;
}

.spice-graph-svg {
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

.spice-graph-svg:active {
    cursor: grabbing;
}

/* Causal Graph Elements */
.causal-edge {
    fill: none;
    stroke-width: 2px;
    stroke-dasharray: 6, 3;
    animation: flowDash 30s linear infinite;
    cursor: pointer;
    transition: stroke-width 0.2s, opacity 0.2s;
}

@keyframes flowDash {
    to {
        stroke-dashoffset: -1000;
    }
}

.causal-edge.edge-plus {
    stroke: #8B5CF6;
}

.causal-edge.edge-minus {
    stroke: #06B6D4;
}

.causal-edge.edge-key {
    stroke-width: 2.5px;
}

.causal-edge.edge-highlight {
    stroke-width: 3.5px !important;
    stroke: #EC4899 !important;
    filter: url(#glow);
    animation-duration: 10s;
}

.spice-node {
    cursor: pointer;
}

.spice-node:hover .node-main-circle {
    filter: drop-shadow(0 4px 8px rgba(139, 92, 246, 0.3));
}

.spice-node.core-node .node-glow-ring {
    stroke-width: 2px;
    opacity: 0.8;
}

/* Graph Floating Controls */
.graph-floating-controls {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.4rem;
    z-index: 20;
}

.graph-control-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(229, 231, 235, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.15s ease;
}

.graph-control-btn:hover {
    background: var(--primary-purple);
    color: #ffffff;
    border-color: var(--primary-purple);
    transform: scale(1.05);
}

/* Active Spice Pills Bar */
.active-spice-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.active-spice-pill button {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 13px;
    height: 13px;
    font-size: 9px;
    color: #ffffff;
    cursor: pointer;
}

.active-spice-pill button:hover {
    background: rgba(255, 255, 255, 0.6);
}

/* --- 3. Bottom Spice Atelier Shelf Grid --- */
.spice-grid-shelf {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

@media (max-width: 640px) {
    .spice-grid-shelf {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        max-height: 200px;
    }
}

.spice-shelf-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    background: #ffffff;
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 0.65rem;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.spice-shelf-card:hover {
    border-color: var(--primary-purple-light);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
}

.spice-shelf-card.selected {
    background: rgba(139, 92, 246, 0.08);
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 1px var(--primary-purple);
}

.spice-shelf-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.65rem;
    color: #ffffff;
    flex-shrink: 0;
}

/* --- Scrollbars --- */
.custom-scroll::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
.custom-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(203, 213, 225, 0.7);
    border-radius: 4px;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.9);
}
