/* ===== Reset ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    /* 375 宽 = 16px（与现有 rem 字号基准一致）；更窄按视口缩小，桌面封顶 16px */
    font-size: clamp(13px, calc(100vw * 16 / 375), 16px);
}

html,
body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

/* ===== Focus =====
   Suppress the UA focus ring on buttons: after clicking a button, resizing
   the window (e.g. opening/closing DevTools) makes browsers briefly paint a
   black outline around the still-focused button. Keyboard navigation keeps
   a visible brand-colored ring via the .using-keyboard flag. */
button:focus {
    outline: none;
}

body.using-keyboard button:focus-visible {
    outline: 0.125rem solid var(--color-primary);
    outline-offset: 0.125rem;
}

/* ===== H5: allow page scrolling, keep width under control ===== */
@media (max-width: 768px) {
    html,
    body {
        height: auto;
        min-height: 100dvh;
        /* overflow-x: clip keeps sticky positioning working (unlike hidden) */
        overflow: visible;
        overflow-x: clip;
    }

    body {
        display: block;
    }
}
