@font-face {
    font-family: 'jf open-huninn';
    src: url('/web-assets/fonts/jfopen-huninn-tc-2.1.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

@font-face {
    font-family: 'M PLUS Rounded 1c';
    src: url('/web-assets/fonts/MPLUSRounded1c-jp.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

@font-face {
    font-family: 'Resource Han Rounded';
    src: url('/web-assets/fonts/ResourceHanRounded-sc.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

:root {
    --font-family-base: 'jf open-huninn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --bg-color: #ffffff;
    --text-color: #111111;
    --text-muted: #333333;
    --border-color: #e5e5e5;
    --link-color: #000000;
    --header-bg: #ffffff;
    --card-bg: #ffffff;
    --radius: 6px;
    --spacing: 1.5rem;
    --nav-bg: rgba(255, 255, 255);
    --footer-ui-height: 73px;
}

html[data-theme="dark"] {
    --bg-color: #000000;
    --text-color: #f1f1f1;
    --text-muted: #aaaaaa;
    --border-color: #333333;
    --link-color: #ffffff;
    --header-bg: #000000;
    --card-bg: #111111;
    --nav-bg: rgba(0, 0, 0);
}

html:lang(ja) {
    --font-family-base: 'M PLUS Rounded 1c', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html:lang(zh-CN) {
    --font-family-base: 'Resource Han Rounded', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    font-family: var(--font-family-base);
    scroll-behavior: smooth;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

.icon-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
    border: none;
    border-radius: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.top {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topLeft {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo-link {
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
}

.name {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.topRight {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 語言切換 */
.langToggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.langMenu {
    display: none;
    position: fixed;
    background-color: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
    min-width: 160px;
    flex-direction: column;
    overflow: hidden;
    z-index: 200;
}

.langMenu.open {
    display: flex;
}

.langMenuItem {
    padding: 0.75rem 1rem 0.75rem 1.25rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.langMenuItem:hover {
    background-color: var(--border-color);
}

/* Main */
.middle {
    flex: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: calc(4.5rem + 41px) 2rem calc(2.5rem + var(--footer-ui-height) + env(safe-area-inset-bottom, 0px));
    background-color: transparent;
}

article {
    display: flex;
    flex-direction: column;
    gap: 1.10rem;
}

section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
    position: relative;
    padding-bottom: 0.75rem;
    margin-top: 1.5rem;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--text-color);
    border-radius: 9999px;
}

article h2:first-of-type {
    margin-top: 0;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1rem;
}

p {
    color: var(--text-muted);
}

a {
    color: var(--link-color);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    padding: 0.1rem 0.3rem;
    margin: -0.1rem -0.3rem;
    border-radius: 4px;
}

.copyable {
    font-weight: 500;
}

.copy-trigger {
    margin-left: 0.25rem;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    padding: 2px 4px;
    margin: -2px 0;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    transform: translateY(-1.5px);
}

.copy-icon {
    width: 1.25rem;
    height: 1.25rem;
    object-fit: contain;
    border: none;
    border-radius: 0;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

/* Footer */
.bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    min-height: var(--footer-ui-height);
    border-top: 1px solid var(--border-color);
    padding: 1rem 2rem calc(1rem + env(safe-area-inset-bottom, 0px));
    color: var(--text-muted);
    font-size: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--nav-bg);
}

.themeToggle {
    background: transparent;
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.themeToggleIcon {
    width: 20px;
    height: 20px;
    border: none;
}

@media (max-width: 768px) {
    .top {
        padding: 1rem 1.5rem;
    }

    .bottom {
        padding: 1rem 1.5rem;
    }

    .middle {
        padding: calc(4.5rem + 41px) 1.5rem calc(2.5rem + var(--footer-ui-height) + env(safe-area-inset-bottom, 0px));
    }

    h2 {
        font-size: 1.5rem;
    }
}