/* Habit Streak Pro - Premium CSS */
/* Dark/Light Theme Support */

/* ============ CSS Variables ============ */
:root {
    --hsp-bg: #f8fafc;
    --hsp-surface: rgba(255, 255, 255, 0.95);
    --hsp-surface-alt: rgba(248, 250, 252, 0.9);
    --hsp-border: rgba(148, 163, 184, 0.2);
    --hsp-text: #0f172a;
    --hsp-text-muted: #64748b;
    --hsp-accent: #22c55e;
    --hsp-accent-glow: rgba(34, 197, 94, 0.3);
    --hsp-purple: #8b5cf6;
    --hsp-blue: #3b82f6;
    --hsp-orange: #f59e0b;
    --hsp-pink: #ec4899;
    --hsp-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
    --hsp-shadow-lg: 0 30px 80px rgba(15, 23, 42, 0.18);
    --hsp-radius: 20px;
    --hsp-radius-lg: 28px;
}

[data-theme="dark"] {
    --hsp-bg: #0f172a;
    --hsp-surface: rgba(30, 41, 59, 0.9);
    --hsp-surface-alt: rgba(15, 23, 42, 0.95);
    --hsp-border: rgba(71, 85, 105, 0.4);
    --hsp-text: #f1f5f9;
    --hsp-text-muted: #94a3b8;
    --hsp-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    --hsp-shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.5);
}

/* ============ Canvas Background ============ */
#heroCanvas {
    position: fixed;
    inset: 0;
    z-index: -10;
    pointer-events: none;
}

/* ============ App Container ============ */
.hsp-app {
    min-height: 100vh;
    background: var(--hsp-bg);
    color: var(--hsp-text);
    transition: background 0.3s, color 0.3s;
}

/* ============ Header ============ */
.hsp-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--hsp-surface);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--hsp-border);
    padding: 12px 0;
}

.hsp-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hsp-back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--hsp-text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.hsp-back-link:hover {
    color: var(--hsp-text);
}

.hsp-nav-actions {
    display: flex;
    gap: 8px;
}

.hsp-icon-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: var(--hsp-surface-alt);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hsp-text-muted);
    transition: all 0.2s;
}

.hsp-icon-btn:hover {
    background: var(--hsp-accent);
    color: #fff;
    transform: scale(1.05);
}

[data-theme="dark"] .icon-sun {
    display: none;
}

[data-theme="dark"] .icon-moon {
    display: block !important;
}

/* ============ Hero Section ============ */
.hsp-hero {
    padding: 60px 0 40px;
}

.hsp-hero-glass {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    padding: 40px;
    background: var(--hsp-surface);
    backdrop-filter: blur(24px);
    border-radius: var(--hsp-radius-lg);
    border: 1px solid var(--hsp-border);
    box-shadow: var(--hsp-shadow-lg);
}

.hsp-hero-badge {
    display: inline-block;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--hsp-purple), var(--hsp-pink));
    color: #fff;
    border-radius: 20px;
    margin-bottom: 12px;
}

.hsp-hero-title {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, var(--hsp-text), var(--hsp-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hsp-hero-subtitle {
    margin: 12px 0 24px;
    font-size: 1.1rem;
    color: var(--hsp-text-muted);
    max-width: 420px;
    line-height: 1.6;
}

.hsp-hero-cta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn.large {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn.large svg {
    margin-right: 8px;
}

/* Level Display */
.hsp-hero-stats {
    text-align: center;
}

.hsp-level-display {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hsp-level-ring {
    position: relative;
    width: 120px;
    height: 120px;
}

.hsp-level-svg {
    transform: rotate(-90deg);
}

.hsp-level-bg {
    fill: none;
    stroke: var(--hsp-border);
    stroke-width: 8;
}

.hsp-level-progress {
    fill: none;
    stroke: url(#levelGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 326.7;
    stroke-dashoffset: 326.7;
    transition: stroke-dashoffset 0.8s ease;
}

.hsp-level-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hsp-level-num {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--hsp-accent);
}

.hsp-level-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--hsp-text-muted);
}

.hsp-xp-info {
    margin-top: 12px;
    text-align: center;
}

.hsp-xp-current {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--hsp-accent);
}

.hsp-xp-next {
    font-size: 0.8rem;
    color: var(--hsp-text-muted);
}

.hsp-trust-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--hsp-text-muted);
    padding: 8px 14px;
    background: var(--hsp-surface-alt);
    border-radius: 20px;
}

