*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
[data-theme="day"] {
    --bg: #fafaf8;
    --ink: #1a1916;
    --dim: #9a9690;
    --sub: #e4e1db;
    --new-hl: rgba(0, 149, 255, 0.05);
    --hot-hl: rgba(214, 59, 47, 0.05);
    --hover-bg: #f1f0ec;
    --hover-ink: #0056b3;
    --header-bg: rgba(250, 250, 248, 0.95);
    --hot-bg: #d63b2f;
    --icon-color: #9a9690;
    --rumour: #f77f00;
    --theme-icon: "☀";
}
[data-theme="night"] {
    --bg: #111110;
    --ink: #dedad4;
    --dim: #55524e;
    --sub: #252422;
    --new-hl: rgba(0, 149, 255, 0.1);
    --hot-hl: rgba(214, 59, 47, 0.1);
    --hover-bg: #1a1a19;
    --hover-ink: #4dabf7;
    --header-bg: rgba(17, 17, 16, 0.95);
    --hot-bg: #d63b2f;
    --icon-color: #55524e;
    --rumour: #f77f00;
    --theme-icon: "☾";
}
[data-theme="forest"] {
    --bg: #1e2f23;
    --ink: #d4cfa8;
    --dim: #607744;
    --sub: #2e4430;
    --new-hl: rgba(179, 156, 77, 0.12);
    --hot-hl: rgba(118, 137, 72, 0.15);
    --hover-bg: #263528;
    --hover-ink: #b39c4d;
    --header-bg: rgba(30, 47, 35, 0.96);
    --hot-bg: #d63b2f;
    --icon-color: #607744;
    --rumour: #f77f00;
    --theme-icon: "⟡";
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: "DM Sans", sans-serif;
    max-width: 950px;
    margin: 0 auto;
    padding: 100px 20px 40px;
    transition:
        background 0.4s ease,
        color 0.4s ease;
}
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition:
        background 0.4s ease,
        border-color 0.4s ease,
        padding 0.3s ease;
}
header.scrolled {
    border-color: var(--sub);
    padding: 8px 20px;
}
.header-inner {
    max-width: 950px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
h1 {
    font-family: "Micro 5";
    font-size: clamp(48px, 8vw, 58px);
    line-height: 0.8;
    background: linear-gradient(to top, #fcbf49, #f77f00, #d62828, #003049);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
h1 span {
    display: block;
    font-family: "DM Sans";
    font-size: 10px;
    letter-spacing: 2.5px;
    color: var(--dim);
    text-transform: uppercase;
    -webkit-text-fill-color: var(--dim);
    margin-top: 2px;
}

.badge-jp {
    background: #000;
    color: #fff;
}

[data-theme="night"] .badge-jp {
    background: #dedad4;
    color: #111110;
}

[data-theme="forest"] .badge-jp {
    background: #b39c4d;
    color: #1e2f23;
}
#feed {
    list-style: none;
}
.item {
    display: grid;
    grid-template-columns: 35px 1fr 24px 18px;
    gap: 12px;
    align-items: center;
    padding: 0 8px;
    margin-bottom: 1px;
    border-radius: 3px;
    opacity: 0;
    transform: translateY(5px);
    transition:
        0.2s ease,
        background 0.3s ease;
}
.item.show {
    opacity: 1;
    transform: none;
    position: relative;
    transition:
        0.2s ease,
        background 0.4s ease;
}
.item.show::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 30px;
    height: 1px;
    background: var(--sub);
    transition: background 0.4s ease;
}
.item.hidden {
    display: none;
}
.item:hover {
    background: var(--hover-bg);
}
.item:hover .item-body a {
    color: var(--hover-ink);
}

/* --- SOURCE LOGO & PLACEHOLDER CSS --- */
.item-logo,
.icon-placeholder {
    width: 22px;
    height: 22px;
    object-fit: contain;
    opacity: 0.3;
    filter: grayscale(0%);
    transition: all 0.2s ease;
    border-radius: 2px;
    background: transparent;
}

.item:hover .item-logo,
.item:hover .icon-placeholder {
    filter: grayscale(0%);
    opacity: 1;
}

[data-theme="night"] .item-logo,
[data-theme="night"] .icon-placeholder,
[data-theme="forest"] .item-logo,
[data-theme="forest"] .icon-placeholder {
    filter: grayscale(100%) invert(1) brightness(1.2) drop-shadow(0 0 5px rgba(255, 255, 255, 0.05));
    opacity: 1;
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="night"] .item:hover .item-logo,
[data-theme="night"] .item:hover .icon-placeholder,
[data-theme="forest"] .item:hover .item-logo,
[data-theme="forest"] .item:hover .icon-placeholder {
    filter: grayscale(0%) invert(0%) brightness(1) drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

.icon-placeholder {
    background: linear-gradient(to top, #fcbf49, #f77f00, #d62828, #003049);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    font-weight: bolder;
    font-family: "Micro 5";
    text-transform: capitalize;
    color: #fff;
    flex-shrink: 0;
}
[data-theme="night"] .icon-placeholder {
    color: #fff;
}

.item-logo.hidden {
    display: none;
}
/* --- END SOURCE LOGO CSS --- */

.logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.item[data-new="true"] {
    background: var(--new-hl);
}
.item[data-hot="true"] {
    background: var(--hot-hl);
}
.item-date {
    font-size: 10px;
    color: var(--dim);
    font-weight: 500;
    text-align: left;
    transition: color 0.4s ease;
}
.item-body a {
    color: var(--ink);
    text-decoration: none;
    font-size: 17px;
    line-height: 1.2;
    transition: color 0.15s;
    font-weight: 400;
}
.badge {
    font-size: 8px;
    font-weight: 800;
    color: #fff;
    padding: 1px 3px;
    border-radius: 2px;
    text-transform: uppercase;
    margin-left: 4px;
    vertical-align: middle;
    display: inline-block;
}
.badge-new {
    background: #0095ff;
}
.badge-hot {
    background: var(--hot-bg);
}
.badge-rumour {
    background: var(--rumour);
}
.badge-ps {
    background: #006fcd;
}
.badge-nintendo {
    background: #e4000f;
}
.badge-xbox {
    background: #0e7a0d;
}
.controls {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-right: 30px;
}
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--icon-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        color 0.4s ease,
        opacity 0.2s;
    opacity: 0.8;
}
.icon-btn:hover {
    color: var(--ink);
    opacity: 1;
}
.icon-btn svg {
    width: 17px;
    height: 17px;
    pointer-events: none;
}
.expand-container {
    display: flex;
    align-items: center;
}
.expandable {
    max-width: 0;
    overflow: hidden;
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: flex;
    align-items: center;
}
.expandable.active {
    max-width: 200px;
    margin-left: 10px;
}
#search-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--sub);
    color: var(--ink);
    font-family: "DM Sans";
    font-size: 13px;
    outline: none;
    padding: 2px 0;
    width: 140px;
    transition:
        border-color 0.4s ease,
        color 0.4s ease;
}
.filter-options {
    display: flex;
    gap: 12px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--dim);
    transition: color 0.4s ease;
}
.filter-opt {
    cursor: pointer;
    transition: color 0.15s;
}
.filter-opt.active {
    color: var(--ink);
    border-bottom: 1px solid var(--ink);
}

