:root {
    --mw-bg: #ffffff;
    --mw-bg-soft: #f6f7f9;
    --mw-bg-elevated: #ffffff;
    --mw-text: #1a1d22;
    --mw-text-soft: #5b6470;
    --mw-text-faint: #8a93a0;
    --mw-border: #e5e8ec;
    --mw-border-soft: #eef0f3;
    --mw-accent: #0a84ff;
    --mw-accent-soft: #e6f1ff;
    --mw-accent-strong: #0064d4;
    --mw-shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 4px 20px rgba(16, 24, 40, 0.04);
    --mw-shadow-strong: 0 8px 32px rgba(16, 24, 40, 0.12);
    --mw-radius: 14px;
    --mw-radius-sm: 8px;
    --mw-header-h: 56px;
    --mw-sidebar-w: 260px;
    --mw-toc-w: 200px;
    --mw-content-max: 760px;

    --mw-pill-green-bg: #e7f7ec;
    --mw-pill-green-fg: #1a7f37;
    --mw-pill-blue-bg: #e6f1ff;
    --mw-pill-blue-fg: #0a64c8;
    --mw-pill-yellow-bg: #fff5dc;
    --mw-pill-yellow-fg: #8a5a00;
    --mw-pill-red-bg: #fde7ea;
    --mw-pill-red-fg: #b3261e;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --mw-bg: #111316;
        --mw-bg-soft: #1a1d22;
        --mw-bg-elevated: #1c2026;
        --mw-text: #f1f3f5;
        --mw-text-soft: #a4acb8;
        --mw-text-faint: #6c7480;
        --mw-border: #2a2e35;
        --mw-border-soft: #23272d;
        --mw-accent: #2d9bff;
        --mw-accent-soft: #13294a;
        --mw-accent-strong: #5cb1ff;
        --mw-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 20px rgba(0, 0, 0, 0.3);
        --mw-shadow-strong: 0 12px 40px rgba(0, 0, 0, 0.55);

        --mw-pill-green-bg: #133b1f;
        --mw-pill-green-fg: #6fdb8c;
        --mw-pill-blue-bg: #102a4a;
        --mw-pill-blue-fg: #6ab6ff;
        --mw-pill-yellow-bg: #3b2d05;
        --mw-pill-yellow-fg: #f4c863;
        --mw-pill-red-bg: #3b1416;
        --mw-pill-red-fg: #ff8a8a;
    }
}

[data-theme="dark"] {
    --mw-bg: #111316;
    --mw-bg-soft: #1a1d22;
    --mw-bg-elevated: #1c2026;
    --mw-text: #f1f3f5;
    --mw-text-soft: #a4acb8;
    --mw-text-faint: #6c7480;
    --mw-border: #2a2e35;
    --mw-border-soft: #23272d;
    --mw-accent: #2d9bff;
    --mw-accent-soft: #13294a;
    --mw-accent-strong: #5cb1ff;
    --mw-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 20px rgba(0, 0, 0, 0.3);
    --mw-shadow-strong: 0 12px 40px rgba(0, 0, 0, 0.55);

    --mw-pill-green-bg: #133b1f;
    --mw-pill-green-fg: #6fdb8c;
    --mw-pill-blue-bg: #102a4a;
    --mw-pill-blue-fg: #6ab6ff;
    --mw-pill-yellow-bg: #3b2d05;
    --mw-pill-yellow-fg: #f4c863;
    --mw-pill-red-bg: #3b1416;
    --mw-pill-red-fg: #ff8a8a;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--mw-bg);
    color: var(--mw-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans", "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--mw-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
    font-family: inherit;
    cursor: pointer;
}

/* ---------- Header ---------- */
.help-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--mw-bg);
    border-bottom: 1px solid var(--mw-border);
    padding-top: env(safe-area-inset-top);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
}
.help-header__inner {
    max-width: 1280px;
    margin: 0 auto;
    height: var(--mw-header-h);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
}
.help-header__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--mw-text);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
    min-width: 0;
    white-space: nowrap; /* 窄屏下"Help Center""ヘルプセンター"不再折成两行 */
}
.help-header__brand span {
    overflow: hidden;
    text-overflow: ellipsis;
}
.help-header__brand img { flex-shrink: 0; }
.help-header__brand:hover { text-decoration: none; color: var(--mw-text); }
.help-header__brand img {
    width: 24px;
    height: 24px;
    border-radius: 6px;
}
.help-header__spacer { flex: 1; }

/* hamburger (mobile only) */
.help-sidebar-toggle {
    display: none;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--mw-border);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    color: var(--mw-text);
    padding: 0;
}
.help-sidebar-toggle svg { width: 18px; height: 18px; }

