*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #0f52ba;
    --primary-dark: #0c459c;
    --primary-light: #4a90e2;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-blue: #eff6ff;
    --border: #dbe6f2;
    --text: #1e293b;
    --text-soft: #64748b;
    --text-inverse: #ffffff;
    --shadow: 0 10px 30px rgba(15, 82, 186, 0.08);
}

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
    color: var(--text);
    background: #f8fafc;
    line-height: 1.65;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover { color: var(--primary-dark); }

.container {
    width: min(1200px, calc(100% - 40px));
    margin: 0 auto;
}

.page-shell {
    min-height: calc(100vh - 180px);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: 0 6px 18px rgba(15, 82, 186, 0.18);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 74px;
}

.prototype-brand {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
}

.prototype-brand:hover { color: #fff; }

.public-nav,
.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.public-nav { margin-left: auto; }

.public-nav a,
.nav-links a {
    color: rgba(255, 255, 255, 0.96);
    font-size: 0.95rem;
    font-weight: 500;
}

.public-nav a:hover,
.nav-links a:hover {
    color: #dbeafe;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-secondary {
    background: #2563eb;
    color: #fff;
}

.btn-secondary:hover {
    background: #1d4ed8;
    color: #fff;
}

.btn-white {
    background: #fff;
    color: var(--primary);
}

.btn-white:hover {
    background: #dbeafe;
    color: var(--primary);
}

.btn-disabled,
.btn-disabled:hover {
    background: var(--primary);
    color: #fff;
    opacity: 0.55;
    cursor: default;
    transform: none;
}

.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: 0.88rem; }
.btn-lg { min-height: 52px; padding: 12px 22px; }
.btn-xl { min-height: 58px; padding: 14px 28px; font-size: 1rem; border-radius: 14px; }

.hero-band {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    padding: 64px 0 88px;
}

.hero-band-home {
    text-align: center;
}

.hero-band-home h1 {
    font-size: clamp(2rem, 4.6vw, 3.5rem);
    line-height: 1.15;
    margin-bottom: 16px;
}

.hero-subtitle {
    max-width: 760px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.08rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 30px;
}

.hero-actions-center {
    justify-content: center;
}

.section-panel {
    padding: 64px 0;
}