/* filter dropdown — opens below the filter icon button */
#filter-container {
    position: relative;
}
#filter-btn.open {
    color: var(--ink);
    opacity: 1;
}
#filter-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 50;
    background: var(--bg);
    border: 1px solid var(--sub);
    border-radius: 4px;
    min-width: 140px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 4px 0;
    transition:
        background 0.4s ease,
        border-color 0.4s ease;
}
#filter-menu.open {
    display: block;
}
#filter-menu .filter-opt {
    display: block;
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--dim);
    border-bottom: none;
    white-space: nowrap;
    transition: background 0.1s, color 0.15s;
}
#filter-menu .filter-opt:hover {
    background: var(--hover-bg);
    color: var(--ink);
}
#filter-menu .filter-opt.active {
    color: var(--ink);
    background: var(--hover-bg);
    border-bottom: none;
}
#splash {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    transition: opacity 0.5s;
}
#splash.fade {
    opacity: 0;
    pointer-events: none;
}
.splash-title {
    font-family: "Micro 5";
    font-size: 60px;
}
.splash-track {
    width: 200px;
    height: 1px;
    background: var(--sub);
    margin: 30px 0;
    overflow: hidden;
}
.splash-fill {
    height: 100%;
    background: var(--ink);
    width: 0%;
    transition: width 0.3s;
}
footer {
    margin-top: 60px;
    border-top: 1px solid var(--sub);
    padding: 30px 0;
    text-align: center;
}
.footer-text {
    font-size: 10px;
    color: var(--dim);
}

