:root {
    --bg: #f4efe7;
    --bg-soft: rgba(255, 255, 255, 0.68);
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --ink: #18212b;
    --muted: #5b6776;
    --line: rgba(24, 33, 43, 0.08);
    --brand: #0f766e;
    --brand-strong: #115e59;
    --accent: #f97316;
    --danger: #dc2626;
    --shadow-lg: 0 24px 80px rgba(24, 33, 43, 0.12);
    --shadow-md: 0 14px 36px rgba(24, 33, 43, 0.08);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --header-height: 72px;
    --tab-height: 70px;
    --sticky-header-height: 72px;
    --sticky-tab-height: 70px;
    --shell-width: min(1680px, calc(100vw - 40px));
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--sticky-header-height) + var(--sticky-tab-height) + 16px);
}

body {
    margin: 0;
    font-family: "Outfit", "Noto Sans JP", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.18), transparent 26%),
        radial-gradient(circle at top right, rgba(249, 115, 22, 0.16), transparent 22%),
        linear-gradient(180deg, #f8f3eb 0%, #f5f1ea 34%, #eef3f3 100%);
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
    opacity: 0.45;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea {
    font: inherit;
}

.app-shell {
    position: relative;
}

.shell {
    width: var(--shell-width);
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(20px);
    background: rgba(244, 239, 231, 0.78);
    border-bottom: 1px solid rgba(24, 33, 43, 0.06);
}

.site-header-inner {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand) 0%, #14b8a6 60%, #fb923c 100%);
    color: #fff;
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    letter-spacing: 0.06em;
    box-shadow: 0 12px 32px rgba(15, 118, 110, 0.22);
}

.brand-copy {
    min-width: 0;
}

.brand-title {
    font-family: "Space Grotesk", sans-serif;
    font-size: 25px;
    line-height: 1;
    letter-spacing: -0.03em;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.action-link,
.action-icon,
.pill-button,
.primary-button,
.ghost-button {
    border: 0;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.action-link,
.pill-button,
.ghost-button {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
    color: var(--ink);
}

.action-link:hover,
.action-icon:hover,
.pill-button:hover,
.primary-button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

.action-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.72);
}

.primary-button {
    padding: 12px 18px;
    border-radius: 14px;
    background: var(--brand);
    color: #fff;
    box-shadow: 0 14px 30px rgba(15, 118, 110, 0.2);
}

.ghost-button {
    border: 1px solid rgba(24, 33, 43, 0.08);
}

.hero-panel,
.stats-panel,
.dashboard-panel,
.feed-panel,
.sidebar-card,
.modal-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(20px);
}

.quick-links,
.tab-track,
.source-chip-list,
.personal-category-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hero-tag,
.quick-link,
.tab,
.source-chip,
.personal-category {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(24, 33, 43, 0.08);
    font-size: 13px;
}

.tabs-container {
    position: sticky;
    top: var(--sticky-header-height);
    z-index: 30;
    padding: 12px 0 16px;
    background: linear-gradient(180deg, rgba(244, 239, 231, 0.92), rgba(244, 239, 231, 0.75), transparent);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(24, 33, 43, 0.04);
}

.tab-track {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
}

.tab-track::-webkit-scrollbar {
    display: none;
}

.tab {
    white-space: nowrap;
    cursor: pointer;
    scroll-snap-align: start;
}

.tab.active {
    background: linear-gradient(135deg, var(--brand), #14b8a6);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.24);
}

.content-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 22px;
    padding-bottom: 40px;
}

.dashboard-panel,
.feed-panel,
.sidebar-card {
    border-radius: 28px;
}

.dashboard-panel,
.feed-panel {
    padding: 22px;
}

.ad-panel {
    padding: 18px;
    margin-bottom: 20px;
}

