:root {
    --bg: #f7f5ef;
    --text: #121212;
    --muted: #555;
    --rule: #1f1f1f;
    --link: #111;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #151617;
    --text: #ececec;
    --muted: #bababa;
    --rule: #8f8f8f;
    --link: #f5f5f5;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Georgia", "Times New Roman", serif;
    line-height: 1.7;
}

html {
    scroll-behavior: smooth;
}

.container {
    width: min(860px, 100% - 2rem);
    margin: 0 auto;
    padding: 1.25rem 0 3rem;
}

.site-header {
    position: relative;
    border-top: 3px double var(--rule);
    border-bottom: 3px double var(--rule);
    margin-bottom: 1.6rem;
    padding: 0.85rem 0 0.7rem;
    text-align: center;
}

.lang-switch {
    display: flex;
    width: 100%;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.6rem;
    padding-right: 0.1rem;
}

.lang-pill {
    width: 2.05rem;
    height: 2.05rem;
    border: 1px solid #111;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: #fff;
}

.lang-pill.active {
    background: #111;
    color: #fff;
}

.theme-toggle {
    width: 2.85rem;
    height: 1.7rem;
    border: 1px solid #111;
    border-radius: 999px;
    background: #f1f1f1;
    padding: 0.14rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle-thumb {
    width: 1.28rem;
    height: 1.28rem;
    border-radius: 50%;
    background: #111;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.theme-toggle[aria-pressed="true"] {
    background: #111;
}

.theme-toggle[aria-pressed="true"] .theme-toggle-thumb {
    background: #fff;
    transform: translateX(1.1rem);
}

.music-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    padding-left: 0.15rem;
}

.music-toggle {
    width: 1.95rem;
    height: 1.95rem;
    border: 1px solid #111;
    border-radius: 50%;
    background: #fff;
    color: #111;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.music-toggle-icon {
    position: relative;
    display: block;
    width: 0.74rem;
    height: 0.74rem;
    line-height: 1;
}

.music-toggle[aria-pressed="false"] .music-toggle-icon::before {
    content: "";
    position: absolute;
    top: 0.08rem;
    left: 0.17rem;
    width: 0;
    height: 0;
    border-top: 0.29rem solid transparent;
    border-bottom: 0.29rem solid transparent;
    border-left: 0.46rem solid currentColor;
}

.music-toggle[aria-pressed="true"] .music-toggle-icon::before,
.music-toggle[aria-pressed="true"] .music-toggle-icon::after {
    content: "";
    position: absolute;
    top: 0.08rem;
    width: 0.16rem;
    height: 0.58rem;
    border-radius: 1px;
    background: currentColor;
}

.music-toggle[aria-pressed="true"] .music-toggle-icon::before {
    left: 0.14rem;
}

.music-toggle[aria-pressed="true"] .music-toggle-icon::after {
    right: 0.14rem;
}

.music-volume {
    -webkit-appearance: none;
    appearance: none;
    width: 4.9rem;
    height: 1.1rem;
    background: transparent;
}

.music-volume:focus {
    outline: none;
}

.music-volume::-webkit-slider-runnable-track {
    height: 2px;
    background: #858585;
    border-radius: 999px;
}

.music-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #111;
    margin-top: -4px;
}

.music-volume::-moz-range-track {
    height: 2px;
    background: #858585;
    border-radius: 999px;
}

.music-volume::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border: 0;
    border-radius: 50%;
    background: #111;
}

#bgm-player {
    width: 0;
    height: 0;
    overflow: hidden;
}

.site-title {
    margin: 0 0 0.25rem;
    line-height: 1;
}

.site-title-logo {
    display: block;
    width: min(100%, 638px);
    height: auto;
    margin: 0 auto;
}

.logo-dark {
    display: none;
}

.masthead-row {
    display: grid;
    grid-template-columns: 20fr 60fr 20fr;
    align-items: center;
    gap: 1rem;
    margin-top: 0.7rem;
}

