:root {
    --primary-hue: 240;
    /* Blue-ish for shared trusting feel */
    --primary-color: hsl(var(--primary-hue), 80%, 70%);
    --accent-color: hsl(200, 90%, 60%);
    --heart-color: hsl(340, 90%, 65%);
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --font-stack: 'Inter', 'Noto Sans JP', sans-serif;
    --radius-xl: 32px;
    --radius-lg: 20px;
}

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

body {
    font-family: var(--font-stack);
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
}

/* Ambient Background */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.3;
    animation: float 25s infinite alternate;
}

body::before {
    width: 500px;
    height: 500px;
    background: var(--primary-color);
    top: -10%;
    left: -10%;
}

body::after {
    width: 600px;
    height: 600px;
    background: var(--accent-color);
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(40px, 40px) scale(1.05);
    }
}

.app-container {
    max-width: 900px;
    /* Narrower for social feed feel */
    margin: 0 auto;
    padding: 24px;
}

/* Header */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    position: sticky;
    top: 24px;
    z-index: 100;
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
}

.logo-icon {
    color: var(--primary-color);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border: none;
    padding: 10px 20px;
    border-radius: 100px;
    color: #0f172a;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(100, 100, 255, 0.3);
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 40px;
}

.hero h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    color: transparent;
}

.hero p {
    color: var(--text-muted);
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 32px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 12px 24px;
    border-radius: 100px;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--primary-color);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

/* Grid & Cards */
.gratitude-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(10px);
    transition: 0.3s;
    animation: slideUp 0.4s ease-out backwards;
}

.card:hover {
    background: rgba(40, 50, 75, 0.8);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #475569, #334155);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 0.9rem;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.username {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.timestamp {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-content {
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 20px;
}

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

.reaction-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    transition: 0.2s;
}

.reaction-btn:hover {
    color: var(--heart-color);
}

.reaction-btn.loved {
    color: var(--heart-color);
}

.reaction-btn.loved i {
    fill: var(--heart-color);
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

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

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

/* Utility */
.hidden {
    display: none !important;
}

/* Modal (Same as before but styled to match) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal {
    width: 90%;
    max-width: 500px;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}


/* Header Layout Update */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Form Styles */
.form-group {
    margin-bottom: 24px;
}

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

.form-group input,
.form-group textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(0, 0, 0, 0.3);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.submit-btn {
    width: 100%;
    background: var(--primary-color);
    padding: 14px;
    border-radius: 100px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
}

.submit-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 100px;
    color: var(--text-main);
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
}

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

#auth-buttons {
    display: flex;
    gap: 12px;
}

/* Reply Section */
.reply-section {
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    margin: 0 -24px -24px -24px;
    /* Expand to edges */
    padding: 20px 24px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    animation: fadeIn 0.3s ease;
}

.reply-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.reply-item {
    display: flex;
    gap: 10px;
    font-size: 0.9rem;
}

.reply-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #475569;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    flex-shrink: 0;
}

.reply-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 12px;
    flex-grow: 1;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.reply-form {
    display: flex;
    gap: 8px;
}

.reply-input {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 8px 16px;
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
}

.reply-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.reply-submit-btn {
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    transition: 0.2s;
}

.reply-submit-btn:hover {
    transform: scale(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.reply-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    align-items: center;
}

.reply-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    transition: 0.2s;
    opacity: 0.8;
}

.reply-action-btn:hover {
    opacity: 1;
    transform: scale(1.05);
}

.reply-like-btn.loved {
    color: var(--heart-color);
}

.reply-like-btn.loved i {
    fill: var(--heart-color);
}

.reply-reply-btn:hover {
    color: var(--primary-color);
}

.reply-delete-btn:hover {
    color: #ef4444;
}