/* --- BOOKMARK BUTTON ON HOVER --- */
.bm-btn {
    background: none;
    border: none;
    outline: none;
    box-shadow: none;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.15s,
        color 0.15s;
    color: var(--dim);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.bm-btn svg {
    width: 18px;
    height: 18px;
}
.item:hover .bm-btn {
    opacity: 1;
    pointer-events: auto;
}
.bm-btn.bookmarked {
    opacity: 1;
    pointer-events: auto;
    color: #f4a240;
}
.bm-btn.bookmarked svg {
    fill: #f4a240;
    stroke: #f4a240;
}
.bm-btn:hover {
    color: #f4a240;
}

/* --- SEARCH CLEAR BUTTON --- */
#search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--dim);
    font-size: 16px;
    line-height: 1;
    padding: 0 0 0 4px;
    transition: color 0.15s;
}
#search-clear:hover {
    color: var(--ink);
}

/* --- BOOKMARKS OVERLAY --- */
#bookmarks-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    backdrop-filter: blur(4px);
}
#bookmarks-panel {
    background: var(--bg);
    width: min(420px, 100vw);
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--sub);
    animation: slideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transition:
        background 0.4s ease,
        border-color 0.4s ease;
}
@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}
#bookmarks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--sub);
    flex-shrink: 0;
}
#bookmarks-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--dim);
}
#bookmarks-feed {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
}
#bookmarks-empty {
    padding: 40px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--dim);
    display: none;
}
.bm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--sub);
    transition:
        background 0.15s,
        border-color 0.4s ease;
}
.bm-item:hover {
    background: var(--hover-bg);
}
.bm-item-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.bm-item-main a {
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.3;
    transition: color 0.15s;
    display: block;
}
.bm-item-main a:hover {
    color: var(--hover-ink);
}
.bm-item-source {
    display: flex;
    align-items: center;
    gap: 5px;
}
.bm-item-logo {
    width: 12px;
    height: 12px;
    object-fit: contain;
    border-radius: 2px;
    opacity: 0.6;
    flex-shrink: 0;
}
.bm-item-logo.hidden {
    display: none;
}
.bm-item-domain {
    font-size: 10px;
    color: var(--dim);
    transition: color 0.4s ease;
}
.bm-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--dim);
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
    transition: color 0.15s;
}
.bm-remove:hover {
    color: var(--ink);
}

/* --- READ HISTORY --- */
.item.read-dimmed {
    opacity: 0.4;
}
.item.read-dimmed:hover {
    opacity: 1;
}

/* --- SOURCES FILTER MENU --- */
#sources-filter-wrap {
    display: flex;
    justify-content: flex-end;
    padding: 0 8px;
    margin-bottom: 12px;
    position: relative;
}
#sources-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: "DM Sans";
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--dim);
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 0;
    transition: color 0.15s;
}
#sources-btn:hover,
#sources-btn.open {
    color: var(--ink);
}
#sources-btn svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}
#sources-btn.open svg {
    transform: rotate(180deg);
}
#sources-muted-count {
    font-weight: 400;
    opacity: 0.7;
}
#sources-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 50;
    background: var(--bg);
    border: 1px solid var(--sub);
    border-radius: 4px;
    width: 220px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transition:
        background 0.4s ease,
        border-color 0.4s ease;
    overflow: hidden;
}
#sources-menu.open {
    display: flex;
    flex-direction: column;
}
#sources-menu-inner {
    overflow-y: auto;
    max-height: 320px;
    padding: 4px 0;
}
.sources-menu-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px;
    cursor: pointer;
    transition: background 0.1s;
    opacity: 0.35;
}
.sources-menu-row:hover {
    background: var(--hover-bg);
}
.sources-menu-row.selected {
    opacity: 1;
}
.sources-menu-logo {
    width: 14px;
    height: 14px;
    object-fit: contain;
    border-radius: 2px;
    flex-shrink: 0;
}
.sources-menu-logo.hidden {
    display: none;
}
.sources-menu-label {
    flex: 1;
    font-size: 12px;
    color: var(--ink);
    transition: color 0.4s ease;
}
.sources-menu-check {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--ink);
    opacity: 0;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
}
.sources-menu-check svg {
    width: 12px;
    height: 12px;
}
.sources-menu-row.selected .sources-menu-check {
    opacity: 1;
}
#sources-menu-footer {
    border-top: 1px solid var(--sub);
    padding: 7px 14px;
    display: flex;
    justify-content: flex-end;
    transition: border-color 0.4s ease;
}
#sources-reset {
    background: none;
    border: none;
    cursor: pointer;
    font-family: "DM Sans";
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--dim);
    padding: 0;
    transition: color 0.15s;
}
#sources-reset:hover {
    color: var(--ink);
}