.help-theme-toggle {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    background: var(--mw-bg-soft);
    border: 1px solid var(--mw-border);
    color: var(--mw-text);
    width: 36px;
    height: 36px;
    border-radius: 999px;
    padding: 0;
}
.help-theme-toggle svg { width: 16px; height: 16px; }
.help-theme-toggle .icon-sun { display: none; }
.help-theme-toggle .icon-moon { display: inline; }
[data-theme="dark"] .help-theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .help-theme-toggle .icon-sun { display: inline; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .help-theme-toggle .icon-moon { display: none; }
    :root:not([data-theme="light"]) .help-theme-toggle .icon-sun { display: inline; }
}

.help-lang-wrap { position: relative; }
.help-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--mw-bg-soft);
    border: 1px solid var(--mw-border);
    color: var(--mw-text);
    font-size: 14px;
    font-weight: 500;
    border-radius: 999px;
    padding: 7px 14px;
    white-space: nowrap;
}
.help-lang-btn__icon { font-size: 14px; }
.help-lang-btn__caret { font-size: 10px; opacity: 0.6; }

.help-lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 160px;
    background: var(--mw-bg-elevated);
    border: 1px solid var(--mw-border);
    border-radius: 12px;
    box-shadow: var(--mw-shadow-strong);
    padding: 6px;
    display: none;
    flex-direction: column;
    z-index: 100;
}
.help-lang-menu.is-open { display: flex; }
.help-lang-menu__item {
    text-align: left;
    background: transparent;
    border: none;
    color: var(--mw-text);
    font-size: 14px;
    padding: 9px 12px;
    border-radius: 8px;
}
.help-lang-menu__item:hover { background: var(--mw-bg-soft); }
.help-lang-menu__item.is-active { color: var(--mw-accent); background: var(--mw-accent-soft); }

/* ---------- Layout shell ---------- */
.help-shell {
    max-width: 1280px;
    margin: 0 auto;
    display: block;
    padding: 0 16px;
}

/* ---------- Sidebar ---------- */
.help-sidebar {
    background: var(--mw-bg);
    border-right: 1px solid var(--mw-border);
    padding: 24px 16px 80px;
    display: none;
}
.help-sidebar__group { margin-bottom: 20px; }
.help-sidebar__group-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mw-text-faint);
    font-weight: 600;
    margin: 0 8px 8px;
}
.help-sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.help-sidebar__link {
    display: block;
    padding: 8px 12px;
    color: var(--mw-text-soft);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
    border-left: 2px solid transparent;
    margin-bottom: 2px;
}
.help-sidebar__link:hover {
    color: var(--mw-text);
    background: var(--mw-bg-soft);
    text-decoration: none;
}
.help-sidebar__link.is-active {
    color: var(--mw-accent);
    background: var(--mw-accent-soft);
    font-weight: 600;
}

/* mobile drawer */
.help-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 60;
    display: none;
}
.help-sidebar-backdrop.is-open { display: block; }

/* ---------- Main ---------- */
.help-main {
    min-width: 0;
    padding: 24px 4px 80px;
}

/* home */
.help-home__hero {
    background: linear-gradient(135deg, var(--mw-accent-soft), var(--mw-bg-soft));
    border: 1px solid var(--mw-border);
    border-radius: var(--mw-radius);
    padding: 28px 24px;
    margin-bottom: 28px;
}
.help-home__title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
    color: var(--mw-text);
}
.help-home__subtitle {
    color: var(--mw-text-soft);
    font-size: 15px;
    margin: 0;
}

.help-group { margin-bottom: 28px; }
.help-group__title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mw-text-soft);
    font-weight: 600;
    margin: 0 4px 10px;
}
.help-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--mw-bg-elevated);
    border: 1px solid var(--mw-border);
    border-radius: var(--mw-radius);
    overflow: hidden;
    box-shadow: var(--mw-shadow);
}
.help-list__item + .help-list__item {
    border-top: 1px solid var(--mw-border-soft);
}
.help-list__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    color: var(--mw-text);
    font-size: 16px;
    font-weight: 500;
}
.help-list__link:hover { background: var(--mw-bg-soft); text-decoration: none; }
.help-list__chevron { color: var(--mw-text-faint); font-size: 18px; }

/* ---------- Article ---------- */
.help-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--mw-text-soft);
    margin-bottom: 18px;
}
.help-breadcrumb a {
    color: var(--mw-text-soft);
}
.help-breadcrumb a:hover { color: var(--mw-accent); text-decoration: none; }
.help-breadcrumb__sep { color: var(--mw-text-faint); }
.help-breadcrumb__current {
    color: var(--mw-text);
    font-weight: 500;
}

