:root {
    --primary-color: #02B0A7; /* Functional Teal for Sidebar, Cards, etc. */
    --primary-hover: #019089;
    --splash-bg: #06E5D9;    /* Bright Identity for Splash Screen */
    --bg-light: #F2F7F7;     /* App page background */
    --bg-body: #F2F7F7;
    --bg-color: #F2F7F7;
    --bg-card: #ffffff;
    --card-bg: #ffffff;
    --text-main: #2d2d2d;
    --text-muted: #7d7d7d;
    --sidebar-bg: #02B0A7;
    --sidebar-text: #ffffff;
    --border-color: #e0e0e0;
    --border-radius: 16px;
    --surface-border-color: rgba(0, 0, 0, 0.08);
    --surface-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 8px 22px rgba(0, 0, 0, 0.04);
    --surface-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.1), 0 12px 28px rgba(0, 0, 0, 0.06);
    --quiz-bg: #FFFDE7;      /* Warm light yellow for quiz cards */
    --bottom-nav-bg: #ffffff;
    --app-chrome-color: #ffffff;
    color-scheme: light;
}

.comment-bubble {
    border: 0 !important;
    box-shadow: none !important;
    background: var(--bg-light) !important;
    border-radius: 14px !important;
}

.comment-modal-input-row .comment-input {
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

.comment-social-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 800;
}

.comment-love-btn,
.comment-reply-btn {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 800;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.comment-love-btn svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
}

.comment-love-btn.active {
    color: #ff4b73;
}

.comment-love-btn.active svg {
    fill: currentColor;
}

.reply-thread {
    margin-left: 42px;
    padding-left: 0;
    border-left: 0;
}

.reply-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 10px;
}

.reply-bubble {
    padding: 9px 11px !important;
    max-width: calc(100% - 42px);
}

.reply-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 4px 42px;
}

.reply-form-input-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.reply-input {
    flex: 1;
    min-height: 36px;
    max-height: 110px;
    border: 0;
    outline: none;
    resize: none;
    border-radius: 18px;
    background: var(--bg-light);
    color: var(--text-main);
    padding: 9px 13px;
    padding-right: 42px;
    font-family: inherit;
    font-size: 0.84rem;
}

.reply-submit-btn {
    border: 0;
    background: var(--primary-color);
    color: white;
    border-radius: 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 8px 13px;
}

.reply-submit-btn.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.reply-submit-btn.icon-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.reply-submit-btn.comment-submit-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    padding: 0;
}

.reply-emoji-trigger {
    position: absolute;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
}

.reply-emoji-trigger svg {
    width: 18px;
    height: 18px;
}

.comment-actions-bar {
    align-items: center;
}

[data-theme="dark"] .comment-bubble,
[data-theme="dark"] .reply-input {
    background: rgba(255, 255, 255, 0.06) !important;
}

[data-theme="dark"] {
    --bg-light: #1C1C1D;
    --bg-body: #1C1C1D;
    --bg-color: #1C1C1D;
    --bg-card: #252728;
    --card-bg: #252728;
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    --sidebar-bg: #252728;
    --border-color: #333333;
    --surface-border-color: rgba(255, 255, 255, 0.035);
    --surface-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
    --surface-shadow-hover: 0 6px 18px rgba(0, 0, 0, 0.2);
    --quiz-bg: #2A2A1A;      /* Darker yellow tone for dark mode quiz cards */
    --bottom-nav-bg: #1C1C1D;
    --app-chrome-color: #1C1C1D;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--app-chrome-color);
    color: var(--text-main);
    transition: 0.3s;
}

.app-container,
.main-content {
    background-color: var(--bg-light);
}

body.surface-home .challenge-summary-card,
body.surface-home .game-card,
body.surface-home .post-card,
body.surface-home .post-input-area,
body.surface-explore .post-card,
body.surface-explore .post-input-area,
body:not(.surface-home):not(.surface-explore) .game-card,
body:not(.surface-home):not(.surface-explore) .game-item,
body:not(.surface-home):not(.surface-explore) .accordion-item,
body:not(.surface-home):not(.surface-explore) .profile-card,
body:not(.surface-home):not(.surface-explore) .post-card,
body:not(.surface-home):not(.surface-explore) .post-input-area {
    box-shadow: var(--surface-shadow) !important;
    border-color: var(--surface-border-color) !important;
}

