:root {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    
    /* Dark Glassmorphism Themes */
    --color-strength-bg: rgba(46, 125, 50, 0.15);
    --color-strength-border: rgba(102, 187, 106, 0.3);
    
    --color-weakness-bg: rgba(198, 40, 40, 0.15);
    --color-weakness-border: rgba(239, 83, 80, 0.3);
    
    --color-opportunity-bg: rgba(2, 119, 189, 0.15);
    --color-opportunity-border: rgba(79, 195, 247, 0.3);
    
    --color-threat-bg: rgba(239, 108, 0, 0.15);
    --color-threat-border: rgba(255, 167, 38, 0.3);
    --compass-size: clamp(260px, 45vw, 520px);
}

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

.hidden {
    display: none !important;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 120px;
}

/* Background Compass Layer */
.compass-background {
    position: fixed;
    width: var(--compass-size);
    height: var(--compass-size);
    z-index: 3;
    pointer-events: none;
    opacity: 0.4; /* Subtle background */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: none;
}

/* .compass-background.shifted removed as sidebar is permanent */

.compass-dial {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.05);
    position: relative;
    /* Gradient background for the dial */
    background: radial-gradient(circle, rgba(255,255,255,0.02) 0%, rgba(0,0,0,0) 70%);
}

.compass-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 75%;
    background: linear-gradient(180deg, #f5f5f5, #d0d0d0);
    transform-origin: bottom center;
    transform: translate(-50%, -100%) rotate(0deg);
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease, box-shadow 0.3s ease;
    z-index: 1200;
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45), 0 0 32px rgba(255, 255, 255, 0.08) inset;
}

.arrow-head {
    position: absolute;
    top: -44px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 44px solid #f5f5f5;
}

.compass-arrow.go {
    background: linear-gradient(180deg, #c8f7d4, #66bb6a);
    box-shadow: 0 18px 45px rgba(102, 187, 106, 0.35), 0 0 32px rgba(102, 187, 106, 0.12) inset;
}
.compass-arrow.go .arrow-head { border-bottom-color: #66bb6a; }

.compass-arrow.avoid {
    background: linear-gradient(180deg, #ffb3ab, #ef5350);
    box-shadow: 0 18px 45px rgba(239, 83, 80, 0.35), 0 0 32px rgba(239, 83, 80, 0.12) inset;
}
.compass-arrow.avoid .arrow-head { border-bottom-color: #ef5350; }

.compass-arrow.neutral {
    background: linear-gradient(180deg, #fff6d5, #ffca28);
    box-shadow: 0 18px 45px rgba(255, 202, 40, 0.28), 0 0 32px rgba(255, 202, 40, 0.1) inset;
}
.compass-arrow.neutral .arrow-head { border-bottom-color: #ffca28; }

.compass-center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.45), 0 0 6px rgba(0,0,0,0.4) inset;
    z-index: 1400;
}

/* App Container (Foreground) */
.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: rgba(18, 18, 18, 0.6); /* Slight overlay to make text readable */
    transition: filter 0.5s ease, opacity 0.5s ease;
}

.app-container.locked {
    filter: grayscale(0.8) brightness(0.5) blur(2px);
    pointer-events: none;
    user-select: none;
}

/* Pre-check Sidebar - Removed (Integrated into Decision Sidebar) */
/* .pre-check-sidebar styles removed */

header {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
    max-width: 600px;
}

header h1 {
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 15px;
}

.decision-input {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    border: none;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    background: transparent;
    color: #fff;
    text-align: center;
    font-family: inherit;
    transition: border-color 0.3s;
}

.decision-input:focus {
    outline: none;
    border-bottom-color: #fff;
}

.decision-input::placeholder {
    color: rgba(255,255,255,0.4);
    font-style: italic;
}

/* Main Grid Container */
.swot-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    flex-grow: 1;
    margin-bottom: 40px;
}

/* Quadrant Styling - Glassmorphism */
.quadrant {
    background: rgba(30, 30, 30, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quadrant:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.quadrant h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column; /* Stack subtitle */
    align-items: flex-start;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.quadrant h2 .subtitle {
    font-size: 0.7em;
    text-transform: none;
    opacity: 0.7;
    font-weight: 400;
    margin-top: 4px;
}

/* Specific Themes */
.strengths {
    background-color: var(--color-strength-bg);
    border-color: var(--color-strength-border);
}
.weaknesses {
    background-color: var(--color-weakness-bg);
    border-color: var(--color-weakness-border);
}
.opportunities {
    background-color: var(--color-opportunity-bg);
    border-color: var(--color-opportunity-border);
}
.threats {
    background-color: var(--color-threat-bg);
    border-color: var(--color-threat-border);
}

/* Points List & Items */
.points-list {
    flex-grow: 1;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.point-item {
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(0,0,0,0.3);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.3s ease;
    border-left: 4px solid transparent; /* For weight color */
}

/* Weight-based Coloring */
.point-item[data-weight="1"] {
    border-left-color: #29b6f6; /* Cold Blue */
}

.point-item[data-weight="3"] {
    border-left-color: #66bb6a; /* Neutral Green */
}

.point-item[data-weight="5"] {
    border-left-color: #ffa726; /* Warm Orange */
    background: rgba(255, 167, 38, 0.05);
}

.point-item[data-weight="10"] {
    border-left-color: #ef5350; /* Hot Red */
    background: rgba(239, 83, 80, 0.15);
    box-shadow: 0 2px 8px rgba(239, 83, 80, 0.2);
}

.point-text {
    flex-grow: 1;
    border: none;
    border-radius: 4px;
    padding: 8px;
    font-family: inherit;
    background: transparent;
    color: #fff;
}

.point-text::placeholder {
    color: rgba(255,255,255,0.4);
}

.point-text:focus {
    outline: none;
    background: rgba(255,255,255,0.05);
}

.selectors-container {
    display: flex;
    gap: 4px;
}

.point-weight, .point-probability {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    background: #222;
    color: #fff;
    font-family: inherit;
    cursor: pointer;
    font-size: 0.8rem;
    max-width: 100px;
}

.point-probability {
    border-color: rgba(100, 181, 246, 0.3);
    color: #90caf9;
}

.delete-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
    transition: color 0.2s;
}

.delete-btn:hover {
    color: #ef5350;
}

.add-btn {
    background: rgba(255,255,255,0.05);
    border: 1px dashed rgba(255,255,255,0.2);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    transition: all 0.2s;
}

.add-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-style: solid;
}

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

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

.modal-content {
    background: #1e1e1e;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal-content {
    transform: translateY(20px);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.5;
}

.close-modal:hover {
    opacity: 1;
}

#modal-title {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #fff;
}

#modal-message {
    font-size: 1.2rem;
    margin-bottom: 20px;
    line-height: 1.5;
    color: #ccc;
}

.score-display {
    font-size: 0.9rem;
    color: #888;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Decision Sidebar (Always Visible) */
.decision-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 350px;
    height: 100vh;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-left: 1px solid rgba(255,255,255,0.1);
    padding: 30px;
    z-index: 100;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    overflow-y: auto;
    padding-right: 25px;
}

.decision-sidebar::-webkit-scrollbar {
    width: 6px;
}

.decision-sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.04);
}