.dashboard-panel {
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-eyebrow {
    color: var(--brand-strong);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.section-title {
    margin: 0;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.section-description {
    color: var(--muted);
    max-width: 56ch;
    font-size: 14px;
}

.lead-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 18px;
}

.lead-story,
.highlight-card,
.article-card,
.snapshot-card,
.buzz-card,
.history-card {
    border-radius: 22px;
    background: var(--surface-strong);
    overflow: hidden;
    border: 1px solid rgba(24, 33, 43, 0.06);
    box-shadow: 0 16px 40px rgba(24, 33, 43, 0.07);
}

.lead-story {
    min-height: 100%;
}

.lead-story-link,
.article-link,
.snapshot-link,
.buzz-link,
.history-link {
    display: block;
    height: 100%;
}

.lead-thumb {
    aspect-ratio: 16 / 9;
    background: #e7ecef center/cover no-repeat;
}

.lead-body,
.highlight-body,
.article-body,
.snapshot-body,
.buzz-body,
.history-body {
    padding: 18px;
}

.lead-headline,
.highlight-headline,
.article-title,
.snapshot-title,
.buzz-title,
.history-title {
    margin: 0 0 10px;
    font-size: 20px;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.article-title,
.snapshot-title,
.buzz-title,
.history-title {
    font-size: 16px;
}

.lead-summary,
.snapshot-summary,
.buzz-summary,
.history-summary {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.meta-row,
.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: 12px;
    color: var(--muted);
}

.meta-source {
    font-weight: 600;
    color: var(--ink);
}

.meta-score {
    color: var(--brand);
    font-weight: 700;
}

.highlight-list,
.snapshot-grid,
.buzz-grid,
.article-grid,
.history-grid {
    display: grid;
    gap: 16px;
}

.highlight-list,
.snapshot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.buzz-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 24px;
}

.article-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.article-card {
    height: 100%;
}

.article-link {
    display: flex;
    align-items: stretch;
    min-height: 100%;
}

.article-thumb,
.history-thumb {
    width: 152px;
    flex: 0 0 152px;
    min-height: 100%;
    background: #e9eff1 center/cover no-repeat;
}

.article-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.article-title,
.snapshot-summary {
    display: block;
}

.snapshot-summary {
    overflow: hidden;
}

.category-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    color: var(--brand-strong);
    background: rgba(15, 118, 110, 0.09);
}

.empty-state {
    padding: 48px 16px;
    text-align: center;
    color: var(--muted);
}

.loader {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 26px 0 8px;
    color: var(--muted);
}

.loader.visible {
    display: flex;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(15, 118, 110, 0.16);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

#scroll-sensor {
    height: 28px;
}

.sidebar {
    display: grid;
    gap: 18px;
    align-content: start;
}

.sidebar-card {
    padding: 18px;
}

.sidebar-title {
    margin: 0 0 14px;
    font-size: 18px;
}

.source-ranking {
    display: grid;
    gap: 10px;
}

.source-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(24, 33, 43, 0.06);
}

.source-rank {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(15, 118, 110, 0.08);
    color: var(--brand-strong);
    font-weight: 700;
}

.source-name {
    font-weight: 600;
}

.source-sub {
    color: var(--muted);
    font-size: 12px;
}

.sidebar-note {
    color: var(--muted);
    line-height: 1.7;
    font-size: 14px;
}

.ad-shell {
    min-height: 120px;
}

.detail-layout {
    align-items: start;
}

.article-detail {
    display: grid;
    gap: 22px;
}

.detail-header {
    margin-bottom: 0;
}

.detail-title {
    font-size: clamp(30px, 4vw, 46px);
}

.detail-summary {
    margin-top: 14px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
}

.detail-eyebrow-link {
    display: inline-block;
}

.detail-hero {
    border-radius: 24px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.8);
}

.detail-hero-media {
    aspect-ratio: 16 / 9;
    background: #e7ecef center/cover no-repeat;
}

.detail-copy {
    display: grid;
    gap: 20px;
    font-size: 15px;
    line-height: 1.9;
}

.detail-copy p {
    margin: 0;
}

.detail-panel,
.related-panel {
    padding: 22px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(24, 33, 43, 0.06);
}

.detail-panel-title {
    margin: 0 0 14px;
    font-size: 22px;
    letter-spacing: -0.03em;
}

.detail-point-list {
    margin: 0;
    padding-left: 20px;
    color: var(--ink);
}

.detail-point-list li {
    margin-bottom: 10px;
    line-height: 1.8;
}

.detail-share {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-source-note {
    margin-top: 14px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.8;
}

.related-details[open] .related-summary {
    margin-bottom: 18px;
}

.related-summary {
    list-style: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 18px;
}

.related-summary::-webkit-details-marker {
    display: none;
}

.related-content {
    display: grid;
    gap: 18px;
}

.detail-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.detail-ad {
    padding-top: 8px;
}

.footer {
    border-top: 1px solid rgba(24, 33, 43, 0.08);
    padding: 28px 0 42px;
    color: var(--muted);
}

.footer-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--ink);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(24, 33, 43, 0.45);
    padding: 26px;
    overflow-y: auto;
}