body.surface-home .game-card:hover,
body.surface-home .post-card:hover,
body.surface-explore .post-card:hover,
body:not(.surface-home):not(.surface-explore) .game-card:hover,
body:not(.surface-home):not(.surface-explore) .game-item:hover,
body:not(.surface-home):not(.surface-explore) .profile-card:hover,
body:not(.surface-home):not(.surface-explore) .post-card:hover {
    box-shadow: var(--surface-shadow-hover) !important;
}

/* Splash Screen */
.splash-container {
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--splash-bg); /* Use the vibrant cyan */
    color: white;
    position: relative;
    text-align: center;
}

.beta-wrapper {
    position: absolute;
    top: 10%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.beta-outline {
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 3px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    box-sizing: border-box;
}

.logo-group {
    text-align: center;
}

.logo-icon {
    width: 75px;
    margin-bottom: 20px;
}

.logo-text {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
}

.splash-dots {
    position: absolute;
    bottom: 50px;
    display: flex;
    gap: 8px;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: rgba(255,255,255,0.5);
    border-radius: 50%;
}

.dot.active {
    background-color: white;
}

/* Layout Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    transition: 0.3s;
    z-index: 1000;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
    padding-left: 15px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: 5px;
    text-decoration: none;
    color: inherit;
}

.menu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-keluar {
    background-color: #ffffff;
    color: var(--primary-color);
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 20px;
}

[data-theme="dark"] .btn-keluar {
    background-color: var(--primary-color);
    color: white;
}

/* Main Content area */
.main-content {
    flex-grow: 1;
    padding: 30px;
    max-width: 1000px; /* Narrowed for better focus */
    margin: 0 auto;
}

/* Responsive Sidebar */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        width: 100%;
        padding: 15px;
    }
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--bottom-nav-bg, var(--card-bg));
    display: flex;
    justify-content: space-around;
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-color);
    z-index: 900;
    display: none; /* Hidden by default */
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    min-height: calc(56px + env(safe-area-inset-bottom));
}

.bottom-nav.bottom-nav-hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 58px;
    min-height: 42px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item i, .nav-icon {
    height: 24px;
    width: auto;
    max-width: 34px;
    fill: var(--text-muted);
    transition: 0.3s;
}

.nav-item span {
    display: none;
}

.nav-item.active .nav-icon {
    fill: var(--primary-color);
}

[data-theme="dark"] .bottom-nav {
    border-top-color: transparent;
}

/* Top Navigation (Desktop) */
.top-nav {
    display: flex;
    gap: 30px;
    align-items: center;
    display: none; /* Hidden by default */
}

.top-nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
    transition: 0.2s;
}

.game-section-title {
    font-size: 1.1rem; /* Shrunk from default h2 */
    margin-top: 30px;
    margin-bottom: 15px;
    font-weight: 700;
}

.top-nav-link:hover, .top-nav-link.active {
    color: var(--primary-color);
}

/* Responsive Rules */
@media (max-width: 992px) {
    .bottom-nav {
        display: flex;
    }
    .main-content {
        padding-bottom: 80px; /* Space for bottom nav */
    }
}

@media (min-width: 993px) {
    .top-nav {
        display: flex;
    }
    #menu-btn {
        display: none !important;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 1s ease-out forwards;
}

/* Game Cards Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.game-card {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: transform 0.2s;
    text-decoration: none;
}

.game-card:hover {
    transform: translateY(-5px);
}

.game-icon {
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
}

.game-info h3 {
    margin: 0;
    font-size: 1.2rem;
}

.game-info p {
    margin: 5px 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Explore Feed */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
}

.post-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid var(--border-color);
    content-visibility: auto;
    contain-intrinsic-size: 1px 300px;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #ddd;
    background-size: cover;
    background-position: center;
}

.user-level-status {
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--primary-color);
}