.decision-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

/* Adjust main container */
.app-container {
    padding-right: 370px; /* Always padded */
    transition: padding 0.3s ease;
}

/* Mobile adjustment for app container */
@media (max-width: 768px) {
    .app-container {
        padding-right: 20px;
        padding-bottom: 100px;
    }
    
    .decision-sidebar {
        width: 100%;
        height: auto;
        min-height: 300px;
        top: auto;
        bottom: 0;
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.1);
        transform: translateY(0);
        border-radius: 20px 20px 0 0;
        z-index: 200;
    }
}

#active-process-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 20px;
}

#active-process-container.hidden {
    display: none;
}

.sidebar-phase {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.45);
    margin-bottom: 18px;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.sidebar-phase.hidden {
    display: none;
}

.sidebar-phase h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: #fff;
    letter-spacing: 1px;
}

.emotion-buttons-vertical {
    display: flex;
    gap: 10px;
    background: rgba(255,255,255,0.02);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
}

.emotion-btn {
    flex: 1;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    color: #fff;
    font-weight: 600;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.emotion-btn.selected {
    background: linear-gradient(135deg, #66bb6a, #81c784);
    border-color: #66bb6a;
    color: #0f1b13;
    box-shadow: 0 8px 28px rgba(102,187,106,0.35);
}

.emotion-btn:focus-visible {
    outline: 2px solid rgba(102,187,106,0.7);
}

.final-summary-box {
    padding: 18px;
    border-radius: 14px;
    background: rgba(0,0,0,0.3);
}

#phase-decision {
    background: linear-gradient(180deg, rgba(102,187,106,0.12), rgba(13,21,23,0.85));
}

#phase-decision textarea {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 12px;
    color: #fff;
    font-family: inherit;
    resize: none;
    min-height: 70px;
    transition: border 0.2s ease;
}