.section-white { background: #fff; }
.section-soft { background: #f8fafc; }

.section-head {
    margin-bottom: 28px;
}

.section-head-center {
    text-align: center;
}

.section-head-compact {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.section-head h2,
.page-intro h1 {
    color: var(--primary);
    font-size: clamp(1.9rem, 3.5vw, 2.3rem);
    margin-bottom: 12px;
}

.page-intro {
    padding: 52px 0 24px;
}

.page-intro-soft {
    background: linear-gradient(180deg, #f1f6ff 0%, #f8fafc 100%);
}

.page-intro p,
.section-head p,
.download-meta,
.table-subtext,
.about-copy,
.about-meta p,
.meta {
    color: var(--text-soft);
}

.section-kicker {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.feature-grid,
.help-grid,
.content-grid-two,
.stats-grid {
    display: grid;
    gap: 24px;
}

.feature-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.help-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card {
    padding: 24px;
    background: #eff6ff;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.feature-card h3 {
    font-size: 1.05rem;
    margin-bottom: 10px;
}

.download-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px;
}

.download-meta {
    margin-top: 20px;
    font-size: 0.92rem;
}

.info-card,
.card,
.stat-card,
.empty-panel,
.faq-item,
.feedback-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.info-card,
.card,
.stat-card,
.feedback-panel {
    padding: 22px;
}

.info-card h2,
.info-card h3,
.info-card h4,
.card h2,
.card h3 {
    margin-bottom: 10px;
}

.feedback-panel {
    max-width: 760px;
    margin: 0 auto;
}

.feedback-form {
    display: grid;
    gap: 14px;
}

.feedback-captcha-box {
    display: grid;
    gap: 8px;
}

.feedback-captcha-box label {
    font-size: 0.94rem;
    color: var(--text);
    font-weight: 600;
}

.form-notice {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.form-notice-success {
    color: #17504d;
    background: #e8f8f4;
    border: 1px solid #b8ece1;
}

.form-notice-error {
    color: #8b2e3b;
    background: #fff1f3;
    border: 1px solid #f5c5cf;
}

.feedback-form input,
.feedback-form select,
.feedback-form textarea,
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font-size: 0.95rem;
    color: var(--text);
}

.feedback-form textarea,
.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-help {
    margin-top: 6px;
    color: var(--text-soft);
    font-size: 0.88rem;
}

.bullet-list,
.stack-list {
    list-style: none;
}

.bullet-list li {
    position: relative;
    padding-left: 14px;
    color: var(--text-soft);
}

.bullet-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--primary);
}

.bullet-list li + li { margin-top: 6px; }

.table-wrap {
    overflow-x: auto;
}

.admin-site .table-wrap {
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}

.admin-table {
    width: 100%;
    min-width: 560px;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}

.admin-table th,
.admin-table td {
    padding: 13px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #e5edf6;
}

.admin-table thead th {
    background: #eff6ff;
    color: #334155;
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
}

.admin-table tbody th {
    width: 180px;
    background: #f8fbff;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}

.admin-table th + th,
.admin-table th + td,
.admin-table td + td {
    border-left: 1px solid #e5edf6;
}

.admin-table tbody tr:nth-child(even) td {
    background: #fbfdff;
}

.admin-table tbody tr:last-child th,
.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.table-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.table-num {
    width: 120px;
    text-align: right;
    white-space: nowrap;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.history-table thead {
    background: var(--primary);
    color: #fff;
}

.history-table th,
.history-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e5edf6;
    vertical-align: top;
}

.history-table tbody tr:hover {
    background: #eff6ff;
}

.table-link,
.text-link {
    font-weight: 700;
}

.history-changelog {
    display: grid;
    gap: 10px;
    min-width: 280px;
}

.history-changelog-preview {
    color: var(--text-soft);
    line-height: 1.7;
}

.history-detail-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
}

.history-detail-button:hover {
    color: var(--primary-dark);
}

.history-detail-button:disabled {
    color: var(--text-soft);
    cursor: default;
}

.history-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.table-version {
    font-weight: 700;
}

.modal-open {
    overflow: hidden;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.54);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-panel {
    width: min(860px, 100%);
    max-height: min(85vh, 900px);
    overflow: auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.modal-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.modal-header h3 {
    color: var(--primary);
    font-size: 1.25rem;
}

.modal-close {
    border: 0;
    background: transparent;
    color: var(--text-soft);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

.modal-body {
    padding: 22px;
}

.markdown-content > * + * {
    margin-top: 14px;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    color: var(--primary);
    line-height: 1.3;
}

.markdown-content ul,
.markdown-content ol {
    padding-left: 24px;
}

.markdown-content li + li {
    margin-top: 6px;
}

.markdown-content code {
    padding: 2px 6px;
    border-radius: 6px;
    background: #eff6ff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.9em;
}

.markdown-content pre {
    overflow-x: auto;
    padding: 14px 16px;
    border-radius: 12px;
    background: #0f172a;
    color: #e2e8f0;
}

.markdown-content pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
}

.markdown-content th,
.markdown-content td {
    padding: 10px 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.markdown-content blockquote {
    padding-left: 14px;
    border-left: 4px solid var(--primary-light);
    color: var(--text-soft);
}

.faq-stack,
.faq-list {
    display: grid;
    gap: 16px;
}

.faq-item {
    padding: 18px 20px;
    background: #eff6ff;
}

.faq-item h4,
.faq-item h3,
.faq-list h3 {
    margin-bottom: 6px;
}

.about-panel {
    text-align: center;
}

.about-copy {
    max-width: 760px;
    margin: 0 auto 24px;
}

.about-meta {
    display: grid;
    gap: 4px;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) 320px;
    gap: 20px;
    align-items: start;
}

.detail-main,
.detail-sidebar {
    display: grid;
    gap: 20px;
}

.panel-head,
.site-footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.stack-list li {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 0;
    border-bottom: 1px solid #e8eef6;
}

.stack-list li span { color: var(--text-soft); }

.sidebar-links {
    display: grid;
    gap: 10px;
}

.ordered-list {
    padding-left: 20px;
}

.ordered-list li + li { margin-top: 8px; }

.empty-panel {
    padding: 28px 24px;
    text-align: center;
    color: var(--text-soft);
}

.mono-text {
    font-family: "Fira Code", "Consolas", monospace;
    font-size: 0.84rem;
}

.site-footer {
    background: var(--primary);
    color: #fff;
    padding: 20px 0;
}

.site-footer-bottom {
    justify-content: center;
    font-size: 0.8rem;
}

.site-footer-bottom-center {
    text-align: center;
}

.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.92rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-green { background: #e8f8ee; color: #137333; }
.badge-red { background: #fdeceb; color: #c5221f; }
.badge-yellow { background: #fff5d9; color: #b06000; }
.badge-gray { background: #eef2f6; color: #4e5968; }

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin-bottom: 24px;
}

.stat-card { text-align: center; }

.stat-card .stat-value {
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-card .stat-label {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 0.88rem;
}

.topnav {
    background: #111827;
    color: #fff;
    padding: 12px 0;
}

.topnav .container {
    display: flex;
    align-items: center;
    gap: 24px;
}

.topnav a { color: #fff; }
.admin-nav { background: #111827; }

.login-box { max-width: 400px; margin: 80px auto; }
.login-box h2 { margin-bottom: 20px; text-align: center; }

.wiki-content { max-width: 860px; margin: 0 auto; }
.wiki-content h1, .wiki-content h2, .wiki-content h3 { margin-top: 24px; margin-bottom: 12px; }
.wiki-content p { margin-bottom: 12px; }
.wiki-content table { margin: 16px 0; }
.wiki-content th, .wiki-content td { border: 1px solid #dfe7f2; }
.wiki-content pre {
    padding: 14px;
    border-radius: 12px;
    overflow-x: auto;
    background: #0f172a;
    color: #e2e8f0;
}
.wiki-content code { font-family: "Fira Code", "Consolas", monospace; font-size: 0.9em; }
.wiki-content blockquote {
    margin: 18px 0;
    padding-left: 16px;
    border-left: 4px solid var(--primary);
    color: var(--text-soft);
}

.topic-card { margin-bottom: 12px; }
.reply-card {
    margin-left: 20px;
    border-left: 3px solid #d7e3f3;
    padding-left: 16px;
    margin-bottom: 12px;
}

.flash { padding: 10px 16px; border-radius: 6px; margin-bottom: 16px; }
.flash-success { background: #e6f4ea; color: #137333; }
.flash-error { background: #fce8e6; color: #c5221f; }

.feedback-admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.feedback-filter-tabs,
.feedback-search-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.feedback-search-form input[type="search"] {
    width: min(360px, 100%);
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.feedback-admin-list {
    display: grid;
    gap: 12px;
}

.feedback-admin-card {
    display: grid;
    gap: 10px;
    padding: 14px 16px;
}

.feedback-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.feedback-card-title-wrap {
    display: grid;
    gap: 4px;
}

.feedback-card-title-wrap strong {
    line-height: 1.35;
}

.feedback-card-meta {
    font-size: 0.8rem;
}

.feedback-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.feedback-thread {
    display: grid;
    gap: 8px;
}

.feedback-post {
    padding: 10px 12px;
    border-radius: 12px;
}

.feedback-post-user {
    background: #f8fbff;
    border: 1px solid #dbe6f2;
}

.feedback-post-admin {
    margin-left: 18px;
    background: #eef6ff;
    border: 1px solid #cfe0fb;
}

.feedback-post-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.92rem;
}

.feedback-post-body {
    white-space: pre-wrap;
    line-height: 1.5;
    font-size: 0.92rem;
}

.feedback-post-actions,
.feedback-card-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
}

.feedback-card-footer {
    padding-top: 4px;
    border-top: 1px dashed #e5edf6;
}

.feedback-modal {
    width: min(640px, calc(100vw - 32px));
    border: none;
    border-radius: 18px;
    padding: 0;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.feedback-modal::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.feedback-modal-form {
    display: grid;
    gap: 16px;
    padding: 24px;
}

.feedback-modal-head,
.feedback-modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.feedback-modal-close {
    border: none;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 0.95rem;
}

.feedback-modal-close:hover {
    color: var(--primary);
}

@media (max-width: 860px) {
    .feedback-post-admin {
        margin-left: 8px;
    }
}

@media (max-width: 1080px) {
    .feature-grid-4,
    .help-grid-3,
    .content-grid-two,
    .detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .site-header-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 0;
    }

    .public-nav {
        width: 100%;
        margin-left: 0;
        flex-wrap: wrap;
        gap: 14px;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(100% - 28px, 1200px);
    }

    .hero-actions,
    .download-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-actions .btn,
    .download-actions .btn {
        width: 100%;
    }
}