.post-content {
    font-size: 0.96rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

/* Premium Full-bleed Post Images */
.post-image-container {
    margin-left: -20px;
    margin-right: -20px;
    margin-top: 15px;
    margin-bottom: 15px;
    overflow: hidden;
    background-color: transparent;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.post-image-container img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    display: block;
}

.post-actions {
    display: flex;
    gap: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #b0bec5; /* Default Gray */
    transition: 0.3s;
    font-weight: 600;
    font-size: 0.9rem;
}

.post-header a,
.post-header [style*="font-weight: 700"] {
    font-size: 0.94rem;
}

.post-text-container {
    font-size: 0.96rem;
    line-height: 1.56;
}

.action-item svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    transition: transform 0.2s;
}

.action-item.active {
    color: #05ADA2; /* Main Color */
}

.action-item:hover {
    color: #05ADA2;
}

.action-item:hover svg {
    transform: scale(1.1);
}

/* User Points Badge */
.points-badge {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Theme Switcher */
.theme-switch {
    background: rgba(0, 0, 0, 0.1);
    padding: 5px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 180px; /* Widened for text comfort */
    cursor: pointer;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.switch-label {
    flex-grow: 1;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 1;
}

.switch-toggle {
    position: absolute;
    width: 50%;
    height: calc(100% - 6px);
    background: white;
    border-radius: 20px;
    left: 3px;
    transition: 0.3s;
}

[data-theme="dark"] .switch-toggle {
    left: calc(50% - 3px);
}

/* Profile Card */
.profile-card {
    position: relative;
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: #ddd;
    margin: 0 auto 15px;
    border: 4px solid var(--primary-color);
    background-size: cover;
    background-position: center;
}

.profile-card-edit-btn {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 38px;
    height: 38px;
    background-color: var(--bg-light);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    cursor: pointer;
    z-index: 10;
}

.profile-card-edit-btn:hover {
    transform: scale(1.1) rotate(15deg);
    background-color: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(2, 176, 167, 0.3);
}

.profile-card-edit-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.profile-info {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* Post Input Area */
.post-input-area {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.post-input-area textarea {
    width: 100%;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    outline: none;
    color: var(--text-main);
}

[data-theme="dark"] .post-input-area textarea {
    background-color: transparent !important;
}

.post-input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.btn-post {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 20px;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    cursor: pointer;
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.activity-item {
    background-color: var(--card-bg);
    padding: 15px 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border-color);
}

.activity-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background-color: var(--bg-light);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
}

.activity-svg-icon {
    width: 22px;
    height: 22px;
    stroke: var(--primary-color);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.activity-detail {
    flex-grow: 1;
}

.activity-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.activity-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.activity-points {
    font-weight: 700;
}

.activity-points.plus {
    color: #00BFA5;
}

.activity-points.minus {
    color: #FF5252;
}

/* Autopost Card Design - Refined */
.autopost-card {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    padding: 16px 20px !important;
    border-radius: 20px !important;
    background-color: rgba(2, 176, 167, 0.06) !important;
    border: 1px solid rgba(2, 176, 167, 0.18) !important;
    margin-top: 15px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: 0.3s !important;
}

[data-theme="dark"] .autopost-card {
    background-color: rgba(2, 176, 167, 0.1) !important; /* Elegant dark teal tint */
    border-color: rgba(2, 176, 167, 0.2) !important;
}

.autopost-icon-box {
    width: 48px !important;
    height: 48px !important;
    background-color: var(--primary-color) !important;
    border-radius: 12px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    color: white !important; /* White Star/Trophy */
}

.autopost-info {
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}

.autopost-title {
    font-weight: 800 !important;
    font-size: 0.95rem !important;
    color: var(--text-main) !important;
}

.autopost-meta {
    font-size: 0.82rem !important;
    color: var(--text-muted) !important;
    font-weight: 600 !important;
}

.autopost-time {
    font-size: 0.8rem !important;
    color: var(--text-muted) !important;
    margin-top: 4px !important;
    opacity: 0.8 !important;
}

.autopost-points {
    text-align: right !important;
    color: var(--primary-color) !important;
    font-weight: 900 !important;
    font-size: 1.2rem !important;
    line-height: 1.1 !important;
    flex-shrink: 0 !important;
}

.autopost-points.minus {
    color: #FF5252 !important;
}

.autopost-points.zero {
    color: var(--text-muted) !important;
}

.autopost-points.plus {
    color: var(--primary-color) !important;
}

.autopost-points span {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    opacity: 0.9 !important;
}
/* Centralized SVG Icon Styles */
.verified-badge {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    flex-shrink: 0;
}
.autopost-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}
.logo-icon {
    width: 75px;
    height: 103px;
}
.sidebar-logo svg {
    width: 24px;
    height: 33px;
}
.emoji-icon.active {
    color: var(--primary-color) !important;
}
/* Custom Emoji Dropdown */
.emoji-dropdown-container {
    position: relative;
    display: inline-block;
}

.emoji-dropdown {
    position: absolute;
    bottom: 100%;
    right: 0; /* Default: expand to left */
    width: 220px;
    max-height: 180px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    display: none;
    grid-template-columns: repeat(5, 1fr);
    padding: 10px;
    gap: 4px;
    z-index: 1001;
    margin-bottom: 8px;
    animation: slideUp 0.2s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

/* Align to right (expand to right) */
.emoji-dropdown.align-left {
    right: auto;
    left: 0;
}

@media (max-width: 480px) {
    .emoji-dropdown {
        width: 180px; /* Smaller width on mobile */
        max-width: 85vw;
        grid-template-columns: repeat(4, 1fr); /* 4 per row */
    }
}

.emoji-dropdown::-webkit-scrollbar {
    width: 5px;
}

.emoji-dropdown::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

.emoji-dropdown.show {
    display: grid;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.emoji-item {
    cursor: pointer;
    font-size: 1.25rem;
    padding: 6px;
    text-align: center;
    border-radius: 8px;
    transition: all 0.2s;
    user-select: none;
}

.emoji-item:hover {
    background: var(--bg-light);
    transform: scale(1.1);
}

/* For Post Input (Dropdown appears below) */
.post-input-footer .emoji-dropdown {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: 8px;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.rank-badge {
    color: var(--text-muted);
    font-size: 1.4rem;
    font-weight: 900;
    font-style: italic;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0.6;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-light) 25%, var(--border-color) 50%, var(--bg-light) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-text {
    height: 12px;
    margin-bottom: 10px;
    width: 100%;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 15px;
    margin-top: 15px;
}

/* Unread activity notification badges */
.badge-count {
    background-color: #FF4B4B;
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    min-width: 18px;
    height: 18px;
    box-sizing: border-box;
}

/* Highlighted post styling for notification deep-linking */
.highlighted-post {
    animation: post-highlight-glow 2.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes post-highlight-glow {
    0% {
        box-shadow: 0 0 0 4px rgba(2, 176, 167, 0.4);
        border-color: var(--primary-color);
        transform: scale(1.02);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(2, 176, 167, 0.2);
        border-color: var(--primary-color);
        transform: scale(1.01);
    }
    100% {
        box-shadow: none;
        transform: scale(1);
    }
}

/* Clickable activity item animations and hover effects */
.activity-item.clickable-activity {
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.activity-item.clickable-activity:hover {
    background: var(--bg-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Dynamic Auto-growing post creation textarea */
.post-input-area textarea {
    min-height: 60px;
    max-height: 350px;
    overflow-y: auto;
    transition: height 0.15s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Long post minimization & Read More styles */
.post-text-container {
    max-height: 125px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.post-text-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 45px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--card-bg));
    pointer-events: none;
    display: none;
}

/* Support dark mode theme for fade background overlay */
[data-theme="dark"] .post-text-fade {
    background: linear-gradient(to bottom, rgba(37, 39, 40, 0), var(--card-bg));
}

.read-more-btn {
    display: none;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 8px;
    transition: color 0.2s, transform 0.2s;
}

.read-more-btn:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Post owner actions dropdown styles */
.post-menu-container {
    position: relative;
    margin-left: auto;
}

.post-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.post-menu-btn:hover {
    background: var(--bg-light);
    color: var(--text-main);
}

.post-menu-btn svg {
    stroke: currentColor;
    width: 20px;
    height: 20px;
}

.post-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 30px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 150px;
    overflow: hidden;
    animation: dropFadeIn 0.25s cubic-bezier(0.25, 1, 0.5, 1);
    backdrop-filter: blur(10px);
}

@keyframes dropFadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    padding: 10px 15px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-light);
}

.dropdown-item.delete-item {
    color: var(--text-muted);
}

.dropdown-item.delete-item:hover {
    background: var(--bg-light);
}

/* Post Inline Edit Button Styles */
.edit-action-btn {
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.edit-action-btn:active {
    transform: scale(0.95);
}

.edit-action-btn.cancel-btn {
    background: var(--bg-light);
    color: var(--text-muted);
}

.edit-action-btn.cancel-btn:hover {
    background: rgba(0,0,0,0.05);
}

.edit-action-btn.save-btn {
    background: var(--primary-color);
    color: white;
}

.edit-action-btn.save-btn:hover {
    background: var(--primary-hover);
}

/* Comment Action hover/style adjustments */
.comment-action-btn {
    cursor: pointer;
    transition: color 0.2s;
}
.comment-action-btn:hover {
    color: var(--text-main);
    text-decoration: underline;
}
.comment-action-btn.delete:hover {
    color: var(--text-main) !important;
    text-decoration: underline;
}

.comment-open-text {
    margin-left: auto;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 0;
}

.comment-open-text:hover {
    color: var(--primary-color);
}

.comment-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: blur(10px);
}

.comment-modal-backdrop.is-open {
    display: flex;
    animation: fadeIn 0.18s ease;
}

.comment-modal {
    position: relative;
    width: min(1040px, 100%);
    height: min(720px, calc(100vh - 48px));
    display: grid;
    grid-template-columns: minmax(0, 1.42fr) minmax(360px, 0.78fr);
    overflow: visible;
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid rgba(0, 191, 165, 0.16);
    border-radius: 20px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

.comment-modal-media {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    background: linear-gradient(180deg, rgba(0, 191, 165, 0.08), rgba(0, 0, 0, 0.02)), var(--bg-light);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
    border-radius: 20px 0 0 20px;
}

.comment-modal-postbar {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
}

.comment-modal-author-link {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: inherit;
    text-decoration: none;
}

.comment-modal-author-link span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.comment-modal-author-link strong {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.95rem;
}

.comment-modal-author-link small {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.comment-modal-image-frame,
.comment-modal-text-frame {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-modal-image-frame {
    background: rgba(0, 0, 0, 0.72);
}

.comment-modal-image-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.comment-modal-text-frame {
    padding: 34px;
}

.comment-modal-text-preview {
    width: min(460px, 100%);
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 1.05rem;
    line-height: 1.6;
}

.comment-modal-panel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    overflow-y: auto;
    border-radius: 0 20px 20px 0;
}

.comment-modal-summary {
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--border-color);
}

.comment-modal-summary-text {
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.58;
}

.comment-modal-summary-text.is-collapsed {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
}

.comment-modal-summary-text.is-expanded {
    display: block;
}

.comment-modal-read-more {
    margin: 8px 0 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
}

.comment-modal-reactions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 14px;
}

.comment-modal-reaction {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 44px;
    height: 34px;
    padding: 0;
    border: none;
    background: transparent;
    color: #b0bec5;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
}

.comment-modal-reaction.active,
.comment-modal-reaction:hover {
    color: var(--primary-color);
}

.comment-modal-reaction .action-svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
    stroke: currentColor;
}

.comment-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-color);
}

.comment-modal-header h3 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
}

.comment-modal-header p {
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.comment-modal-close {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--text-muted);
    cursor: pointer;
}

@media (min-width: 761px) {
    .comment-modal-close {
        position: fixed;
        top: 24px;
        right: 24px;
        z-index: 20;
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        color: var(--text-main);
        box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
    }
}

.comment-modal-close:hover {
    color: var(--text-main);
}

.comment-modal-close svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
}

.comment-modal-list {
    flex: 0 0 auto;
    min-height: 140px;
    overflow: visible;
    margin-bottom: 0;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.comment-modal-panel,
.comment-modal-summary-text {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 191, 165, 0.55) transparent;
}

.comment-modal-panel::-webkit-scrollbar,
.comment-modal-summary-text::-webkit-scrollbar {
    width: 8px;
}

.comment-modal-panel::-webkit-scrollbar-track,
.comment-modal-summary-text::-webkit-scrollbar-track {
    background: transparent;
}

.comment-modal-panel::-webkit-scrollbar-thumb,
.comment-modal-summary-text::-webkit-scrollbar-thumb {
    background: rgba(0, 191, 165, 0.38);
    border-radius: 999px;
    border: 2px solid var(--card-bg);
}

.comment-modal-panel::-webkit-scrollbar-thumb:hover,
.comment-modal-summary-text::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 191, 165, 0.62);
}

