/* ===== Variables & Base Styles ===== */
:root {
    /* Default Dark Theme */
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-gradient: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));

    /* Canvas / Scrapbook Grid */
    --canvas-bg: var(--bg-dark);
    --canvas-dot: rgba(255, 255, 255, 0.05);

    /* Block Categories styling */
    --block-narrative: rgba(255, 255, 255, 0.08); /* clean frosted glass */
    --block-creative: rgba(236, 72, 153, 0.1);    /* pinkish tint */
    --block-reflection: rgba(59, 130, 246, 0.1);  /* blueish tint */
    --block-states: rgba(16, 185, 129, 0.1);      /* greenish tint */

    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.4);

    --transition-fast: 0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Dynamic Mood Themes --- */
:root[data-theme="happy"] {
    --bg-dark: #2a110a;
    --bg-darker: #1a0a05;
    --canvas-bg: #2a110a;
    --canvas-dot: rgba(255, 165, 0, 0.1);
    --accent-gradient: linear-gradient(135deg, #f59e0b, #ea580c);
}

:root[data-theme="calm"] {
    --bg-dark: #0f1c2e;
    --bg-darker: #060b14;
    --canvas-bg: #0f1c2e;
    --canvas-dot: rgba(56, 189, 248, 0.07);
    --accent-gradient: linear-gradient(135deg, #38bdf8, #818cf8);
}

:root[data-theme="sad"] {
    --bg-dark: #1e1e24;
    --bg-darker: #0d0d12;
    --canvas-bg: #1e1e24;
    --canvas-dot: rgba(148, 163, 184, 0.05);
    --accent-gradient: linear-gradient(135deg, #64748b, #475569);
}

:root[data-theme="energetic"] {
    --bg-dark: #2e091e;
    --bg-darker: #17040f;
    --canvas-bg: #2e091e;
    --canvas-dot: rgba(236, 72, 153, 0.1);
    --accent-gradient: linear-gradient(135deg, #ec4899, #f43f5e);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-darker);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    transition: background-color 1s ease;
}

.handwriting-font {
    font-family: 'Caveat', cursive;
    font-size: 1.4rem !important;
    line-height: 1.2;
}

/* ===== Full Screen Frame ===== */
.device-frame {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    background-color: var(--bg-dark);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background-color 1s ease;
}

@media (min-width: 768px) {
    .device-frame {
        height: 100vh;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
}

/* ===== App Header ===== */
.app-header {
    position: relative;
    padding: 2rem 1.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(0,0,0,0.4), transparent);
    z-index: 10;
    pointer-events: none; /* Let clicks pass through to canvas underneath if needed */
}

.header-content, .settings-btn, .header-actions {
    pointer-events: auto;
}

.header-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: background 1s ease;
}

.date {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.settings-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: var(--transition-fast);
}

.settings-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* ===== Scrapbook Canvas ===== */
.app-content {
    flex: 1;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    overflow: hidden;
    cursor: grab;
}

.app-content:active {
    cursor: grabbing;
}

/* ===== View Layers (Infinite Canvases) ===== */
.view-layer {
    width: 5000px;
    height: 5000px;
    position: absolute;
    top: -2500px;
    left: -2500px;
    transform-origin: center center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

.view-layer.active {
    opacity: 1;
    pointer-events: auto;
}

.journal-canvas {
    /* Dotted grid background */
    background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center;
}

/* ===== Galaxy Themes ===== */
.theme-health {
    --bg-center: #092c20;
    --bg-edge: #020a07;
    --star-primary: #10b981;
    --star-primary-rgb: 16, 185, 129;
}
.theme-career {
    --bg-center: #20133c;
    --bg-edge: #090412;
    --star-primary: #a78bfa;
    --star-primary-rgb: 167, 139, 250;
}
.theme-art {
    --bg-center: #331525;
    --bg-edge: #14040e;
    --star-primary: #ec4899;
    --star-primary-rgb: 236, 72, 153;
}
.theme-relationships {
    --bg-center: #3d2310;
    --bg-edge: #170d04;
    --star-primary: #f59e0b;
    --star-primary-rgb: 245, 158, 11;
}

.star-map-canvas {
    /* Deep space aesthetic customized by themes */
    background: radial-gradient(circle at center, var(--bg-center, #0B0E14) 0%, var(--bg-edge, #030406) 100%);
    /* Basic static stars for depth using multiple box shadows trick */
    background-image: 
        radial-gradient(1px 1px at 20px 30px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 40px 70px, rgba(255,255,255,0.8), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 50px 160px, rgba(255,255,255,0.6), rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 40px, rgba(255,255,255,0.9), rgba(0,0,0,0)),
        radial-gradient(2px 2px at 130px 80px, rgba(255,255,255,0.4), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 160px 120px, rgba(255,255,255,0.7), rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 200px 200px;
}

/* ===== SVG Connection Layer ===== */
.canvas-links {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas/blocks */
    z-index: 10;
}

.connection-path {
    fill: none;
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 1.5px;
    stroke-linecap: round;
    opacity: 0.15;
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.connection-path.completed {
    stroke: var(--star-primary, #fcd34d);
    stroke-width: 3px;
    opacity: 0.8;
    filter: drop-shadow(0 0 8px var(--star-primary, #fcd34d));
}

.connection-path.temp {
    stroke-dasharray: 6;
    animation: dash 1s linear infinite;
    opacity: 0.5;
}

@keyframes dash {
    to {
        stroke-dashoffset: -12;
    }
}

.canvas-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-weight: 300;
    font-size: 1.3rem;
    font-family: 'Caveat', cursive;
    text-align: center;
    opacity: 0.5;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.canvas-placeholder.hidden {
    opacity: 0;
}

/* ===== Toolbox (Drawer) ===== */
.toolbox {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60vh;
    background: rgba(10, 15, 25, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid var(--glass-border);
    border-radius: 30px 30px 0 0;
    padding: 1rem 1.5rem;
    transform: translateY(calc(100% - 60px));
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 99999;
    display: flex;
    flex-direction: column;
}

.toolbox.active {
    transform: translateY(0);
}

/* ===== Node Connectors (Input & Output) ===== */
.node {
    width: 14px;
    height: 14px;
    background: var(--bg-darker);
    border: 2px solid var(--accent-blue);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    cursor: crosshair;
    z-index: 5;
    transition: all 0.2s ease;
    box-shadow: 0 0 0 2px var(--bg-dark);
}

.node:hover {
    background: var(--accent-blue);
    transform: translateY(-50%) scale(1.3);
    box-shadow: 0 0 10px var(--accent-blue);
}

.node-in {
    left: -8px;
}

.node-out {
    right: -8px;
}

/* ===== Block Resizer ===== */
.block-resizer {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 24px;
    height: 24px;
    background: transparent;
    cursor: se-resize;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.canvas-block:hover .block-resizer {
    opacity: 0.8;
}

.block-resizer:hover {
    color: var(--text);
}

/* Content modifications to handle resizing */
.canvas-block textarea {
    resize: none; /* Handled by block resizer */
    width: 100%;
    height: 100%;
    min-height: 80px;
    flex-grow: 1;
}

.canvas-container {
    width: 100%;
    height: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.doodle-canvas {
    width: 100% !important; /* Override inline styling for resize */
    height: 100% !important;
    min-height: 150px;
}

/* Responsive inner layout */
.block-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.toolbox-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 1rem;
    cursor: pointer;
    flex-shrink: 0;
}

.drag-indicator {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin-top: 0.5rem;
    transition: width 0.3s;
}

.toolbox.active .drag-indicator {
    width: 60px;
    background: rgba(255,255,255,0.4);
}

.toolbox-header h3 {
    font-weight: 500;
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.block-categories {
    overflow-y: auto;
    flex: 1;
    padding-bottom: 2rem;
    /* scrollbar hiding */
    -ms-overflow-style: none;  
    scrollbar-width: none;  
}

.block-categories::-webkit-scrollbar { 
    display: none; 
}

.category-title {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.4);
    margin: 1.5rem 0 0.8rem;
    padding-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.block-palette {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

.palette-block {
    padding: 1rem 0.8rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: grab;
    transition: var(--transition-fast);
}

.palette-block i {
    font-size: 1.4rem;
    opacity: 0.8;
}

.palette-block:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

/* Category Colors in Palette */
#palette-narrative .palette-block i { color: #f8fafc; }
#palette-creative .palette-block i { color: #ec4899; }
#palette-reflection .palette-block i { color: #3b82f6; }
#palette-states .palette-block i { color: #10b981; }

/* ===== Custom Ghost Block for Dragging ===== */
.ghost-block {
    opacity: 0.5;
    transform: scale(0.95);
}

/* ===== Scrapbook Canvas Blocks (Absolute Positioned) ===== */
.canvas-block {
    position: absolute;
    width: 280px;
    background: rgba(20, 25, 35, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    animation: dropIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
    /* transition for subtle scale on active */
    transition: box-shadow 0.2s, transform 0.1s;
    user-select: none;
}

.canvas-block.active-drag {
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    z-index: 50 !important;
    cursor: grabbing !important;
}

@keyframes dropIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== Habit Sidebar ===== */
.habit-sidebar {
    position: absolute;
    top: 90px;
    bottom: 90px;
    left: -350px;
    width: 320px;
    background: rgba(10, 15, 25, 0.85);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255,255,255,0.1);
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
    z-index: 900;
    transition: left 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    color: white;
}

.habit-sidebar.active {
    left: 0;
}

.habit-sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.habit-sidebar-header h3 {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    color: #a78bfa;
    display: flex;
    align-items: center;
    gap: 10px;
}

#close-habits-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}
#close-habits-btn:hover { color: white; }

.habit-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Habit Items */
.habit-category h4 {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.4);
}
.habit-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.habit-item:hover {
    background: rgba(255,255,255,0.08);
}
.habit-item.done {
    opacity: 0.6;
}
.habit-item .checkbox {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(255,255,255,0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    color: transparent;
    transition: all 0.2s;
}
.habit-item.done .checkbox {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

/* Block Type Themes */
.block-freewrite, .block-story, .block-scene { border-top: 3px solid rgba(255,255,255,0.4); }
.block-doodle, .block-music, .block-photo { border-top: 3px solid var(--accent-pink); }
.block-highlight, .block-prompt, .block-metaphor { border-top: 3px solid var(--accent-blue); }
.block-mood, .block-energy, .block-focus { border-top: 3px solid #10b981; }
.block-goal { border-top: 3px solid #fbbf24; }
.goal-completed-glow { 
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.4) !important; 
    border-color: #fbbf24 !important; 
    transition: all 0.5s ease;
}

.block-body {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* Drag Handle Component */
.block-drag-handle {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.6);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: grab;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.block-drag-handle:active {
    cursor: grabbing;
}

.block-drag-handle i:first-child {
    opacity: 0.5;
}

/* --- Common Inner Block Elements --- */
.block-input, .block-textarea, .block-select {
    width: 100%;
    background: transparent;
    border: none;
    color: white;
    font-family: 'Outfit', sans-serif;
    outline: none;
}

.block-textarea {
    resize: none;
    min-height: 80px;
    line-height: 1.5;
}

.block-input::placeholder, .block-textarea::placeholder {
    color: rgba(255,255,255,0.3);
}

.block-input {
    font-size: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.block-select {
    appearance: none;
    background: rgba(0,0,0,0.2);
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
}

/* --- Specific Block Styles --- */

.title-input {
    font-weight: 600;
    font-size: 1.1rem;
}

.large-text {
    font-size: 2rem !important;
}

/* Doodle */
.canvas-container {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    cursor: crosshair;
}

.doodle-canvas {
    display: block;
    width: 100%;
    height: 200px;
}

.doodle-tools {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
}

.color-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.2);
    cursor: pointer;
}

.color-btn.selected {
    box-shadow: 0 0 0 2px #333;
}

.clear-canvas {
    margin-left: auto;
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
}

/* Music */
.mock-player {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0,0,0,0.3);
    padding: 0.8rem;
    border-radius: 12px;
    margin-top: 0.5rem;
}

.album-art {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: rgba(255,255,255,0.5);
}

.track-info {
    flex: 1;
    overflow: hidden;
}

.track-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artist { font-size: 0.75rem; color: rgba(255,255,255,0.5); }

.play-btn { font-size: 1.5rem; color: var(--accent-pink); cursor: pointer; }

/* Metaphor */
.metaphor-header { font-size: 0.9rem; margin-bottom: 0.5rem; color: rgba(255,255,255,0.8); }
.metaphor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.met-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.8rem 0.5rem;
    border-radius: 8px;
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
}
.met-btn i { font-size: 1.2rem; }
.met-btn:hover, .met-btn.active { background: rgba(59, 130, 246, 0.2); border-color: var(--accent-blue); }

/* Prompts */
.prompt-text {
    font-family: 'Caveat', cursive;
    font-size: 1.4rem;
    color: var(--accent-blue);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.shuffle-prompt-btn {
    background: rgba(255,255,255,0.05);
    border: none;
    color: rgba(255,255,255,0.6);
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
}
.shuffle-prompt-btn:hover { background: rgba(255,255,255,0.1); color: white; }

/* Photo */
.photo-upload-area {
    width: 100%;
    height: 120px;
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    color: rgba(255,255,255,0.5);
    transition: var(--transition-fast);
}
.photo-upload-area:hover { border-color: white; color: white; background: rgba(255,255,255,0.05); }

.photo-upload-mini {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255,255,255,0.05);
    border-radius: 20px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    width: fit-content;
}

/* === EXPRESSIVE VISUAL TRACKERS === */

/* Mood Themes */
.mood-selector {
    display: flex;
    justify-content: space-between;
}
.mood-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: rgba(255,255,255,0.05);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-fast);
}
.mood-btn:hover { transform: scale(1.1); }
.mood-btn.active { background: rgba(255,255,255,0.2); border-color: white; }

.mood-btn[data-mood="sad"] { color: #94a3b8; }
.mood-btn[data-mood="calm"] { color: #38bdf8; }
.mood-btn[data-mood="energetic"] { color: #ec4899; }
.mood-btn[data-mood="happy"] { color: #f59e0b; }

/* Visual Progression Tracker (Energy/Focus) */
.visual-tracker {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 0.5rem 0;
}

.tracker-line {
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: rgba(255,255,255,0.1);
    z-index: 1;
    transform: translateY(-50%);
}

.state-node {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #1e293b;
    color: rgba(255,255,255,0.3);
    font-size: 1rem;
    cursor: pointer;
    z-index: 2;
    transition: var(--transition-fast);
}

.state-node:hover {
    transform: scale(1.2);
    color: rgba(255,255,255,0.8);
}

/* Energy Active States (Fire metaphor) */
.energy-tracker .state-node.active { color: #ef4444; background: rgba(239, 68, 68, 0.2); transform: scale(1.1); border: 1px solid #ef4444; box-shadow: 0 0 15px rgba(239, 68, 68, 0.4); }

/* Focus Active States (Clarity metaphor) */
.focus-tracker .state-node.active { color: #fbbf24; background: rgba(251, 191, 36, 0.2); transform: scale(1.1); border: 1px solid #fbbf24; box-shadow: 0 0 15px rgba(251, 191, 36, 0.4); }

/* Previous Node states (to show progress line) */
.state-node.passed { color: rgba(255,255,255,0.6); }

/* ===== Galaxy Navigation Overlay ===== */
#galaxy-nav-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none; /* Let clicks pass through by default */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#galaxy-nav-overlay.hidden {
    opacity: 0;
}

#galaxy-nav-overlay > * {
    pointer-events: auto; /* Re-enable clicks on controls */
}

.galaxy-nav-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.galaxy-nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
}

.galaxy-info {
    text-align: center;
    background: rgba(10, 15, 25, 0.6);
    padding: 1rem 2.5rem;
    border-radius: 40px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: translateY(-40vh); /* Push to the top of the screen */
}

#current-galaxy-title {
    margin: 0;
    font-size: 1.8rem;
    color: white;
    font-weight: 600;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.galaxy-subtitle {
    margin: 0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 5px;
}

/* ===== Tutorial Overlay ===== */
.tutorial-overlay {
    position: fixed;
    top: auto;
    left: auto;
    bottom: 30px;
    right: 30px;
    background: rgba(10, 15, 25, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--accent-blue);
    border-radius: 16px;
    padding: 1.5rem;
    width: 320px;
    color: white;
    z-index: 99999;
    box-shadow: 0 10px 40px rgba(59, 130, 246, 0.3);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.tutorial-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

.tutorial-overlay h3 {
    margin: 0 0 10px 0;
    color: var(--accent-blue);
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tutorial-overlay p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    line-height: 1.4;
    margin-bottom: 15px;
}

.tut-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#tut-next {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

#tut-skip {
    font-size: 0.8rem;
    padding: 6px 10px;
}

.tut-progress {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
}

/* ===== Modals ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Wizard Specific Styles */
.wizard-content {
    background: rgba(10, 15, 25, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    width: 400px;
    color: white;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.wizard-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.wizard-close:hover {
    color: white;
}

.wizard-step {
    display: none;
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 8px; /* Room for scrollbar */
    animation: fadeInStep 0.3s ease forwards;
}

.wizard-step::-webkit-scrollbar,
.habit-sidebar-content::-webkit-scrollbar {
    width: 6px;
}
.wizard-step::-webkit-scrollbar-thumb,
.habit-sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.wizard-step.active {
    display: block;
}

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

.wizard-step h3 {
    margin: 0 0 0.5rem 0;
    font-family: 'Outfit', sans-serif;
    color: #fcd34d;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wiz-desc {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    line-height: 1.4;
}

.text-accent {
    color: #fcd34d;
    font-weight: 600;
}

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1.5rem; }

.dynamic-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.wiz-nav-buttons {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.btn-primary {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    background: linear-gradient(135deg, #fce18a, #f59e0b);
    color: #451a03;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-ghost {
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.1);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.subgoal-panel {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}
.subgoal-panel-title {
    font-size: 0.85rem;
    color: #a78bfa;
    margin-bottom: 8px;
    font-family: 'Outfit', sans-serif;
}


/* ===== Star Nodes (Goal Map) ===== */
.star-node {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, width 0.3s ease, height 0.3s ease;
    /* Default properties for a new star */
    width: 6px;
    height: 6px;
    background: white;
    box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.5);
    z-index: 1000;
}

.star-node:hover {
    transform: translate(-50%, -50%) scale(1.5);
}

.star-label {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    font-family: 'Outfit', sans-serif;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.star-node:hover .star-label {
    opacity: 1;
}

/* Habit glow vs Milestone glow */
.star-node[data-type="habit"] {
    background: radial-gradient(circle at 30% 30%, #fff 0%, var(--star-primary) 100%);
    box-shadow: 0 0 15px 3px rgba(var(--star-primary-rgb), 0.6), inset -1px -1px 3px rgba(0,0,0,0.3);
}

.star-node[data-type="milestone"] {
    background: radial-gradient(circle at 30% 30%, #fff 0%, var(--star-primary) 100%);
    box-shadow: 0 0 20px 4px rgba(var(--star-primary-rgb), 0.6), inset -1px -1px 3px rgba(0,0,0,0.3);
}

@keyframes supernova {
    0% { transform: translate(-50%, -50%) scale(1); filter: brightness(1) contrast(1); }
    20% { transform: translate(-50%, -50%) scale(0.6); filter: brightness(2) contrast(1.5); box-shadow: 0 0 20px 5px rgba(var(--star-primary-rgb), 1); }
    40% { transform: translate(-50%, -50%) scale(12); filter: brightness(4) contrast(2); box-shadow: 0 0 150px 40px rgba(var(--star-primary-rgb), 1); background: white; }
    100% { transform: translate(-50%, -50%) scale(1); filter: brightness(1) contrast(1); }
}

.supernova-anim {
    animation: supernova 1s ease-out forwards;
    pointer-events: none;
    z-index: 2000;
}

/* Date Picker Styling */
.date-picker-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    padding: 6px 12px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    margin-top: 4px;
}

.date-picker-input:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.date-picker-input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--color-primary);
    color: white;
}

/* Hide the default calendar icon to keep it clean */
.date-picker-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.5;
    cursor: pointer;
}

.date-picker-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.btn-google {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: white;
    color: #333;
    border: 1px solid #ddd;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Outfit', sans-serif;
    margin-top: 10px;
}

.btn-google:hover {
    background: #f8f8f8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-google i {
    color: #4285F4;
    font-size: 1.1rem;
}

/* Block Header - Trash Button */
.block-drag-handle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.btn-delete-block {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.btn-delete-block:hover {
    background: rgba(244, 63, 94, 0.2);
    color: #fb7185;
    transform: scale(1.1);
}

/* Font Awesome Spin Animation Fallback */
@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.fa-spin {
    animation: fa-spin 2s infinite linear;
}