#phase-decision textarea:focus {
    outline: none;
    border-color: #81c784;
}

.commit-btn {
    margin-top: 12px;
    padding: 12px;
    border: none;
    border-radius: 12px;
    width: 100%;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    background: linear-gradient(135deg, #81c784, #4caf50);
    color: #0c1a0f;
    box-shadow: 0 12px 30px rgba(76,175,80,0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Sidebar Sections */
.sidebar-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-section h3 {
    font-size: 1rem;
    color: #81c784;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
}

.pre-check-box {
    width: 18px;
    height: 18px;
    accent-color: #66bb6a;
    cursor: pointer;
}

.phase-note {
    font-size: 1rem;
    color: #ff5252;
    margin: 10px 0;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.warning-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 10px;
    font-size: 0.8rem;
    line-height: 1.3;
    color: rgba(255,255,255,0.85);
}

.global-timeline {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 8px 20px 12px 20px;
    background: linear-gradient(180deg, rgba(0,0,0,0.7), rgba(0,0,0,0.4));
    border-top: 1px solid rgba(255,255,255,0.1);
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.6);
}

.timeline-steps {
    display: none;
}

.timeline-step {
    position: relative;
}

.timeline-step.active {
    color: #81c784;
}

.timeline-track {
    position: relative;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    overflow: hidden;
}

.timeline-reflection {
    position: absolute;
    top: -2px;
    left: 0;
    height: 10px;
    width: 0;
    background: rgba(255, 82, 82, 0.75);
    pointer-events: none;
    border-radius: 999px;
    display: none;
    z-index: 3;
}

.timeline-session-timer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: #ffca28; /* Yellow */
    opacity: 0.6;
    z-index: 2;
    border-radius: 999px;
    transition: width 1s linear;
}

.timeline-progress {
    height: 100%;
    position: relative;
    z-index: 1;
    width: 0;
    background: linear-gradient(90deg, #66bb6a, #ffa726);
    transition: width 0.6s ease;
}

.timeline-indicator {
    position: absolute;
    top: -4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #81c784;
    box-shadow: 0 0 12px rgba(129,199,132,0.8);
    transform: translateX(-50%);
    left: 0%;
    animation: pulse 2s infinite;
    z-index: 4;
}

.timeline-label {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    letter-spacing: 0.5px;
}

.timeline-label,
.timeline-steps {
    display: none;
}

.timeline-indicator::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    animation: moveGlow 4s linear infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(129,199,132,0.5); }
    70% { box-shadow: 0 0 12px 6px rgba(129,199,132,0); }
    100% { box-shadow: 0 0 0 0 rgba(129,199,132,0); }
}

@keyframes moveGlow {
    0% { transform: scale(0.85); }
    50% { transform: scale(1.1); }
    100% { transform: scale(0.85); }
}

/* History Panel */
.history-section {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 15px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #81c784;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.history-toggle {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: background 0.2s ease;
}

.history-toggle:hover {
    background: rgba(255,255,255,0.18);
}

.history-body {
    overflow: hidden;
    transition: max-height 0.3s ease;
    max-height: 320px;
}

.history-body.collapsed {
    max-height: 0;
}

.history-list {
    max-height: 240px;
    overflow-y: auto;
    gap: 10px;
    display: flex;
    flex-direction: column;
    margin-top: 5px;
    padding-right: 5px;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}

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

.history-item {
    background: rgba(0,0,0,0.35);
    border-radius: 10px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0,0,0,0.4);
}

.history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.history-delete {
    border: none;
    background: rgba(255,255,255,0.08);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s ease;
}

.history-delete:hover {
    background: rgba(255,0,0,0.8);
}

.history-name {
    font-weight: 600;
    color: #fff;
    font-size: 0.95rem;
    margin-bottom: 0;
}

.history-date {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
}

.history-verdict {
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.empty-history {
    font-style: italic;
    color: rgba(255,255,255,0.5);
    padding: 10px;
    text-align: center;
}

/* Controls Area */
.sidebar-actions {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.calculate-btn {
    width: 100%;
    background: #fff;
    color: #000;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    font-size: 1.1rem;
    letter-spacing: 1px;
    box-shadow: 0 0 20px rgba(255,255,255,0.1);
    transition: all 0.2s;
}

.calculate-btn:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(255,255,255,0.2);
}

.calculate-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.calculate-btn:disabled {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.3);
    cursor: not-allowed;
    box-shadow: none;
}

.new-decision-btn {
    width: 100%;
    padding: 13px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.new-decision-btn:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-1px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.3);
}

.new-decision-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