.modal.open {
    display: block;
}

.modal-card {
    width: min(840px, 100%);
    margin: 4vh auto;
    border-radius: 30px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 22px 24px;
    background: linear-gradient(135deg, var(--brand), #14b8a6);
    color: #fff;
}

.modal-title {
    margin: 0;
    font-size: 22px;
}

.modal-close {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 0;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
}

.auth-grid,
.settings-grid {
    display: grid;
    gap: 18px;
}

.settings-grid {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.settings-column {
    display: grid;
    gap: 16px;
}

.panel {
    padding: 18px;
    border-radius: 22px;
    background: rgba(250, 251, 252, 0.94);
    border: 1px solid rgba(24, 33, 43, 0.08);
}

.panel-title {
    margin: 0 0 8px;
    font-size: 18px;
}

.panel-description {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.form-group {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.form-label {
    font-size: 13px;
    color: var(--muted);
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(24, 33, 43, 0.1);
    background: #fff;
}

.help-text,
.error-message {
    font-size: 13px;
}

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

.error-message {
    color: var(--danger);
    margin-top: 10px;
}

.settings-item,
.source-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.settings-item {
    padding: 12px 14px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(24, 33, 43, 0.06);
    margin-bottom: 10px;
}

.toggle {
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: #dce4e6;
    position: relative;
    cursor: pointer;
    border: 0;
}

.toggle::after {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.2s ease;
    box-shadow: 0 8px 20px rgba(24, 33, 43, 0.14);
}

.toggle.active {
    background: rgba(15, 118, 110, 0.9);
}

.toggle.active::after {
    transform: translateX(20px);
}

.source-chip-list {
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.source-chip {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(24, 33, 43, 0.08);
    cursor: pointer;
}

.source-chip.active {
    border-color: rgba(15, 118, 110, 0.28);
    background: rgba(15, 118, 110, 0.08);
}

.source-chip small {
    color: var(--muted);
}

.history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.history-link {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
}

.muted {
    color: var(--muted);
}

.hidden {
    display: none !important;
}

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

@media (max-width: 1180px) {
    .content-layout,
    .lead-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .article-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    :root {
        --shell-width: min(100vw - 24px, 100%);
    }

    .site-header-inner {
        height: auto;
        padding: 16px 0;
        align-items: flex-start;
        flex-direction: column;
    }

    .brand {
        width: 100%;
    }

    .user-menu {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .user-menu::-webkit-scrollbar {
        display: none;
    }

    .action-link,
    .primary-button,
    .ghost-button {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .tabs-container {
        padding: 8px 0 12px;
    }

    .tab-track {
        gap: 8px;
        padding-bottom: 2px;
    }

    .article-grid,
    .highlight-list,
    .snapshot-grid,
    .buzz-grid,
    .history-grid,
    .sidebar {
        grid-template-columns: 1fr;
    }

    .article-link,
    .history-link {
        display: grid;
        grid-template-columns: 1fr;
    }

    .article-thumb,
    .history-thumb {
        width: 100%;
        flex-basis: auto;
        aspect-ratio: 16 / 9;
    }

    .article-body,
    .snapshot-body,
    .buzz-body,
    .lead-body {
        padding: 15px;
    }

    .article-title,
    .snapshot-title,
    .buzz-title,
    .history-title {
        font-size: 15px;
    }
}

@media (max-width: 560px) {
    .hero-panel,
    .stats-panel,
    .dashboard-panel,
    .feed-panel,
    .sidebar-card,
    .modal-body {
        padding: 18px;
    }

    .brand-mark {
        width: 48px;
        height: 48px;
    }

    .brand-title {
        font-size: 22px;
    }

    .section-title {
        font-size: 26px;
    }

    .detail-title {
        font-size: 28px;
    }

    .detail-panel,
    .related-panel {
        padding: 18px;
    }

    .detail-panel-title {
        font-size: 20px;
    }

    .detail-share {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .modal {
        padding: 10px;
    }

    .modal-card {
        border-radius: 22px;
    }
}
