:root {
    color-scheme: light;
    --background: #f7f9f8;
    --surface: #fff;
    --text: #23352d;
    --muted: #647068;
    --line: #e3e9e5;
    --green: #256449;
    --green-soft: #edf5ef;
    --on-accent: #fff;
    --tab-hover: #f8fbf9;
    --table-header: #f0f4f1;
    --icon-border: #dce9df;
    --meta-text: #536158;
    --button-border: #cddfd2;
    --empty-border: #d3ded6;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --background: #0a0e1a;
    --surface: #111827;
    --text: #e2eaf5;
    --muted: #99aabb;
    --line: #1e2d45;
    --green: #4da6ff;
    --green-soft: #10243d;
    --on-accent: #0a0e1a;
    --tab-hover: #1a2235;
    --table-header: #162033;
    --icon-border: #24486f;
    --meta-text: #99aabb;
    --button-border: #24486f;
    --empty-border: #1e2d45;
}

/* Follow the system even if JavaScript is unavailable. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        color-scheme: dark;
        --background: #0a0e1a;
        --surface: #111827;
        --text: #e2eaf5;
        --muted: #99aabb;
        --line: #1e2d45;
        --green: #4da6ff;
        --green-soft: #10243d;
        --on-accent: #0a0e1a;
        --tab-hover: #1a2235;
        --table-header: #162033;
        --icon-border: #24486f;
        --meta-text: #99aabb;
        --button-border: #24486f;
        --empty-border: #1e2d45;
    }
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
svg { display: block; width: 20px; height: 20px; flex-shrink: 0; }
:is(a, select):focus-visible { outline: 3px solid var(--green); outline-offset: 5px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner, .main-content, .site-footer { width: min(1080px, calc(100% - 64px)); margin-inline: auto; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 80px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 17px; font-weight: 700; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--green); color: var(--on-accent); }
.brand-mark svg { width: 23px; height: 23px; }
.platform-tabs { display: flex; align-self: stretch; gap: 12px; margin-left: auto; }
.platform-tab { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-width: 114px; min-height: 52px; padding: 0 16px; color: var(--muted); font-weight: 600; }
.platform-tab::after { position: absolute; right: 10px; bottom: -1px; left: 10px; height: 3px; border-radius: 3px 3px 0 0; background: transparent; content: ""; }
.platform-tab:hover { color: var(--green); background: var(--tab-hover); }
.platform-tab[aria-current="page"] { color: var(--green); }
.platform-tab[aria-current="page"]::after { background: var(--green); }
.theme-control { display: flex; align-items: center; flex-shrink: 0; }
.theme-control select { min-height: 40px; min-width: 106px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.theme-control select:hover { border-color: var(--green); }
.main-content { min-height: calc(100svh - 164px); padding-top: 54px; padding-bottom: 64px; }
.list-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 25px; }
.list-heading h1 { margin: 0; font-size: 25px; line-height: 1.5; font-weight: 700; letter-spacing: -.5px; }
.app-count { padding: 4px 10px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); background: var(--surface); font-size: 12px; white-space: nowrap; }
.app-list { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: var(--table-header); color: var(--muted); }
thead th { padding: 15px 16px; font-size: 11px; font-weight: 500; white-space: nowrap; }
thead th:first-child { padding-left: 24px; }
tbody th, tbody td { padding: 26px 16px; border-top: 1px solid var(--line); }
tbody th { padding-left: 24px; font-weight: 600; }
.app-name-cell { width: 27%; }
.app-summary-cell { width: 28%; color: var(--muted); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.app-identity { display: flex; align-items: center; gap: 15px; line-height: 1.6; }
.app-identity > span:last-child { overflow-wrap: anywhere; }
.app-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid var(--icon-border); border-radius: 12px; background: var(--green-soft); color: var(--green); }
.app-icon svg { width: 24px; height: 24px; }
.app-icon-image { overflow: hidden; border: 0; background: transparent; }
.app-icon img { display: block; width: 100%; height: 100%; object-fit: contain; }
.app-meta { color: var(--meta-text); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.download-cell { padding-right: 24px; text-align: right; }
.download-button { display: inline-flex; justify-content: center; align-items: center; width: 40px; height: 40px; border: 1px solid var(--button-border); border-radius: 7px; background: var(--green-soft); color: var(--green); }
.download-button svg { width: 20px; height: 20px; }
.download-button:hover { background: var(--green); border-color: var(--green); color: var(--on-accent); }
.download-unavailable { color: var(--muted); font-size: 12px; white-space: nowrap; }
.install-note { display: flex; align-items: flex-start; gap: 8px; margin: 18px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.install-note svg { width: 16px; height: 16px; margin-top: 2px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 276px; padding: 36px 20px; border: 1px dashed var(--empty-border); border-radius: 12px; background: var(--surface); text-align: center; }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--green-soft); color: var(--green); }
.empty-icon svg { width: 28px; height: 28px; }
.empty-state p { margin: 20px 0 7px; font-size: 15px; font-weight: 600; }
.empty-state > span:last-child { color: var(--muted); font-size: 12px; line-height: 1.8; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 84px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

@media (max-width: 900px) {
    .header-inner, .main-content, .site-footer { width: calc(100% - 40px); }
    .header-inner { flex-wrap: wrap; justify-content: flex-start; gap: 0; padding-top: 20px; }
    .brand { order: 1; font-size: 16px; }
    .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
    .platform-tabs { order: 3; width: 100%; gap: 8px; margin-top: 14px; margin-left: 0; }
    .theme-control { order: 2; margin-left: auto; }
    .platform-tab { min-width: 0; flex: 1; min-height: 52px; padding: 0 14px; }
    .platform-tab::after { right: 0; left: 0; }
    .main-content { min-height: calc(100svh - 211px); }
    .app-name-cell { width: auto; }
    thead th, tbody th, tbody td { padding-inline: 12px; }
    thead th:first-child, tbody th { padding-left: 18px; }
    .download-cell { padding-right: 18px; }
    .app-identity { gap: 10px; font-size: 13px; }
}

@media (max-width: 700px) {
    .platform-tabs { gap: 0; }
    .platform-tab { flex: 1 1 auto; gap: 6px; padding: 0 6px; font-size: 12px; white-space: nowrap; }
    .platform-tab svg { width: 16px; height: 16px; }
    .main-content { padding-top: 30px; padding-bottom: 40px; }
    .list-heading { margin-bottom: 20px; }
    .list-heading h1 { font-size: 22px; }
    .app-list { border: 0; border-radius: 0; background: transparent; overflow: visible; }
    table, tbody { display: block; }
    thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    tbody { display: grid; gap: 14px; }
    tbody tr { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 12px 8px; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
    tbody th, tbody td { padding: 0; border: 0; }
    .app-name-cell { grid-column: 1 / -1; grid-row: 1; padding-right: 52px; }
    .app-summary-cell { grid-column: 1 / -1; grid-row: 2; width: auto; font-size: 13px; }
    .app-identity { gap: 13px; font-size: 14px; }
    .app-meta { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
    .app-meta::before { content: attr(data-label); color: var(--muted); font-size: 10px; }
    .download-cell { grid-column: 3; grid-row: 1; align-self: center; }
    .download-button { width: 44px; height: 44px; }
    .download-unavailable { display: block; padding-block: 12px; font-size: 10px; text-align: right; }
    .install-note { margin-top: 16px; font-size: 10px; }
    .empty-state { min-height: 260px; }
    .site-footer { min-height: 84px; font-size: 10px; }
}