.comment-load-more {
    margin: 14px 20px 0;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 800;
}

.comment-empty-state {
    margin: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.comment-thread-item {
    gap: 10px;
    align-items: flex-start;
}

.comment-bubble {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-light) 74%, var(--card-bg));
}

.comment-bubble .comment-text-container {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
}

.comment-meta-row span[style*="font-weight: 700"] {
    font-size: 0.88rem !important;
}

.comment-actions-bar {
    font-size: 0.74rem !important;
}

.comment-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

.comment-modal-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.comment-modal-input-row .comment-input {
    width: 100%;
    min-height: 36px;
    max-height: 118px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 45px 8px 15px;
    outline: none;
    resize: none;
    overflow-y: auto;
    box-sizing: border-box;
    background: var(--card-bg);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
}

.comment-modal-input-row .comment-input::-webkit-scrollbar {
    width: 6px;
}

.comment-modal-input-row .comment-input::-webkit-scrollbar-track {
    background: transparent;
}

.comment-modal-input-row .comment-input::-webkit-scrollbar-thumb {
    background: rgba(0, 191, 165, 0.38);
    border-radius: 999px;
}

.comment-submit-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 191, 165, 0.24);
}

.comment-submit-btn:hover {
    background: var(--primary-hover);
}

.comment-submit-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.comment-submit-btn span {
    font-size: 0;
}