.item-sources {
    display: none;
    grid-column: 1 / -1;
    padding: 4px 0 8px 47px;
}
.item-sources.open {
    display: block;
}
.source-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--sub);
    transition: border-color 0.4s ease;
}
.source-row:last-child {
    border-bottom: none;
}
.source-row a {
    color: var(--ink);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.3;
    transition: color 0.15s;
    flex: 1;
}
.source-row a:hover {
    color: var(--hover-ink);
}
.source-row-date {
    font-size: 10px;
    color: var(--dim);
    font-weight: 500;
    white-space: nowrap;
}
.source-row-logo,
.source-row-placeholder {
    width: 14px;
    height: 14px;
    object-fit: contain;
    border-radius: 2px;
    flex-shrink: 0;
    filter: grayscale(0%);
    opacity: 1;
}
.source-row-placeholder {
    background-color: #ffb347;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: bold;
    text-transform: lowercase;
    color: #1a1916;
}
[data-theme="night"] .source-row-placeholder,
[data-theme="forest"] .source-row-placeholder {
    color: #fff;
}
.source-row-logo.hidden {
    display: none;
}
.sources-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--dim);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 3px;
}
.sources-count:hover {
    color: var(--ink);
}
.sources-count-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    padding: 2px 4px;
    display: flex;
    align-items: center;
    gap: 2px;
    transition: color 0.15s;
}
.sources-count-label:hover {
    color: var(--ink);
}
[data-theme="night"] .sources-count-label,
[data-theme="forest"] .sources-count-label {
    color: #a3a1a0;
}
.item.has-group {
    grid-template-columns: 35px 1fr auto 18px;
}
.sources-chevron {
    transition: transform 0.2s ease;
    display: inline-block;
}
.sources-chevron.open {
    transform: rotate(180deg);
}

/* ─── BUY ME A COFFEE ────────────────────────────────────────────── */
#bmc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-color);
    opacity: 0.8;
    transition: color 0.4s ease, opacity 0.2s;
    text-decoration: none;
}
#bmc-btn:hover {
    color: var(--ink);
    opacity: 1;
}
#bmc-btn svg {
    width: 17px;
    height: 17px;
    pointer-events: none;
}

/* ─── THEME CYCLE BUTTON ─────────────────────────────────────────── */
#theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--icon-color);
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: "DM Sans", sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.8;
    transition: color 0.2s, opacity 0.2s;
    padding: 2px 0;
}
#theme-btn:hover {
    color: var(--ink);
    opacity: 1;
}
#theme-btn svg {
    width: 17px;
    height: 17px;
    pointer-events: none;
}
.theme-dots {
    display: flex;
    gap: 3px;
    align-items: center;
}
.theme-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1.5px solid var(--dim);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    cursor: pointer;
}
.theme-dot.active {
    border-color: var(--ink);
    transform: scale(1.25);
}
.theme-dot[data-t="day"]    { background: #fafaf8; }
.theme-dot[data-t="night"]  { background: #111110; }
.theme-dot[data-t="forest"] { background: #34623f; }
[data-theme="night"] .theme-dot[data-t="day"]    { border-color: #55524e; }
[data-theme="night"] .theme-dot[data-t="day"].active { border-color: var(--ink); }
[data-theme="forest"] .theme-dot { border-color: #607744; }
[data-theme="forest"] .theme-dot.active { border-color: #b39c4d; }

