.module-editor-page {
    background: var(--brand-bg);
    color: var(--text-main);
    font-family: var(--font-sans);
}

.module-editor-page * {
    box-sizing: border-box;
}

.module-editor-page .topbar {
    height: auto;
    min-height: 56px;
    flex: 0 0 auto;
    padding: 10px 24px;
}

.module-editor-page .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.module-editor-page .brand-mark {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 900;
}

.editor-nav-item {
    text-decoration: none;
}

.editor-nav-item .nav-item-icon {
    width: 22px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
}

.module-editor-page .status-line {
    overflow: hidden;
}

.module-editor-page #statusBox {
    overflow: hidden;
    color: var(--text-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hidden {
    display: none;
}

.editor-scroll {
    scroll-behavior: smooth;
}

.module-editor-viewport {
    width: min(100%, 1180px);
    margin: 0 auto;
    padding: 24px 32px 64px;
    outline: none;
}

.module-editor-page .hero,
.module-editor-page .section {
    border: 1px solid var(--border-light);
    background: var(--card-bg);
    box-shadow: var(--shadow-soft);
    padding: 20px;
    margin: 0 0 18px;
    scroll-margin-top: 20px;
}

.module-editor-page .hero h2,
.module-editor-page .section h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 20px;
    line-height: 1.25;
    font-weight: 800;
}

.module-editor-page .hero p,
.section-desc,
.help,
.notice {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
}

.module-editor-page .hero p {
    margin: 8px 0 0;
    max-width: 900px;
}

.editor-command-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
    border: 1px solid var(--border-light);
    background: var(--brand-bg);
    padding: 12px;
}

.editor-command-bar strong {
    display: block;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 900;
}

.editor-command-bar span {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.editor-command-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.hero-grid,
.reference-grid,
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.reference-grid,
.checkbox-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-card,
.guide-card,
.item-card,
.check-card,
.notice,
.preview-box {
    border: 1px solid var(--border-light);
    background: var(--brand-bg);
}

.mini-card,
.guide-card {
    padding: 12px;
}

.mini-card strong {
    display: block;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 20px;
    line-height: 1;
}

.mini-card span,
.guide-card p {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.guide-card strong {
    color: var(--text-main);
    font-size: 12px;
}

.guide-card p {
    margin: 5px 0 0;
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.section-desc {
    margin: 5px 0 0;
}

.grid {
    display: grid;
    gap: 12px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field {
    display: grid;
    gap: 6px;
}

.field label,
.check-title {
    color: var(--text-main);
    font-size: 12px;
    font-weight: 800;
}

.field input,
.field select,
textarea {
    width: 100%;
    border: 1px solid var(--border-light);
    background: var(--code-bg);
    color: var(--text-main);
    padding: 9px 10px;
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
}

.field input:focus,
.field select:focus,
textarea:focus {
    border-color: color-mix(in srgb, var(--accent-blue) 55%, var(--border-light));
}

.help {
    margin: 0;
}

.btn {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    background: var(--hover-bg);
    color: var(--text-main);
    padding: 7px 10px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.btn:hover {
    opacity: 0.88;
}

.btn.primary {
    background: var(--selected-bg);
    border-color: color-mix(in srgb, var(--accent-blue) 42%, var(--border-light));
}

.btn.danger {
    color: var(--accent-red);
}

.btn.small {
    min-height: 28px;
    padding: 6px 8px;
    font-size: 11px;
}

.check-card {
    min-height: 72px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    cursor: pointer;
}

.check-card input {
    margin: 2px 0 0;
    accent-color: var(--accent-blue);
}

.check-help {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.notice {
    margin: 12px 0;
    padding: 11px 12px;
}

.stack {
    display: grid;
    gap: 12px;
}

.item-card {
    padding: 14px;
}

.item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.item-head > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.item-title {
    color: var(--text-main);
    font-size: 13px;
    font-weight: 900;
}

.zone-list {
    display: grid;
    gap: 10px;
}

.zone-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px auto;
    gap: 10px;
    align-items: end;
    border: 1px solid var(--border-light);
    background: var(--code-bg);
    padding: 10px;
}

.preview-box {
    padding: 14px;
}

.preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 10px;
}

.json-viewer {
    position: relative;
    min-height: 360px;
    border: 1px solid var(--border-light);
    background: var(--code-bg);
    overflow: auto;
}

.json-highlight {
    margin: 0;
    min-height: 360px;
    padding: 14px;
    color: var(--code-text);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    white-space: pre;
}

.json-hidden-source {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.json-key {
    color: var(--token-keyword);
    font-weight: 700;
}

.json-string {
    color: var(--token-string);
}

.json-number {
    color: var(--token-number);
}

.json-boolean,
.json-null {
    color: var(--token-literal);
}

.json-punctuation {
    color: var(--token-punctuation);
}

.validation-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.validation-item {
    border: 1px solid var(--border-light);
    background: var(--brand-bg);
    color: var(--text-muted);
    padding: 9px 10px;
    font-size: 12px;
    line-height: 1.45;
}

.validation-item.good {
    border-color: color-mix(in srgb, var(--accent-green) 45%, var(--border-light));
    color: var(--accent-green);
}

.validation-item.warning {
    border-color: color-mix(in srgb, var(--accent-amber) 50%, var(--border-light));
    color: var(--accent-amber);
}

.validation-item.error {
    border-color: color-mix(in srgb, var(--accent-red) 50%, var(--border-light));
    color: var(--accent-red);
}

@media (max-width: 1120px) {
    .hero-grid,
    .reference-grid,
    .checkbox-grid,
    .grid.three,
    .grid.four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .module-editor-page .topbar,
    .editor-command-bar,
    .section-header,
    .item-head {
        align-items: stretch;
        flex-direction: column;
    }

    .module-editor-page .topbar-actions,
    .editor-command-actions {
        justify-content: flex-start;
    }

    .module-editor-viewport {
        padding: 18px 16px 48px;
    }

    .hero-grid,
    .reference-grid,
    .checkbox-grid,
    .grid.two,
    .grid.three,
    .grid.four,
    .zone-row {
        grid-template-columns: 1fr;
    }
}