.comment-submit-btn span::before {
    content: "";
    width: 0;
    height: 0;
    display: block;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 9px solid currentColor;
    transform: translateX(1px);
}

.comment-submit-btn::before {
    content: "";
    width: 0;
    height: 0;
    display: block;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 9px solid currentColor;
    transform: translateX(1px);
}

.comment-submit-btn span,
.comment-submit-btn span::before {
    display: none;
}

body.comment-modal-open {
    overflow: hidden;
}

@media (max-width: 760px) {
    .comment-modal-backdrop {
        align-items: stretch;
        padding: 0;
    }

    .comment-modal {
        width: 100%;
        height: 100dvh;
        max-height: none;
        display: flex;
        flex-direction: column;
        border-radius: 0;
        border: none;
        overflow: hidden;
    }

    .comment-modal-media {
        flex: 0 0 auto;
        max-height: 42vh;
        grid-template-rows: auto minmax(150px, auto);
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        position: relative;
        border-radius: 0;
    }

    .comment-modal-image-frame {
        max-height: 28vh;
    }

    .comment-modal-image-frame img {
        height: auto;
        max-height: 28vh;
        object-fit: contain;
    }

    .comment-modal-text-frame {
        padding: 16px;
    }

    .comment-modal-text-preview {
        padding: 16px;
        font-size: 0.95rem;
    }

    .comment-modal-panel {
        flex: 1;
        min-height: 0;
        border-radius: 0;
    }

    .comment-modal-summary {
        display: block;
        padding: 14px 16px 13px;
    }

    .comment-modal-summary-text {
        font-size: 1rem;
        line-height: 1.62;
    }

    .comment-modal-reactions {
        margin-top: 12px;
        gap: 18px;
    }

    .comment-modal-header {
        padding: 14px 16px 12px;
    }

    .comment-modal-author-link strong {
        font-size: 1rem;
    }

    .comment-modal-author-link small,
    .comment-modal-header p {
        font-size: 0.8rem;
    }

    .comment-modal-header h3 {
        font-size: 1.08rem;
    }

    .comment-bubble .comment-text-container {
        font-size: 0.95rem !important;
        line-height: 1.55 !important;
    }

    .comment-meta-row span[style*="font-weight: 700"] {
        font-size: 0.92rem !important;
    }

    .comment-actions-bar {
        font-size: 0.76rem !important;
    }

    .comment-modal-input-row .comment-input {
        font-size: 0.95rem;
        line-height: 1.45;
    }

    .post-content,
    .post-text-container {
        font-size: 1rem;
        line-height: 1.62;
    }

    .comment-modal-close {
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 6;
        background: rgba(20, 24, 24, 0.82);
        color: white;
        border: 1px solid rgba(255, 255, 255, 0.16);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
        backdrop-filter: blur(8px);
    }

    .comment-modal-list {
        padding: 14px 16px;
    }

    .comment-modal-input-row {
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    }
}