/* ============ Metrics Grid ============ */
.hsp-metrics {
    padding: 0 0 32px;
}

.hsp-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.hsp-metric-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--hsp-surface);
    border-radius: var(--hsp-radius);
    border: 1px solid var(--hsp-border);
    box-shadow: var(--hsp-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.hsp-metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hsp-shadow-lg);
}

.hsp-metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.hsp-metric-card.accent-green::before {
    background: var(--hsp-accent);
}

.hsp-metric-card.accent-orange::before {
    background: var(--hsp-orange);
}

.hsp-metric-card.accent-blue::before {
    background: var(--hsp-blue);
}

.hsp-metric-card.accent-purple::before {
    background: var(--hsp-purple);
}

.hsp-metric-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    flex-shrink: 0;
}

.accent-green .hsp-metric-icon {
    background: rgba(34, 197, 94, 0.15);
    color: var(--hsp-accent);
}

.accent-orange .hsp-metric-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--hsp-orange);
}

.accent-blue .hsp-metric-icon {
    background: rgba(59, 130, 246, 0.15);
    color: var(--hsp-blue);
}

.accent-purple .hsp-metric-icon {
    background: rgba(139, 92, 246, 0.15);
    color: var(--hsp-purple);
}

.hsp-metric-data {
    flex: 1;
}

.hsp-metric-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.hsp-metric-label {
    font-size: 0.85rem;
    color: var(--hsp-text-muted);
    margin-top: 4px;
}

.hsp-metric-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
}

.hsp-metric-badge.up {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.hsp-metric-badge.down {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.hsp-metric-ring {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
}

.hsp-ring-bg {
    fill: none;
    stroke: var(--hsp-border);
    stroke-width: 3;
}

.hsp-ring-fill {
    fill: none;
    stroke: var(--hsp-accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 0.5s ease;
}

/* ============ Tabs ============ */
.hsp-main {
    padding: 0 0 60px;
}

.hsp-tabs {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: var(--hsp-surface);
    border-radius: 16px;
    box-shadow: var(--hsp-shadow);
    margin-bottom: 24px;
    overflow-x: auto;
}

.hsp-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--hsp-text-muted);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.hsp-tab:hover {
    background: var(--hsp-surface-alt);
    color: var(--hsp-text);
}

.hsp-tab.active {
    background: var(--hsp-accent);
    color: #fff;
    box-shadow: 0 4px 12px var(--hsp-accent-glow);
}

.hsp-tab svg {
    flex-shrink: 0;
}

/* ============ Panels ============ */
.hsp-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.hsp-panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hsp-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.hsp-panel-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.hsp-panel-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hsp-date {
    font-size: 0.9rem;
    color: var(--hsp-text-muted);
    padding: 6px 12px;
    background: var(--hsp-surface-alt);
    border-radius: 8px;
}

.hsp-panel-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.hsp-select-small {
    padding: 8px 12px;
    font-size: 0.85rem;
    border: 1px solid var(--hsp-border);
    background: var(--hsp-surface);
    color: var(--hsp-text);
    border-radius: 10px;
    cursor: pointer;
}

.btn.small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* ============ Habits Grid ============ */
.hsp-habits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.hsp-empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 80px 40px;
    background: var(--hsp-surface);
    border-radius: var(--hsp-radius-lg);
    border: 2px dashed var(--hsp-border);
}

.hsp-empty-icon {
    margin-bottom: 20px;
    color: var(--hsp-purple);
}

.hsp-empty-state h3 {
    margin: 0 0 12px;
    font-size: 1.5rem;
    font-weight: 800;
}

.hsp-empty-state p {
    margin: 0 0 24px;
    color: var(--hsp-text-muted);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============ Habit Card ============ */
.hsp-habit-card {
    background: var(--hsp-surface);
    border-radius: var(--hsp-radius);
    border: 1px solid var(--hsp-border);
    box-shadow: var(--hsp-shadow);
    padding: 20px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.hsp-habit-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hsp-shadow-lg);
}

.hsp-habit-card.completed {
    border-left: 4px solid var(--hsp-accent);
}

.hsp-habit-card.completed::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, transparent 50%, rgba(34, 197, 94, 0.1) 50%);
}

