:root {
    --primary-background: #000;
    --card-background: #000;
    --primary-text: #f1f1f1;
    --secondary-text: #a8a8a8;
    --border-color: #262626;
    --accent-color: #0095f6;
    --red-like: #ed4956;
}

body, html {
    height: 100%;
    width: 100%;
    margin: 0;
    background-color: var(--primary-background);
    color: var(--primary-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
}

body.is-sidebar-app #image-feed {
    max-width: none;
}
body.is-sidebar-app #header {
    padding: 5px 10px;
}
body.is-sidebar-app .card-header {
    padding: 8px 12px;
}

#app-container {
    display: none;
    flex-direction: column;
    align-items: center;
    height: 100%;
    width: 100%;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

#image-feed {
    width: 100%;
    max-width: 500px;
    padding-top: 60px;
}

.card {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.card-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
}

.card-media-wrapper {
    position: relative;
    width: 100%;
    padding-top: 125%;
    overflow: hidden;
    background-color: #1a1a1a;
}

.card-media-wrapper .blurred-bg {
    position: absolute;
    top: -10%; left: -10%;
    width: 120%; height: 120%;
    background-size: cover;
    background-position: center;
    filter: blur(20px);
    z-index: 1;
}

.card-media-wrapper .card-media {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    z-index: 2;
    display: block;
}

.like-heart-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 80px;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    z-index: 3;
}
.like-heart-overlay.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.mute-toggle {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 4;
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    padding: 0;
}
.mute-toggle svg {
    width: 16px;
    height: 16px;
}


.card-actions {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.action-icon {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--primary-text);
}

.action-icon svg {
    width: 28px; height: 28px;
    transition: transform 0.1s ease-out;
}
.action-icon svg .heart-path { stroke: var(--primary-text); stroke-width: 2; }
.action-icon:active { transform: scale(0.9); }

.action-icon[data-action="dislike"] svg { stroke: var(--primary-text); stroke-width: 2; }
.action-icon.liked svg .heart-path { fill: var(--red-like); stroke: var(--red-like); }
.action-icon.disliked { color: var(--accent-color); }
.card.rated .action-icon:not(.liked):not(.disliked) { opacity: 0.3; pointer-events: none; }
.card.rated .action-icon.liked, .card.rated .action-icon.disliked { transform: scale(1.1); }

