:root {
    --bg-color: #0d0f17;
    --surface: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.1);
    --text-primary: #ededed;
    --text-secondary: #a1a1aa;
    --accent: #6d28d9;
    --accent-hover: #5b21b6;
    --error: #ef4444;
    --success: #10b981;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-subtle: 0 4px 30px rgba(0, 0, 0, 0.5);
    --glass-blur: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Background Gradients & Blobs */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
    animation: drift 15s infinite alternate ease-in-out;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #4c1d95 0%, transparent 70%);
    top: -10%;
    left: -10%;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #1e3a8a 0%, transparent 70%);
    bottom: -20%;
    right: -10%;
    animation-delay: -5s;
}

.blob-3 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #312e81 0%, transparent 70%);
    top: 30%;
    left: 40%;
    opacity: 0.3;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 30px) scale(1.1); }
}

/* Base UI Components */
.glass-panel {
    background: var(--surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-subtle);
}

.btn {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-btn {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.4);
}

.primary-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(109, 40, 217, 0.6);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.secondary-btn:hover {
    background: var(--surface-hover);
}

.ghost-btn {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}

.ghost-btn:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

input, textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    transition: all 0.2s ease;
    outline: none;
}

input:focus, textarea:focus {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.2);
}

textarea {
    resize: none;
    line-height: 1.5;
}

.brand {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -1px;
}

.brand .dot {
    color: var(--accent);
}

.brand.small {
    font-size: 24px;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 15px;
}

.view {
    display: none;
    width: 100%;
    flex: 1;
}

.view:not(.hidden) {
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Authentication View Specifics */
#auth-view {
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 48px;
    text-align: center;
    animation: fadeIn 0.5s ease-out forwards;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
}

.auth-actions .btn {
    width: 100%;
}

.error-msg {
    color: var(--error);
    font-size: 14px;
    margin-top: 16px;
    min-height: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.error-msg.visible {
    opacity: 1;
}

/* Main App View Specifics */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 40px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

#user-display {
    font-weight: 500;
    color: var(--text-primary);
}

.app-content {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 24px;
    width: 100%;
    flex: 1;
}

.composer-container {
    padding: 20px;
    margin-bottom: 40px;
    animation: slideDown 0.4s ease-out forwards;
}

.composer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
}

#char-count {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Notes Grid */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.note-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s ease;
    animation: fadeIn 0.4s ease-out forwards;
    position: relative;
    overflow: hidden;
}

.note-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    background: var(--surface-hover);
}

.note-content {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1;
}

.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.note-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.delete-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 50px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-btn:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 600px) {
    .auth-container {
        padding: 32px 24px;
        margin: 24px;
    }
    .app-header {
        padding: 16px 24px;
    }
    .composer-container {
        padding: 16px;
    }
}