.hsp-habit-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.hsp-habit-info {
    flex: 1;
}

.hsp-habit-name {
    margin: 0 0 6px;
    font-size: 1.1rem;
    font-weight: 700;
}

.hsp-habit-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hsp-habit-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.hsp-badge-health {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.hsp-badge-productivity {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.hsp-badge-learning {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
}

.hsp-badge-mindfulness {
    background: rgba(236, 72, 153, 0.12);
    color: #db2777;
}

.hsp-badge-fitness {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.hsp-badge-type {
    background: var(--hsp-surface-alt);
    color: var(--hsp-text-muted);
}

.hsp-habit-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--hsp-purple), var(--hsp-pink));
    border-radius: 14px;
    color: #fff;
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* Habit Input Controls */
.hsp-habit-control {
    margin-bottom: 16px;
}

.hsp-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hsp-toggle {
    position: relative;
    width: 60px;
    height: 32px;
    background: var(--hsp-border);
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.hsp-toggle.on {
    background: var(--hsp-accent);
}

.hsp-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.hsp-toggle.on::after {
    transform: translateX(28px);
}

.hsp-toggle-text {
    font-weight: 600;
    color: var(--hsp-text-muted);
}

.hsp-stepper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hsp-step-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--hsp-border);
    background: var(--hsp-surface);
    border-radius: 50%;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hsp-text);
}

.hsp-step-btn:hover {
    background: var(--hsp-accent);
    color: #fff;
    border-color: var(--hsp-accent);
}

.hsp-step-input {
    width: 70px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 8px;
    border: 1px solid var(--hsp-border);
    background: var(--hsp-surface-alt);
    border-radius: 10px;
    color: var(--hsp-text);
}

.hsp-step-unit {
    font-size: 0.85rem;
    color: var(--hsp-text-muted);
}

.hsp-quick-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.hsp-quick-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--hsp-border);
    background: var(--hsp-surface-alt);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--hsp-text);
}

.hsp-quick-btn:hover {
    border-color: var(--hsp-accent);
    background: rgba(34, 197, 94, 0.1);
}

.hsp-quick-btn.active {
    background: var(--hsp-accent);
    color: #fff;
    border-color: var(--hsp-accent);
}

/* Streak Stats */
.hsp-habit-streaks {
    display: flex;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--hsp-border);
    border-bottom: 1px solid var(--hsp-border);
    margin-bottom: 14px;
}

.hsp-streak-stat {
    flex: 1;
    text-align: center;
}

.hsp-streak-num {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--hsp-text);
}

.hsp-streak-lbl {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hsp-text-muted);
}

.hsp-safety-tag {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
}

.hsp-safety-tag.available {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.hsp-safety-tag.used {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

/* Habit Actions */
.hsp-habit-actions {
    display: flex;
    gap: 8px;
}

.hsp-habit-actions button {
    flex: 1;
    padding: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--hsp-border);
    background: var(--hsp-surface-alt);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--hsp-text);
}

.hsp-habit-actions button:hover {
    background: var(--hsp-surface);
    border-color: var(--hsp-text-muted);
}

.hsp-habit-actions .hsp-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #dc2626;
}

/* Quick Stats */
.hsp-quick-stats {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--hsp-surface);
    border-radius: var(--hsp-radius);
    margin-top: 24px;
    box-shadow: var(--hsp-shadow);
}