.help-article__title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: var(--mw-text);
}
.help-article__updated {
    color: var(--mw-text-faint);
    font-size: 13px;
    margin: 0 0 28px;
}
.help-article__body { font-size: 16px; color: var(--mw-text); }
.help-article__body h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 36px 0 12px;
    line-height: 1.35;
    color: var(--mw-text);
    scroll-margin-top: calc(var(--mw-header-h) + 16px);
}
.help-article__body h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 24px 0 8px;
    color: var(--mw-text);
    scroll-margin-top: calc(var(--mw-header-h) + 16px);
}
.help-article__body p { margin: 0 0 14px; }
.help-article__body strong { color: var(--mw-text); font-weight: 600; }
.help-article__body ul,
.help-article__body ol { padding-left: 22px; margin: 0 0 16px; }
.help-article__body li { margin-bottom: 8px; }
.help-article__body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0 20px;
    font-size: 15px;
    border: 1px solid var(--mw-border);
    border-radius: var(--mw-radius-sm);
    overflow: hidden;
}
.help-article__body th,
.help-article__body td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--mw-border-soft);
    vertical-align: top;
}
.help-article__body th {
    background: var(--mw-bg-soft);
    font-weight: 600;
    font-size: 14px;
    color: var(--mw-text-soft);
}
.help-article__body tr:last-child td { border-bottom: 0; }
.help-article__body blockquote,
.help-article__body .callout {
    margin: 18px 0;
    padding: 14px 16px;
    background: var(--mw-bg-soft);
    border-left: 3px solid var(--mw-accent);
    border-radius: var(--mw-radius-sm);
    color: var(--mw-text-soft);
    font-size: 15px;
}
.help-article__body .callout strong { color: var(--mw-text); }

/* stress level pill */
.help-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    margin-right: 6px;
    line-height: 1.5;
}
.help-pill::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}
.help-pill--green { background: var(--mw-pill-green-bg); color: var(--mw-pill-green-fg); }
.help-pill--blue  { background: var(--mw-pill-blue-bg);  color: var(--mw-pill-blue-fg); }
.help-pill--yellow{ background: var(--mw-pill-yellow-bg);color: var(--mw-pill-yellow-fg); }
.help-pill--red   { background: var(--mw-pill-red-bg);   color: var(--mw-pill-red-fg); }

/* pager */
.help-pager {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--mw-border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.help-pager__link {
    display: block;
    padding: 14px 16px;
    background: var(--mw-bg-soft);
    border: 1px solid var(--mw-border);
    border-radius: var(--mw-radius-sm);
    color: var(--mw-text);
    font-size: 15px;
    transition: border-color 0.15s, background 0.15s;
}
.help-pager__link:hover {
    border-color: var(--mw-accent);
    text-decoration: none;
    background: var(--mw-bg-elevated);
}
.help-pager__link--prev { text-align: left; }
.help-pager__link--next { text-align: right; grid-column: 2; }
.help-pager__label {
    display: block;
    color: var(--mw-text-faint);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}
.help-pager__title {
    color: var(--mw-text);
    font-weight: 600;
}

.help-article__footer {
    margin-top: 28px;
    text-align: center;
}
.help-article__footer a {
    font-size: 14px;
    font-weight: 500;
    color: var(--mw-text-soft);
}
.help-article__footer a:hover { color: var(--mw-accent); }

/* ---------- TOC ---------- */
.help-toc {
    display: none;
    padding: 24px 16px;
    font-size: 13px;
}
.help-toc__title {
    color: var(--mw-text-faint);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin: 0 0 10px;
}
.help-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.help-toc__item {
    margin: 0;
}
.help-toc__link {
    display: block;
    padding: 4px 10px;
    color: var(--mw-text-soft);
    border-left: 2px solid transparent;
    line-height: 1.5;
    font-size: 13px;
}
.help-toc__link--h3 {
    padding-left: 22px;
    font-size: 12.5px;
}
.help-toc__link:hover {
    color: var(--mw-text);
    text-decoration: none;
}
.help-toc__link.is-active {
    color: var(--mw-accent);
    border-left-color: var(--mw-accent);
    font-weight: 600;
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
    .help-sidebar-toggle {
        display: inline-flex;
    }
    .help-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 280px;
        max-width: 86vw;
        z-index: 70;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        overflow-y: auto;
        padding-top: calc(var(--mw-header-h) + 16px + env(safe-area-inset-top));
        background: var(--mw-bg-elevated);
        border-right: 1px solid var(--mw-border);
        box-shadow: var(--mw-shadow-strong);
        display: block;
    }
    .help-sidebar.is-open {
        transform: translateX(0);
    }
    .help-shell {
        padding: 0 16px;
    }
    .help-main {
        padding: 20px 0 80px;
    }
    .help-pager {
        grid-template-columns: 1fr;
    }
    .help-pager__link--next { grid-column: 1; }
    .help-home__title, .help-article__title { font-size: 24px; }
}

