:root { color-scheme: light; }
.theme-select {
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
    width: 36px;
    max-width: 36px;
    height: 36px;
    min-height: 36px;
    margin-left: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background-color: transparent;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23958aa9' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='3.5' width='15' height='10' rx='2'/%3E%3Cpath d='M7 17h6m-3-3.5V17'/%3E%3C/svg%3E");
    background-position: center;
    background-size: 18px 18px;
    background-repeat: no-repeat;
    color: var(--muted);
    font: inherit;
    font-size: 0;
    font-weight: 400;
    line-height: normal;
    cursor: pointer;
    transition: border-color .15s, background-color .15s, color .15s;
}
.theme-select:hover {
    border-color: var(--purple);
    background-color: var(--paper);
    color: var(--ink);
}
.theme-select:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }
.theme-select option { background: var(--paper); color: var(--ink); font-size: 13px; }
@media (forced-colors: active) {
    .theme-select { appearance: auto; background-image: none; padding: 0 8px; width: 132px; max-width: 132px; font-size: 12px; }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e4e2ed;
    --muted: #aaa6bc;
    --purple: #b59af7;
    --line: #393449;
    --paper: #181720;
    --green: #b9d99b;
    --surface: #23212e;
    --tint: #302a40;
}
[data-theme="dark"] body { background: var(--paper); color: var(--ink); }
[data-theme="dark"] .site-header { background: #1c1a25; border-color: var(--line); }
[data-theme="dark"] :is(.post-row, .side-section, .article, .standalone, .navigation-dropdown, .tool-card, .tool-workspace, .tools-search input, .tools-back, .tool-toolbar button, .tool-conversion select, .tool-conversion > button, .search, .pagination a, .category-pills a) {
    background-color: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}
[data-theme="dark"] :is(.about-card, .idea-card, .idea-detail) {
    --note-tint: #302a40;
    background: linear-gradient(125deg, var(--surface), var(--tint));
    border-color: var(--line);
}
[data-theme="dark"] :is(.about-card h3, .side-section h3, .page-heading h1, .article h1, .idea-card p, .idea-content, .idea-author strong, .section-heading h2, .navigation-dropdown a) { color: var(--ink); }
[data-theme="dark"] :is(.post-row p, .post-bottom, .post-type, .meta, .article-lead, .about-card p, .numbers small, .site-footer, .idea-card-header time, .idea-card-footer, .idea-detail-header, .idea-detail-footer, .breadcrumb, .brand small, .header-inner nav, .source-note, .idea-author time) { color: var(--muted); }
[data-theme="dark"] :is(.switch, .friend-links a, .post-bottom a span, .article-heading > .eyebrow, .prose blockquote, .prose :not(pre) > code, .source-note, .tool-conversion, .tool-card[aria-current="true"], .navigation-dropdown a:hover, .like-button, .idea-tag, .idea-views) {
    background: var(--tint);
    border-color: var(--line);
    color: var(--purple);
}
[data-theme="dark"] :is(.article-heading, .category-list a, .numbers, .idea-detail-header, .idea-detail-footer, .idea-card-footer, .site-footer, .navigation-children) { border-color: var(--line); }
[data-theme="dark"] :is(.search input, .tool-editor textarea) { color: var(--ink); background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .tool-editor textarea[readonly] { background: #1c1b26; }
[data-theme="dark"] :is(.tools-local, .tool-feedback) { color: #b9d99b; }
[data-theme="dark"] .tools-local { background: #293426; border-color: #46583d; }
[data-theme="dark"] :is(.tool-feedback.is-error, .like-feedback.error) { color: #f39ca4; }
[data-theme="dark"] :is(.tool-card-icon, .tool-card:nth-child(3n+2) .tool-card-icon, .tool-card:nth-child(3n) .tool-card-icon) { background: var(--tint); color: var(--purple); }
[data-theme="dark"] :is(.switch .active, .category-pills .active, .pagination .current, .tools-filters button[aria-pressed="true"], .tool-toolbar > div button:first-child, .like-button.liked) { background: #7050b8; color: #fff; border-color: #9470d5; }
[data-theme="dark"] ::selection { background: #584273; color: #fff; }
@media (min-width: 761px) {
    .header-inner { column-gap: 16px; }
    .header-inner nav { margin-left: clamp(8px, calc(4vw - 16px), 44px); }
}
@media (max-width: 760px) {
    .header-inner .search { grid-column: 1; min-width: 0; width: 100%; }
    .header-inner .theme-select { grid-column: 2; grid-row: 2; justify-self: end; margin-left: 0; width: 43px; max-width: 43px; height: 43px; }
}