.hsp-qs-item {
    flex: 1;
    text-align: center;
}

.hsp-qs-label {
    display: block;
    font-size: 0.8rem;
    color: var(--hsp-text-muted);
    margin-bottom: 4px;
}

.hsp-qs-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--hsp-text);
}

/* ============ Analytics ============ */
.hsp-range-selector {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: var(--hsp-surface-alt);
    border-radius: 10px;
}

.hsp-range-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--hsp-text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.hsp-range-btn:hover {
    color: var(--hsp-text);
}

.hsp-range-btn.active {
    background: var(--hsp-accent);
    color: #fff;
}

.hsp-analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.hsp-chart-card {
    background: var(--hsp-surface);
    border-radius: var(--hsp-radius);
    padding: 24px;
    box-shadow: var(--hsp-shadow);
}

.hsp-chart-card.span-2 {
    grid-column: span 2;
}

.hsp-chart-card h3 {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 700;
}

.hsp-chart-container {
    height: 200px;
    position: relative;
}

.hsp-stats-card {
    display: flex;
    gap: 20px;
    padding: 24px;
    background: var(--hsp-surface);
    border-radius: var(--hsp-radius);
    box-shadow: var(--hsp-shadow);
}

.hsp-stats-card.span-2 {
    grid-column: span 2;
}

.hsp-stat-item {
    flex: 1;
    text-align: center;
    padding: 16px;
    background: var(--hsp-surface-alt);
    border-radius: 14px;
}

.hsp-stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--hsp-accent);
}

.hsp-stat-label {
    font-size: 0.85rem;
    color: var(--hsp-text-muted);
    margin-top: 4px;
}

/* ============ Heatmap ============ */
.hsp-heatmap-card {
    background: var(--hsp-surface);
    border-radius: var(--hsp-radius);
    padding: 24px;
    box-shadow: var(--hsp-shadow);
}

.hsp-heatmap-wrapper {
    overflow-x: auto;
}

.hsp-heatmap-months {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
    margin-left: 36px;
}

.hsp-heatmap-months span {
    min-width: 56px;
    font-size: 0.75rem;
    color: var(--hsp-text-muted);
}

.hsp-heatmap-body {
    display: flex;
    gap: 4px;
}

.hsp-heatmap-days {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 4px;
}

.hsp-heatmap-days span {
    height: 14px;
    line-height: 14px;
    font-size: 0.65rem;
    color: var(--hsp-text-muted);
}

.hsp-heatmap-grid {
    display: flex;
    gap: 4px;
}

.hsp-heatmap-week {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hsp-heatmap-cell {
    width: 14px;
    height: 14px;
    background: var(--hsp-accent);
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.15s;
}

.hsp-heatmap-cell:hover {
    transform: scale(1.4);
    z-index: 10;
}

.hsp-heatmap-cell.future {
    background: var(--hsp-border);
}

.hsp-heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 16px;
    font-size: 0.75rem;
    color: var(--hsp-text-muted);
}

.hsp-legend-cells {
    display: flex;
    gap: 3px;
}

.hsp-legend-cells span {
    width: 14px;
    height: 14px;
    background: var(--hsp-accent);
    border-radius: 3px;
}

.hsp-month-overview {
    margin-top: 24px;
}

.hsp-month-overview h3 {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 700;
}

.hsp-month-bars {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hsp-month-bar {
    flex: 1;
    min-width: 60px;
    background: var(--hsp-surface);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    box-shadow: var(--hsp-shadow);
}

.hsp-month-bar-fill {
    height: 60px;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-end;
}

.hsp-month-bar-fill div {
    width: 100%;
    background: linear-gradient(to top, var(--hsp-accent), rgba(34, 197, 94, 0.3));
    border-radius: 6px 6px 0 0;
    transition: height 0.5s ease;
}

.hsp-month-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--hsp-text-muted);
}

