:root {
    --bg: #11131a;
    --panel: #1a1f2b;
    --text: #f4f7fb;
    --muted: #b4bfd3;
    --track: #2e3547;
    --good: #5bd18b;
    --mid: #7d8cff;
    --bad: #ff7171;
    --accent: #ffd978;
    --gold: #f3cd62;
    --shadow: rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top, #1d2230 0%, var(--bg) 55%),
        var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;
    display: grid;
    place-items: center;
    padding: 24px;
}

/* Welcome Screen (unchanged) */
.welcome-screen {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top, rgba(255, 217, 120, 0.18), transparent 36%),
        linear-gradient(180deg, rgba(17, 19, 26, 0.92), rgba(17, 19, 26, 0.98));
}

.welcome-card {
    width: min(92vw, 560px);
    padding: 34px 26px;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(26, 31, 43, 0.98), rgba(20, 24, 34, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.welcome-kicker {
    margin: 0 0 12px;
    color: var(--gold);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.welcome-copy {
    margin: 12px auto 20px;
    max-width: 34ch;
    color: var(--muted);
    line-height: 1.5;
}

.welcome-form {
    display: grid;
    gap: 14px;
    justify-items: center;
}

.welcome-name {
    width: min(320px, 100%);
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.welcome-button {
    min-width: 140px;
}

.welcome-button-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.welcome-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Main App Container */
.app {
    position: relative;
    width: min(92vw, 720px);
    background: rgba(26, 31, 43, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 0;
    box-shadow: 0 18px 50px var(--shadow);
    overflow: hidden;
}

/* Tab Navigation */
.tab-nav {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 8px 0 8px;
}

.tab-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 12px 12px 0 0;
    transition: all 0.2s ease;
    position: relative;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.tab-button.active {
    background: rgba(26, 31, 43, 0.94);
    color: var(--accent);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.tab-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.tab-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Tab Content */
.tab-content {
    padding: 28px 22px;
}

.tab-panel {
    display: none;
    text-align: center;
}

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

.tab-subtitle {
    color: var(--muted);
    margin: 8px 0 24px;
    font-size: 0.95rem;
}

/* Base Styles */
h1, h2, h3 {
    margin: 0;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1rem;
    margin-bottom: 12px;
}

h3 {
    font-size: 0.95rem;
}

input, textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

button {
    padding: 12px 16px;
    border: 0;
    border-radius: 14px;
    background: var(--accent);
    color: #171717;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(255, 217, 120, 0.18);
}

/* Rock Tab Styles (from original) */
.identity {
    margin: 8px 0 18px;
    color: var(--accent);
    font-size: 0.98rem;
    letter-spacing: 0.02em;
}

.rock-wrap {
    margin: 8px auto 18px;
}

#rockImage {
    width: min(230px, 62vw);
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

#rockImage.bump {
    transform: scale(1.04);
}

.mood {
    color: var(--muted);
    margin: 10px 0 16px;
}

.bar {
    width: min(320px, 80vw);
    height: 14px;
    background: var(--track);
    margin: 12px auto 10px;
    border-radius: 999px;
    overflow: hidden;
}

.fill {
    height: 100%;
    width: 50%;
    background: var(--mid);
    transition: width 0.3s ease, background 0.3s ease;
}

.streak-banner {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 16px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(243, 205, 98, 0.14);
    border: 1px solid rgba(243, 205, 98, 0.32);
    color: var(--gold);
    font-weight: 700;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0 20px;
    text-align: left;
}

.stat {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 12px;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 0.98rem;
}

.feed-section {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.feed-section input {
    width: min(320px, 100%);
}

.response-line {
    min-height: 24px;
    margin: 14px 0 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.quality-tag {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #11131a;
    background: var(--accent);
}

.quality-tag.good {
    background: #8bd4ff;
}

.quality-tag.amazing {
    background: var(--gold);
}

.badges, .history {
    margin-top: 20px;
    text-align: left;
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.badge {
    border-radius: 16px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.badge.unlocked {
    border-color: rgba(243, 205, 98, 0.45);
    background: linear-gradient(180deg, rgba(243, 205, 98, 0.15), rgba(255, 255, 255, 0.05));
}

.badge.locked {
    opacity: 0.48;
    filter: grayscale(1);
}

.badge-title {
    display: block;
    font-weight: 700;
    margin-bottom: 4px;
}

.badge-desc {
    display: block;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.35;
}

#historyList {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

#historyList li {
    margin-bottom: 8px;
}

.faint-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.94);
    text-align: center;
}

.faint-card {
    width: min(92vw, 420px);
    padding: 28px 22px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(12, 12, 12, 0.96), rgba(24, 24, 24, 0.92));
    border: 1px solid rgba(255, 217, 120, 0.16);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.faint-title {
    margin: 0 0 18px;
    font-size: 1.08rem;
    color: #fff7d0;
}

.faint-note {
    margin: 12px 0 0;
    color: #b9b1a0;
    font-size: 0.84rem;
}

.btn-revive {
    background: linear-gradient(180deg, #ffe799, #f3cd62);
    color: #1a1710;
    box-shadow: 0 0 0 rgba(243, 205, 98, 0.32);
    animation: pulse 1.8s infinite;
}

.badge-popup {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translate(-50%, -140%);
    z-index: 20;
    min-width: 220px;
    max-width: min(90vw, 420px);
    padding: 12px 16px;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffe799, #f3cd62);
    color: #191919;
    font-weight: 700;
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
    pointer-events: none;
    text-align: center;
}

.badge-popup.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

/* Journal Styles */
.journal-editor {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 24px;
    text-align: left;
}

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

.journal-date {
    color: var(--muted);
    font-size: 0.9rem;
}

.mood-selector {
    margin-bottom: 16px;
}

.mood-selector label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.mood-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.mood-btn {
    padding: 10px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.mood-btn.selected {
    background: var(--accent);
    color: #171717;
}

.journal-actions {
    margin-top: 12px;
}

.journal-entries {
    text-align: left;
}

.entry-list {
    display: grid;
    gap: 12px;
}

.entry-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 14px;
}

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

.entry-date {
    color: var(--muted);
    font-size: 0.85rem;
}

.entry-mood {
    font-size: 1.1rem;
}

.entry-text {
    color: var(--text);
    line-height: 1.5;
    font-size: 0.95rem;
}

/* Pomodoro Timer Styles */
.pomodoro-container {
    max-width: 400px;
    margin: 0 auto;
}

.timer-display {
    margin-bottom: 24px;
}

.timer-circle {
    width: 240px;
    height: 240px;
    margin: 0 auto;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(125, 140, 255, 0.15), rgba(125, 140, 255, 0.05));
    border: 4px solid var(--mid);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.timer-text {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.timer-label {
    color: var(--muted);
    font-size: 0.9rem;
}

.timer-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.timer-btn {
    min-width: 100px;
}

.timer-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.timer-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

.task-section {
    text-align: left;
    margin-top: 24px;
}

.task-input {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.task-input input {
    flex: 1;
}

.task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.task-item {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.task-text {
    flex: 1;
}

.task-text.completed {
    text-decoration: line-through;
    opacity: 0.5;
}

/* Habits Styles */
.habit-cards {
    display: grid;
    gap: 16px;
    max-width: 500px;
    margin: 0 auto;
}

.habit-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 18px;
    padding: 18px;
    text-align: left;
}

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

.habit-count {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
}

.glass-container {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.water-glass {
    width: 32px;
    height: 40px;
    border: 2px solid var(--mid);
    border-radius: 4px;
    position: relative;
    background: transparent;
    transition: background 0.3s ease;
}

.water-glass.filled {
    background: linear-gradient(180deg, transparent 20%, var(--mid) 20%);
}

.sleep-input {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.sleep-input input {
    max-width: 120px;
}

.habit-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.habit-btn.completed {
    background: var(--good);
    color: #171717;
}

.habit-note {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.habit-streak {
    margin: 8px 0 0;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 700;
}

/* Music Styles */
.music-grid {
    display: grid;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.music-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 18px;
    padding: 16px;
}

.music-card h3 {
    margin-bottom: 12px;
    text-align: left;
}

/* Quotes Styles */
.quote-display {
    max-width: 500px;
    margin: 0 auto 32px;
}

.quote-card {
    background: linear-gradient(180deg, rgba(125, 140, 255, 0.12), rgba(255, 255, 255, 0.04));
    border-radius: 20px;
    padding: 32px 24px;
    margin-bottom: 16px;
}

.daily-quote-text {
    font-size: 1.35rem;
    line-height: 1.6;
    color: var(--text);
    margin: 0 0 16px;
    font-style: italic;
}

.daily-quote-author {
    color: var(--muted);
    font-size: 1rem;
    margin: 0;
}

.quote-btn {
    background: var(--mid);
}

.saved-quotes {
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
}

.saved-quotes-list {
    display: grid;
    gap: 12px;
}

.empty-state {
    color: var(--muted);
    text-align: center;
    padding: 20px;
    font-size: 0.95rem;
}

.hidden {
    display: none !important;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(243, 205, 98, 0.3);
    }
    50% {
        box-shadow: 0 0 0 14px rgba(243, 205, 98, 0);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .tab-nav {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .tab-label {
        font-size: 0.65rem;
    }
    
    .tab-icon {
        font-size: 1.2rem;
    }
    
    .stats, .badge-grid {
        grid-template-columns: 1fr;
    }
    
    .mood-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .timer-circle {
        width: 200px;
        height: 200px;
    }
    
    .timer-text {
        font-size: 2.5rem;
    }
}

@media (max-width: 420px) {
    .tab-content {
        padding: 20px 16px;
    }
    
    .welcome-actions {
        flex-direction: column;
    }
    
    input, button {
        width: 100%;
    }
}