.masthead-box {
    border: 1px solid #111;
    background: #f8f8f8;
    padding: 1rem 0.8rem;
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.masthead-box p {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
    font-style: italic;
}

.masthead-main {
    padding: 0 0.2rem;
}

.today-box {
    text-align: left;
    padding: 0.55rem 0.65rem;
    border: 1px solid #111;
    background: #f8f8f8;
    min-height: 96px;
}

.today-box h2 {
    margin: 0;
    font-size: 1.65rem;
    line-height: 1;
    font-weight: 800;
}

.today-box p {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.35;
}

.masthead-meta {
    margin-top: 0.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    column-gap: 1rem;
}

.masthead-meta-left {
    text-align: left;
}

.masthead-single-rule {
    margin-top: 0.7rem;
    border-top: 1px solid var(--rule);
}

.top-links {
    margin: 0.2rem 0 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    text-align: left;
}

.edition-line {
    margin: 0;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
}

.market-ticker {
    border: 1px solid #111;
    border-radius: 0;
    margin: 0 0 1.1rem;
    padding: 0.55rem 0.6rem 0.65rem;
    background: #fff;
}

.container-strip {
    display: flex;
    align-items: stretch;
    margin: -0.55rem -0.6rem 0.6rem;
}

.container-strip-label {
    display: inline-flex;
    align-items: center;
    background: #111;
    color: #fff;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    padding: 0.26rem 0.55rem;
}

.container-strip-spacer {
    flex: 1;
    background: #d9d9d9;
    border-left: 1px solid #bdbdbd;
}

.container-strip-toggle {
    width: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-left: 1px solid #bdbdbd;
    background: #d9d9d9;
    color: #111;
    cursor: pointer;
    padding: 0;
}

.container-strip-toggle:hover,
.container-strip-toggle:focus-visible {
    background: #cfcfcf;
}

.container-strip-icon {
    font-size: 0.92rem;
    line-height: 1;
}

.market-ticker-summary {
    border: 1px solid #d5d0c5;
    padding: 0.45rem 0.5rem;
    background: #fcfbf8;
}

.market-ticker-loading {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.market-ticker-details {
    margin-top: 0.5rem;
    border: 1px solid #d5d0c5;
    background: #fcfbf8;
    padding: 0.5rem;
}

.ticker-track {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.05rem;
    align-items: center;
    justify-content: flex-start;
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.ticker-item strong {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
}

.ticker-value {
    font-variant-numeric: tabular-nums;
}

.ticker-arrow {
    font-weight: 700;
}

.ticker-item.is-up .ticker-arrow {
    color: #0f6a0f;
}

.ticker-item.is-down .ticker-arrow {
    color: #8f1616;
}

.ticker-item.is-flat .ticker-arrow {
    color: #555;
}

.market-ticker-updated {
    margin: 0 0 0.38rem;
    font-size: 0.82rem;
    color: #4a4a4a;
}

.market-ticker-table-wrap {
    overflow-x: auto;
}

.market-ticker-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    background: #fff;
}

.market-ticker-table th,
.market-ticker-table td {
    border: 1px solid #d4cec2;
    padding: 0.34rem 0.4rem;
    text-align: left;
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}

.market-ticker-table th {
    background: #f2efe8;
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.market-ticker-note {
    margin: 0.42rem 0 0;
    font-size: 0.82rem;
    color: #4f4f4f;
    font-style: italic;
}

.video-of-day-summary {
    border: 1px solid #d5d0c5;
    padding: 0.45rem 0.5rem;
    background: #fcfbf8;
}

.video-of-day-title {
    margin: 0;
    font-size: 0.96rem;
    line-height: 1.35;
    font-weight: 600;
}

.video-of-day-details {
    margin-top: 0.5rem;
    border: 1px solid #d5d0c5;
    background: #fcfbf8;
    padding: 0.5rem;
}

.video-of-day-frame {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #0f0f0f;
}

.video-of-day-frame iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-of-day-meta {
    margin: 0.45rem 0 0;
    font-size: 0.84rem;
    color: #4f4f4f;
}

.video-of-day-link {
    margin: 0.34rem 0 0;
    font-size: 0.84rem;
}

.category-block {
    margin: 1.5rem 0;
}

.category-filter {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
    justify-self: end;
}

.category-filter label {
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.category-filter select {
    min-width: 14rem;
    border: 1px solid #111;
    border-radius: 0;
    background: #fff;
    color: var(--text);
    font: inherit;
    padding: 0.42rem 0.5rem;
}

.category-block h2 {
    margin-bottom: 0.45rem;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 0.3rem;
    font-size: clamp(1.2rem, 3vw, 1.45rem);
}

.article-card {
    position: relative;
    border: 1px solid #111;
    border-radius: 0;
    padding: 0.95rem 1rem 0.85rem;
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.article-card .container-strip {
    margin: -0.95rem -1rem 0.7rem;
}

.category-chip {
    position: absolute;
    top: -1px;
    left: -1px;
    display: inline-block;
    background: #111;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
}

.position {
    margin: 0;
    font-weight: 700;
}

.article-card h3 {
    margin: 0.3rem 0;
    font-size: clamp(1.1rem, 3.2vw, 1.35rem);
    line-height: 1.4;
}

.meta,
.muted {
    color: var(--muted);
    margin: 0.3rem 0;
}

.article-meta-row {
    display: block;
    margin: 0.25rem 0 0.2rem;
}

.article-meta-row .meta {
    margin: 0;
    min-width: 0;
}

.article-content {
    margin-top: 0.2rem;
    white-space: normal;
}

.article-details {
    margin-top: 0.25rem;
}

.article-card.is-collapsed .article-details {
    display: none;
}

.article-footer {
    border-top: 1px solid #111;
    margin: 1rem 0 0;
    padding-top: 0.55rem;
    text-align: right;
    font-size: 0.95rem;
}

a {
    color: var(--link);
    text-underline-offset: 2px;
}

.archive-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.archive-list li {
    border-top: 1px solid #2a2a2a;
    padding: 0.55rem 0;
}

.full-article-text p {
    margin: 0 0 1rem;
}

.back-to-top {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 50;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: 1px solid #111;
    border-radius: 999px;
    background: #111;
    color: #fff;
    text-decoration: none;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
}

.back-to-top:hover,
.back-to-top:focus-visible {
    background: #fff;
    color: #111;
}

:root[data-theme="dark"] .logo-light {
    display: none;
}

:root[data-theme="dark"] .logo-dark {
    display: block;
}

:root[data-theme="dark"] .lang-pill {
    border-color: #666;
    background: #252627;
    color: #ececec;
}

:root[data-theme="dark"] .lang-pill.active {
    background: #ececec;
    color: #111;
}

:root[data-theme="dark"] .theme-toggle {
    border-color: #848484;
    background: #26282a;
}

:root[data-theme="dark"] .theme-toggle-thumb {
    background: #dcdcdc;
}

:root[data-theme="dark"] .music-toggle {
    border-color: #666;
    background: #252627;
    color: #ececec;
}

:root[data-theme="dark"] .theme-toggle:hover,
:root[data-theme="dark"] .theme-toggle:focus-visible {
    background: #323437;
}

:root[data-theme="dark"] .theme-toggle[aria-pressed="true"] {
    background: #ececec;
    border-color: #ececec;
}

:root[data-theme="dark"] .theme-toggle[aria-pressed="true"] .theme-toggle-thumb {
    background: #111;
}

:root[data-theme="dark"] .music-toggle:hover,
:root[data-theme="dark"] .music-toggle:focus-visible {
    background: #343638;
}

:root[data-theme="dark"] .music-volume::-webkit-slider-runnable-track {
    background: #6f7377;
}

:root[data-theme="dark"] .music-volume::-webkit-slider-thumb {
    background: #ececec;
}

:root[data-theme="dark"] .music-volume::-moz-range-track {
    background: #6f7377;
}

:root[data-theme="dark"] .music-volume::-moz-range-thumb {
    background: #ececec;
}

:root[data-theme="dark"] .masthead-box,
:root[data-theme="dark"] .today-box,
:root[data-theme="dark"] .article-card,
:root[data-theme="dark"] .market-ticker,
:root[data-theme="dark"] .market-ticker-summary,
:root[data-theme="dark"] .market-ticker-details,
:root[data-theme="dark"] .video-of-day-summary,
:root[data-theme="dark"] .video-of-day-details,
:root[data-theme="dark"] .category-filter select,
:root[data-theme="dark"] .container-strip-toggle,
:root[data-theme="dark"] .container-strip-spacer {
    background: #202224;
    border-color: #555;
    color: #ececec;
}

:root[data-theme="dark"] .container-strip-label {
    background: #ececec;
    color: #111;
}

:root[data-theme="dark"] .container-strip-toggle:hover,
:root[data-theme="dark"] .container-strip-toggle:focus-visible {
    background: #2a2d30;
}

:root[data-theme="dark"] .category-chip {
    background: #ececec;
    color: #111;
}

:root[data-theme="dark"] .market-ticker-table {
    background: #1c1e20;
}

:root[data-theme="dark"] .market-ticker-table th,
:root[data-theme="dark"] .market-ticker-table td {
    border-color: #4a4d50;
}

:root[data-theme="dark"] .market-ticker-table th {
    background: #2a2d30;
}

:root[data-theme="dark"] .video-of-day-frame {
    background: #0a0a0a;
}

:root[data-theme="dark"] .back-to-top {
    border-color: #777;
    background: #ececec;
    color: #111;
}

:root[data-theme="dark"] .back-to-top:hover,
:root[data-theme="dark"] .back-to-top:focus-visible {
    background: #2a2d30;
    color: #ececec;
}

@media (max-width: 700px) {
    .container {
        width: calc(100% - 1.25rem);
    }

    .site-header {
        text-align: center;
    }

    .lang-switch {
        position: static;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        margin: 0 auto 0.7rem;
        width: 100%;
        gap: 0.45rem;
    }

    .masthead-row {
        grid-template-columns: 1fr;
        gap: 0.7rem;
        margin-top: 0;
    }

    .masthead-box {
        min-height: auto;
        padding: 0.75rem;
    }

    .today-box {
        text-align: center;
        padding: 0.55rem 0.6rem;
        min-height: auto;
    }

    .masthead-meta {
        margin-top: 0.45rem;
        grid-template-columns: 1fr;
        row-gap: 0.55rem;
        justify-items: center;
    }

    .category-filter {
        justify-self: center;
        flex-direction: column;
        align-items: center;
        gap: 0.4rem;
    }

    .category-filter select {
        min-width: 0;
        width: min(100%, 20rem);
    }

    .market-ticker {
        padding: 0.5rem 0.45rem;
    }

    .music-controls {
        width: 100%;
        justify-content: center;
        padding-left: 0;
    }

    .container-strip {
        margin: -0.5rem -0.45rem 0.5rem;
    }

    .market-ticker-summary,
    .market-ticker-details,
    .video-of-day-summary,
    .video-of-day-details {
        padding: 0.42rem;
    }

    .ticker-track {
        gap: 0.45rem 0.7rem;
        justify-content: center;
    }

    .ticker-item {
        font-size: 0.84rem;
    }

    .article-card .container-strip {
        margin: -0.95rem -1rem 0.65rem;
    }

    .market-ticker-table {
        font-size: 0.8rem;
    }

    .market-ticker-table th,
    .market-ticker-table td {
        padding: 0.3rem 0.32rem;
    }

    .masthead-meta-left,
    .edition-line,
    .top-links {
        text-align: center;
    }

    .back-to-top {
        right: 0.6rem;
        bottom: 0.6rem;
        width: 2.7rem;
        height: 2.7rem;
        font-size: 1.2rem;
    }
}