/* ============ Weekly Review ============ */
.hsp-week-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hsp-nav-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--hsp-border);
    background: var(--hsp-surface);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hsp-text);
    transition: all 0.2s;
}

.hsp-nav-btn:hover {
    background: var(--hsp-surface-alt);
}

.hsp-week-label {
    font-weight: 600;
    min-width: 200px;
    text-align: center;
}

.hsp-review-grid {
    display: grid;
    grid-template-columns: 300px 1fr 1fr;
    gap: 20px;
}

.hsp-review-score-card {
    background: var(--hsp-surface);
    border-radius: var(--hsp-radius);
    padding: 32px;
    box-shadow: var(--hsp-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hsp-score-ring {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 16px;
}

.hsp-score-ring svg {
    transform: rotate(-90deg);
}

.hsp-score-bg {
    fill: none;
    stroke: var(--hsp-border);
    stroke-width: 10;
}

.hsp-score-fill {
    fill: none;
    stroke: var(--hsp-accent);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 326.7;
    stroke-dashoffset: 326.7;
    transition: stroke-dashoffset 0.8s ease;
}

.hsp-score-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hsp-score-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--hsp-accent);
}

.hsp-score-label {
    font-size: 0.85rem;
    color: var(--hsp-text-muted);
}

.hsp-score-comparison {
    font-size: 0.85rem;
    color: var(--hsp-text-muted);
    padding: 8px 16px;
    background: var(--hsp-surface-alt);
    border-radius: 10px;
    margin-top: 8px;
}

.hsp-review-habits-card,
.hsp-review-insights-card,
.hsp-review-journal-card {
    background: var(--hsp-surface);
    border-radius: var(--hsp-radius);
    padding: 24px;
    box-shadow: var(--hsp-shadow);
}

.hsp-review-habits-card h3,
.hsp-review-insights-card h3,
.hsp-review-journal-card h3 {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 700;
}

.hsp-review-habits-list {
    max-height: 240px;
    overflow-y: auto;
}

.hsp-review-habit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--hsp-border);
}

.hsp-review-habit:last-child {
    border-bottom: none;
}

.hsp-review-habit-name {
    font-weight: 600;
}

.hsp-review-habit-detail {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
}

.hsp-review-done {
    color: #16a34a;
    font-weight: 500;
}

.hsp-review-missed {
    color: #dc2626;
}

.hsp-review-safety {
    font-size: 0.7rem;
    padding: 2px 6px;
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border-radius: 6px;
}

.hsp-insights-list {
    margin: 0;
    padding: 0 0 0 18px;
}

.hsp-insights-list li {
    padding: 8px 0;
    color: var(--hsp-text-muted);
    line-height: 1.5;
}

.hsp-journal-input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--hsp-border);
    background: var(--hsp-surface-alt);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 100px;
    color: var(--hsp-text);
    margin-bottom: 12px;
}

.hsp-journal-input:focus {
    border-color: var(--hsp-accent);
    outline: none;
}

/* ============ Achievements ============ */
.hsp-badges-count {
    font-size: 0.9rem;
    color: var(--hsp-text-muted);
    padding: 8px 16px;
    background: var(--hsp-surface-alt);
    border-radius: 10px;
}

.hsp-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.hsp-badge-card {
    text-align: center;
    padding: 24px 16px;
    background: var(--hsp-surface);
    border-radius: var(--hsp-radius);
    box-shadow: var(--hsp-shadow);
    transition: all 0.2s;
    position: relative;
}

.hsp-badge-card.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.hsp-badge-card.unlocked {}

.hsp-badge-card:hover {
    transform: translateY(-4px);
}

.hsp-badge-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--hsp-purple), var(--hsp-pink));
    border-radius: 50%;
    font-size: 1.8rem;
    color: #fff;
}

.hsp-badge-card.locked .hsp-badge-icon {
    background: var(--hsp-border);
}