/* Premium Metallic Subtitle Effect */
.section-subtitle {
    font-size: 0.8rem;
    font-weight: 600;
    font-style: italic;
    letter-spacing: 0.5px;
    margin-left: 6px;
    color: #8E9EAB; /* Clean, uniform premium metallic slate gray */
    display: inline-block;
}

/* ==========================================================================
   Admin Panel - Light & Dark Mode Styles
   ========================================================================== */

[data-theme="dark"] body {
    --admin-bg: #121212;
    background-color: var(--admin-bg) !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .overview-section,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .admin-profile,
[data-theme="dark"] .action-btn,
[data-theme="dark"] .list-container,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .question-card,
[data-theme="dark"] .input-card,
[data-theme="dark"] .input-container,
[data-theme="dark"] .dashboard-container,
[data-theme="dark"] .feedback-card,
[data-theme="dark"] .feedback-body,
[data-theme="dark"] .subject-select-wrapper,
[data-theme="dark"] .subject-header {
    background-color: var(--card-bg) !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}

[data-theme="dark"] .admin-profile div,
[data-theme="dark"] .admin-profile span,
[data-theme="dark"] .page-title,
[data-theme="dark"] .footer-link,
[data-theme="dark"] .q-text,
[data-theme="dark"] .preview-q-text,
[data-theme="dark"] .modal-form label,
[data-theme="dark"] .q-answer-text,
[data-theme="dark"] .col-no,
[data-theme="dark"] .col-username,
[data-theme="dark"] .col-points,
[data-theme="dark"] .col-info,
[data-theme="dark"] .col-info span,
[data-theme="dark"] .section-title,
[data-theme="dark"] .page-subtitle,
[data-theme="dark"] .q-answer-label,
[data-theme="dark"] .header-title,
[data-theme="dark"] .feedback-username,
[data-theme="dark"] .empty-title,
[data-theme="dark"] .empty-desc,
[data-theme="dark"] label,
[data-theme="dark"] .subject-item,
[data-theme="dark"] .back-btn {
    color: var(--text-main) !important;
}

[data-theme="dark"] .search-bar {
    background-color: var(--card-bg) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .search-bar input {
    background: transparent !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .user-table {
    border-color: #004D40 !important;
}

[data-theme="dark"] .user-row {
    border-bottom-color: #004D40 !important;
}

[data-theme="dark"] .pagination .page-btn {
    background-color: #2D2D2D !important;
    color: var(--text-main) !important;
}

[data-theme="dark"] .pagination .page-btn.active {
    background-color: #00BFA5 !important;
    color: white !important;
    border-color: #00BFA5 !important;
}

[data-theme="dark"] .modal-form textarea, 
[data-theme="dark"] .modal-form input[type="text"],
[data-theme="dark"] .modal-form select,
[data-theme="dark"] .textarea-soal,
[data-theme="dark"] .input-jawaban,
[data-theme="dark"] textarea,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] select {
    background-color: #1e1e1e !important;
    color: var(--text-main) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .preview-answer-box {
    background-color: #1e2a2a !important;
    border-color: var(--primary-color) !important;
}

[data-theme="dark"] .preview-answer-box div {
    color: var(--text-main) !important;
}

[data-theme="dark"] hr {
    border-top-color: #333 !important;
}

[data-theme="dark"] .subject-item:not(.active):hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .subject-item.active {
    background-color: #004D40 !important;
    color: #00BFA5 !important;
}

[data-theme="dark"] .tab-btn {
    border: 1px solid var(--border-color) !important;
}