/* ---------- Small phones: keep the header on one line ---------- */
@media (max-width: 400px) {
    .help-header__inner { gap: 6px; padding: 0 12px; }
    .help-header__brand { gap: 8px; }
    .help-lang-btn { padding: 7px 10px; gap: 4px; }
    .help-lang-btn__icon { display: none; }
}

/* ---------- Tablet (>=768) ---------- */
@media (min-width: 768px) {
    html, body { font-size: 17px; }
    :root { --mw-header-h: 60px; }
    .help-shell {
        display: grid;
        grid-template-columns: var(--mw-sidebar-w) minmax(0, 1fr);
        gap: 0;
        padding: 0 24px;
    }
    .help-sidebar {
        display: block;
        position: sticky;
        top: var(--mw-header-h);
        align-self: start;
        max-height: calc(100vh - var(--mw-header-h));
        overflow-y: auto;
    }
    .help-main {
        padding: 36px 32px 120px;
        max-width: var(--mw-content-max);
        margin: 0 auto;
    }
    .help-header__inner { padding: 0 24px; }
    .help-home__title, .help-article__title { font-size: 32px; }
    .help-article__body h2 { font-size: 22px; }
    .help-list__link { padding: 18px 22px; font-size: 17px; }
}

/* ---------- Desktop (>=1024) ---------- */
@media (min-width: 1024px) {
    .help-shell {
        grid-template-columns: var(--mw-sidebar-w) minmax(0, 1fr) var(--mw-toc-w);
        gap: 0;
    }
    .help-toc {
        display: block;
        position: sticky;
        top: var(--mw-header-h);
        align-self: start;
        max-height: calc(100vh - var(--mw-header-h));
        overflow-y: auto;
    }
}

/* ---------- Article figures ---------- */
.help-screens {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 20px 0 24px;
    justify-content: flex-start;
}
.help-screens figure {
    margin: 0;
    flex: 1 1 200px;
    max-width: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.help-screens img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 14px;
    border: 1px solid var(--mw-border);
    background: var(--mw-bg-soft);
    box-shadow: var(--mw-shadow);
}
.help-screens figcaption {
    font-size: 13px;
    color: var(--mw-text-soft);
    text-align: center;
    line-height: 1.5;
}
@media (max-width: 720px) {
    .help-screens figure { max-width: 100%; }
}

/* ---------- iOS-style page loader ---------- */
.help-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--mw-bg) 72%, transparent);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms ease, visibility 180ms ease;
    pointer-events: none;
}
.help-loader.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.help-loader__spinner {
    position: relative;
    width: 28px;
    height: 28px;
    animation: help-loader-spin 1s steps(12, end) infinite;
}
.help-loader__spinner span {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2.5px;
    height: 8px;
    margin-left: -1.25px;
    border-radius: 2px;
    background: var(--mw-text);
    transform-origin: 1.25px 14px;
    opacity: 0.15;
}
.help-loader__spinner span:nth-child(1)  { transform: rotate(0deg);   opacity: 1.00; }
.help-loader__spinner span:nth-child(2)  { transform: rotate(30deg);  opacity: 0.92; }
.help-loader__spinner span:nth-child(3)  { transform: rotate(60deg);  opacity: 0.83; }
.help-loader__spinner span:nth-child(4)  { transform: rotate(90deg);  opacity: 0.75; }
.help-loader__spinner span:nth-child(5)  { transform: rotate(120deg); opacity: 0.67; }
.help-loader__spinner span:nth-child(6)  { transform: rotate(150deg); opacity: 0.58; }
.help-loader__spinner span:nth-child(7)  { transform: rotate(180deg); opacity: 0.50; }
.help-loader__spinner span:nth-child(8)  { transform: rotate(210deg); opacity: 0.42; }
.help-loader__spinner span:nth-child(9)  { transform: rotate(240deg); opacity: 0.33; }
.help-loader__spinner span:nth-child(10) { transform: rotate(270deg); opacity: 0.25; }
.help-loader__spinner span:nth-child(11) { transform: rotate(300deg); opacity: 0.17; }
.help-loader__spinner span:nth-child(12) { transform: rotate(330deg); opacity: 0.12; }
@keyframes help-loader-spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .help-loader__spinner { animation-duration: 1.6s; }
}

/* ---------- Large desktop (>=1280) ---------- */
@media (min-width: 1280px) {
    :root {
        --mw-sidebar-w: 280px;
        --mw-toc-w: 220px;
    }
    .help-main { padding: 48px 48px 140px; }
}