.hsp-badge-name {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.hsp-badge-desc {
    font-size: 0.75rem;
    color: var(--hsp-text-muted);
    line-height: 1.4;
}

.hsp-badge-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--hsp-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.hsp-xp-history h3 {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 700;
}

.hsp-xp-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.hsp-xp-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--hsp-surface);
    border-radius: 12px;
    box-shadow: var(--hsp-shadow);
}

.hsp-xp-item-text {
    font-size: 0.9rem;
    color: var(--hsp-text);
}

.hsp-xp-item-value {
    font-weight: 700;
    color: var(--hsp-accent);
}

/* ============ Data Section ============ */
.hsp-data-section {
    margin-top: 40px;
    padding: 24px;
    background: var(--hsp-surface);
    border-radius: var(--hsp-radius);
    box-shadow: var(--hsp-shadow);
}

.hsp-data-section h3 {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 700;
}

.hsp-data-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* ============ FAQ ============ */
.hsp-faq {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--hsp-border);
}

.hsp-faq h2 {
    text-align: center;
    margin-bottom: 24px;
}

.hsp-faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.hsp-faq-item {
    background: var(--hsp-surface);
    border-radius: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--hsp-border);
    overflow: hidden;
}

.hsp-faq-item summary {
    padding: 18px 20px;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.hsp-faq-item summary::-webkit-details-marker {
    display: none;
}

.hsp-faq-item summary::after {
    content: '+';
    font-size: 1.4rem;
    color: var(--hsp-accent);
    transition: transform 0.2s;
}

.hsp-faq-item[open] summary::after {
    transform: rotate(45deg);
}

.hsp-faq-item p {
    padding: 0 20px 18px;
    margin: 0;
    font-size: 0.9rem;
    color: var(--hsp-text-muted);
    line-height: 1.6;
}

/* ============ Modals ============ */
.hsp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hsp-modal-overlay.visible {
    display: flex;
}

.hsp-modal {
    width: 100%;
    max-height: 90vh;
    background: var(--hsp-surface);
    border-radius: var(--hsp-radius-lg);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.hsp-modal-lg {
    max-width: 560px;
}

.hsp-modal-sm {
    max-width: 380px;
}

.hsp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--hsp-border);
}

.hsp-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.hsp-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--hsp-surface-alt);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hsp-text);
    transition: all 0.2s;
}

.hsp-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.hsp-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.hsp-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--hsp-border);
}

/* Achievement Modal */
.hsp-modal-achievement {
    max-width: 340px;
    text-align: center;
}

.hsp-achievement-content {
    padding: 40px 30px;
}

.hsp-achievement-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--hsp-purple), var(--hsp-pink));
    border-radius: 50%;
    font-size: 3rem;
    animation: badgePop 0.5s ease;
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.hsp-achievement-content h3 {
    margin: 0 0 12px;
    font-size: 1.3rem;
}

.hsp-achievement-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--hsp-text);
}

.hsp-achievement-desc {
    font-size: 0.9rem;
    color: var(--hsp-text-muted);
    margin-bottom: 24px;
}

/* ============ Focus Mode ============ */
.hsp-focus-overlay {
    position: fixed;
    inset: 0;
    background: var(--hsp-bg);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
}

.hsp-focus-overlay.visible {
    display: flex;
}

.hsp-focus-container {
    width: 100%;
    max-width: 500px;
    padding: 40px;
    text-align: center;
}

.hsp-focus-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.hsp-focus-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.hsp-focus-date {
    color: var(--hsp-text-muted);
    margin-bottom: 32px;
}

.hsp-focus-habits {
    margin-bottom: 32px;
}

.hsp-focus-habit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--hsp-surface);
    border-radius: 14px;
    margin-bottom: 12px;
    box-shadow: var(--hsp-shadow);
}

.hsp-focus-habit.done {
    border-left: 4px solid var(--hsp-accent);
}

.hsp-focus-habit-name {
    font-weight: 600;
}

.hsp-focus-progress {
    margin-top: 24px;
}

.hsp-focus-bar {
    height: 8px;
    background: var(--hsp-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.hsp-focus-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--hsp-accent), var(--hsp-purple));
    transition: width 0.3s ease;
}