.card-footer { padding: 4px 16px 16px 16px; font-size: 14px; line-height: 1.4; }
.tag-list .tag { color: var(--secondary-text); margin-right: 5px; }
.tag-list .tag-more-button { color: #8e8e8e; cursor: pointer; background: none; border: none; padding: 0; font-size: 14px; margin-left: 2px; }
.tag-list .hidden { display: none; }

.post-link-container {
    margin-top: 12px;
    font-size: 12px;
}
.post-link-container a {
    color: var(--secondary-text);
    text-decoration: none;
    transition: color 0.2s ease;
}
.post-link-container a:hover {
    color: var(--primary-text);
}

#initial-loading-indicator { padding: 40px; display: none; justify-content: center; width: 100%; position: absolute; top: 50%; transform: translateY(-50%); }
#scroll-sentinel { height: 50px; width: 100%; }
.spinner { border: 4px solid rgba(255, 255, 255, 0.2); border-left-color: var(--primary-text); border-radius: 50%; width: 36px; height: 36px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Auth & Header Styles --- */
#auth-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.auth-form { background-color: #2a2a2a; padding: 30px; border-radius: 10px; width: 300px; }
.auth-form h2 { text-align: center; margin-top: 0; }
.auth-form input { width: 100%; padding: 10px; margin-bottom: 15px; border: 1px solid #444; background-color: #333; color: #eee; border-radius: 5px; box-sizing: border-box; }
.auth-form button { width: 100%; padding: 10px; border: none; background-color: var(--accent-color); color: white; border-radius: 5px; cursor: pointer; font-size: 16px; }
#auth-toggle { text-align: center; margin-top: 15px; font-size: 14px; }
#auth-toggle a { color: var(--accent-color); cursor: pointer; }
.auth-error { color: var(--red-like); text-align: center; margin-bottom: 10px; min-height: 1.2em; }
#header { position: fixed; top: 0; left: 0; width: 100%; padding: 10px 20px; box-sizing: border-box; display: none; justify-content: flex-end; align-items: center; background: rgba(0,0,0,0.7); backdrop-filter: blur(10px); z-index: 900; border-bottom: 1px solid var(--border-color); }
#header-controls { display: flex; align-items: center; gap: 20px; }
#user-controls { display: flex; align-items: center; gap: 15px; }
#logout-btn { padding: 8px 15px; background-color: #555; color: white; border: none; border-radius: 5px; cursor: pointer; }

/* --- Settings Menu Styles --- */
#settings-container { position: relative; }
#settings-btn { background: none; border: none; cursor: pointer; padding: 5px; display: flex; align-items: center; justify-content: center; color: var(--primary-text); }
#settings-menu { position: absolute; top: 100%; right: 0; margin-top: 10px; background-color: #2a2a2a; border-radius: 8px; border: 1px solid var(--border-color); box-shadow: 0 4px 12px rgba(0,0,0,0.2); z-index: 1001; overflow: hidden; min-width: 250px; padding: 8px; }
#settings-menu.hidden { display: none; }
.settings-section { padding: 8px; margin-bottom: 8px; }
.settings-section > label { font-weight: 600; font-size: 15px; margin-bottom: 4px; display: block; }
.settings-description { font-size: 12px; color: var(--secondary-text); margin: 0 0 8px 0; }
#blacklist-input, #required-tags-input { width: 100%; box-sizing: border-box; background-color: #1c1c1c; border: 1px solid #444; border-radius: 5px; color: var(--primary-text); font-family: inherit; padding: 8px; resize: vertical; }
#source-filters { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.checkbox-wrapper { display: flex; align-items: center; }
.checkbox-wrapper input[type="checkbox"] { opacity: 0; width: 0; height: 0; }
.checkbox-wrapper label { cursor: pointer; font-size: 14px; padding-left: 28px; position: relative; }
.checkbox-wrapper label::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border: 2px solid #555; background-color: #333; border-radius: 4px; transition: all 0.2s; }
.checkbox-wrapper input[type="checkbox"]:checked + label::after { content: ''; position: absolute; left: 7px; top: 4px; width: 5px; height: 10px; border: solid var(--primary-text); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.checkbox-wrapper input[type="checkbox"]:checked + label::before { background-color: var(--accent-color); border-color: var(--accent-color); }
.menu-item { display: block; width: 100%; padding: 12px 16px; background: none; border: none; color: var(--primary-text); text-align: left; font-size: 14px; cursor: pointer; }
.menu-item:hover { background-color: #383838; }
.menu-item-primary { background-color: var(--accent-color); border-radius: 5px; text-align: center; font-weight: 600; }
.menu-item-primary:hover { background-color: #007ac1; }
#reset-algorithm-btn { color: var(--red-like); }
.menu-divider { border: none; height: 1px; background-color: var(--border-color); margin: 8px 0; }

/* --- Saved Media Modal Styles --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-overlay.hidden { display: none; }
.modal-content { background-color: #2a2a2a; padding: 20px; border-radius: 10px; width: 90%; max-width: 600px; max-height: 80vh; overflow-y: auto; position: relative; }
.modal-close-btn { position: absolute; top: 10px; right: 15px; background: none; border: none; color: var(--secondary-text); font-size: 28px; cursor: pointer; }
.saved-media-item { padding: 8px 0; border-bottom: 1px solid var(--border-color); }
.saved-media-item a { color: var(--accent-color); text-decoration: none; word-break: break-all; }