/* ============ Toast ============ */
.hsp-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hsp-toast {
    padding: 14px 20px;
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #f1f5f9;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: toastIn 0.3s ease;
}

.hsp-toast.success {
    background: linear-gradient(135deg, #166534, #22c55e);
}

.hsp-toast.error {
    background: linear-gradient(135deg, #7f1d1d, #ef4444);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============ Footer ============ */
.hsp-footer {
    padding: 32px 0;
    background: var(--hsp-surface);
    border-top: 1px solid var(--hsp-border);
}

.hsp-footer .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hsp-footer p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--hsp-text-muted);
}

.hsp-footer a {
    color: var(--hsp-text);
    text-decoration: none;
}

.hsp-footer nav {
    display: flex;
    gap: 20px;
}

.hsp-footer nav a {
    color: var(--hsp-text-muted);
    font-size: 0.9rem;
}

.hsp-footer nav a:hover {
    color: var(--hsp-text);
}

/* ============ Form Styles ============ */
.hsp-form-row {
    display: flex;
    gap: 16px;
}

.hsp-form-group {
    margin-bottom: 18px;
    flex: 1;
}

.hsp-form-group.flex-2 {
    flex: 2;
}

.hsp-form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--hsp-text);
}

.hsp-input,
.hsp-select,
.hsp-textarea {
    width: 100%;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 0.95rem;
    border: 1px solid var(--hsp-border);
    border-radius: 12px;
    background: var(--hsp-surface-alt);
    color: var(--hsp-text);
    transition: border-color 0.2s;
}

.hsp-input:focus,
.hsp-select:focus,
.hsp-textarea:focus {
    border-color: var(--hsp-accent);
    outline: none;
}

.hsp-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--hsp-text-muted);
    margin-top: 4px;
}

.hsp-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hsp-chip-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1px solid var(--hsp-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.hsp-chip-input:has(input:checked) {
    background: rgba(34, 197, 94, 0.12);
    border-color: var(--hsp-accent);
}

.hsp-chip-input input {
    accent-color: var(--hsp-accent);
}

.hsp-schedule-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hsp-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.hsp-radio input {
    accent-color: var(--hsp-accent);
}

.hsp-day-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hsp-day-picker label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--hsp-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.hsp-day-picker label:has(input:checked) {
    background: rgba(34, 197, 94, 0.12);
    border-color: var(--hsp-accent);
}

/* ============ Responsive ============ */
@media(max-width:1100px) {
    .hsp-review-grid {
        grid-template-columns: 1fr 1fr;
    }

    .hsp-review-score-card {
        grid-column: span 2;
        flex-direction: row;
        gap: 24px;
    }
}

@media(max-width:900px) {
    .hsp-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hsp-analytics-grid {
        grid-template-columns: 1fr;
    }

    .hsp-chart-card.span-2,
    .hsp-stats-card.span-2 {
        grid-column: span 1;
    }

    .hsp-hero-glass {
        flex-direction: column;
        text-align: center;
    }

    .hsp-hero-subtitle {
        margin-left: auto;
        margin-right: auto;
    }

    .hsp-hero-cta {
        justify-content: center;
    }
}

@media(max-width:700px) {
    .hsp-habits-grid {
        grid-template-columns: 1fr;
    }

    .hsp-review-grid {
        grid-template-columns: 1fr;
    }

    .hsp-review-score-card {
        flex-direction: column;
    }

    .hsp-form-row {
        flex-direction: column;
    }

    .hsp-tabs {
        justify-content: flex-start;
    }
}

@media(max-width:500px) {
    .hsp-hero {
        padding: 40px 0 24px;
    }

    .hsp-hero-glass {
        padding: 24px;
    }

    .hsp-metrics-grid {
        gap: 10px;
    }

    .hsp-metric-card {
        padding: 14px;
        flex-direction: column;
        text-align: center;
    }

    .hsp-metric-icon {
        margin-bottom: 8px;
    }
}

@media(prefers-reduced-motion:reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}