:root {
    --bg: #ffffff;
    --paper: #ffffff;
    --ink: #0a0a0a;
    --accent: #111111;
    --line: #121212;
    --muted: #4d4d4d;
    --wall: #f7f7f7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Noto Sans JP", sans-serif;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
        linear-gradient(0deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
        var(--wall);
    background-size: 22px 22px, 22px 22px, auto;
    color: var(--ink);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    padding-top: calc(8px + env(safe-area-inset-top));
    border-bottom: 3px solid var(--line);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    color: var(--ink);
    text-decoration: none;
    letter-spacing: 0.04em;
    display: grid;
    line-height: 1.1;
}

.brand-main {
    font-size: 1.08rem;
    font-weight: 800;
}

.brand-sub {
    font-size: 0.68rem;
    color: #2f2f2f;
}

nav a,
nav button {
    margin-left: 6px;
    padding: 6px 10px;
    border: 2px solid #000;
    text-decoration: none;
    color: #000;
    background: #fff;
}

.container {
    width: min(100% - 16px, 1120px);
    margin: 10px auto;
    padding: 0 clamp(6px, 1.4vw, 14px);
}

.reader-container {
    width: 100%;
    margin: 0;
    padding: 0;
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
}

.editor-container {
    width: 100%;
    margin: 0;
    padding: 0;
}

.editor-page .site-header {
    border-bottom: 1px solid #000;
    padding: clamp(4px, 0.8vw, 8px) clamp(8px, 1.6vw, 14px);
    padding-top: calc(clamp(4px, 0.8vw, 8px) + env(safe-area-inset-top));
    gap: clamp(6px, 1vw, 12px);
    flex-wrap: wrap;
}

.editor-page .brand-main {
    font-size: 0.98rem;
}

.editor-page .brand-sub {
    font-size: 0.64rem;
}

.site-header-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1.2;
}

.site-header-status {
    margin: 0;
    flex: 0 1 clamp(180px, 22vw, 320px);
    min-width: 0;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.74rem;
    color: var(--muted);
    line-height: 1.2;
}

.editor-page .site-header nav {
    flex: 0 0 auto;
}

.header-editor-tabs {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.header-editor-tabs .editor-section-link {
    padding: 3px 7px;
}

.reader-page {
    background: #fff;
    min-height: 100dvh;
    overflow: visible;
}

.hero {
    background: #fff;
    border: 2px solid var(--line);
    border-radius: 0;
    padding: 10px;
}

.exhibition-panel {
    border-width: 3px;
    box-shadow: 6px 6px 0 #000;
}

.hero h1 {
    margin: 0 0 6px;
    font-size: 1.25rem;
}

.hero p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(220px, 30vw, 290px), 1fr));
    gap: clamp(8px, 1.2vw, 14px);
    margin-top: 10px;
}

.gallery-grid {
    align-items: start;
}

.card {
    background: var(--paper);
    border: 2px solid var(--line);
    border-radius: 0;
    padding: clamp(8px, 1.1vw, 12px);
}

.frame-card {
    border-width: 3px;
    box-shadow: 4px 4px 0 #000;
    display: flex;
    flex-direction: column;
    height: clamp(390px, 47vw, 440px);
    overflow: hidden;
}

.cover {
    width: 100%;
    height: clamp(140px, 22vw, 180px);
    object-fit: contain;
    object-position: center;
    border-radius: 0;
    border: 3px solid #000;
    background: #fff;
}

.cover-placeholder {
    background:
        repeating-linear-gradient(45deg, #f4f4f4, #f4f4f4 8px, #ececec 8px, #ececec 16px);
}

.novel-title {
    margin: 8px 0 4px;
    line-height: 1.25;
    min-height: calc(1.25em * 2);
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.novel-summary {
    margin: 6px 0;
    line-height: 1.35;
    min-height: calc(1.35em * 3);
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.frame-card .tag-list.compact {
    height: 52px;
    overflow: hidden;
    align-content: flex-start;
}

.frame-card .stats {
    margin-top: auto;
}

.detail-cover {
    max-width: 280px;
    margin: 8px 0;
}

.meta,
.stats {
    color: var(--muted);
    font-size: 0.86rem;
}

.frame-card .meta {
    margin: 4px 0;
    line-height: 1.3;
    min-height: 1.3em;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.form {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
}

.editor-shell {
    display: grid;
    gap: 8px;
    width: 100%;
    margin: clamp(8px, 1.6vw, 14px) auto 0;
    padding: 0 clamp(8px, 1.6vw, 14px) 10px;
}

.editor-section-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.editor-section-link {
    display: inline-block;
    border: 2px solid #000;
    background: #fff;
    color: #000;
    text-decoration: none;
    padding: 4px 8px;
}

.editor-section-link.active {
    background: #000;
    color: #fff;
}

.editor-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    border: 2px solid #000;
    background: #fff;
    padding: 7px 8px;
}

.editor-btn {
    background: #fff;
    color: #000;
}

.editor-status {
    margin: 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.editor-backup-panel {
    border: 2px solid #000;
    background: #fff8e8;
    padding: 8px;
}

.editor-backup-title {
    margin: 0;
    font-weight: 700;
    font-size: 0.88rem;
}

.editor-backup-meta {
    margin: 5px 0 0;
    font-size: 0.8rem;
    color: #333;
}

.editor-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.editor-field {
    min-width: 0;
}

.manuscript-field {
    position: relative;
    display: grid;
    grid-template-columns: 0 minmax(0, 1fr);
    align-items: start;
    column-gap: 10px;
    gap: 0;
    overflow: visible;
}

.manuscript-field.meta-drawer-open {
    grid-template-columns: minmax(250px, 30vw) minmax(0, 1fr);
}

.manuscript-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    grid-column: 2;
    grid-row: 1;
}

.manuscript-side-inputs {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.35fr) minmax(0, 0.95fr);
    gap: 8px;
}

.editor-draft-actions-desktop {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    margin-top: 8px;
    display: flex;
    gap: 6px;
    align-items: center;
}

.editor-meta-launcher {
    position: static;
    z-index: auto;
    width: auto;
    text-align: left;
    background: #fff;
    color: #000;
    border: 2px solid #000;
    padding: 6px 8px;
}

.editor-publish-btn {
    background: #000;
    color: #fff;
    border: 2px solid #000;
    padding: 6px 10px;
}

.editor-publish-mobile {
    display: none;
}

.editor-mobile-switch {
    display: none;
}

.editor-meta-drawer {
    position: static;
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 100%;
    max-width: none;
    max-height: min(78dvh, 760px);
    overflow: auto;
    border: 2px solid #000;
    background: #fff;
    padding: 10px;
    display: grid;
    gap: 8px;
    transform: translateX(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
    z-index: auto;
}

.editor-meta-drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.editor-meta-drawer-title {
    margin: 0;
    font-weight: 700;
}

.editor-meta-close {
    background: #fff;
    color: #000;
}

.manuscript-field.meta-drawer-open .editor-meta-drawer {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.editor-meta-body {
    display: grid;
    gap: 8px;
}

.editor-meta-drawer[aria-hidden="true"] .editor-meta-body {
    display: none;
}

.manuscript-composer.vertical {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    column-gap: 2px;
}

.manuscript-composer.vertical .body-editor {
    grid-column: 1;
    grid-row: 1;
}

.manuscript-composer.vertical .manuscript-side-inputs {
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1.9fr) minmax(0, 1.3fr) minmax(0, 0.8fr);
    align-content: start;
    width: calc(1em + 18px);
    min-width: calc(1em + 18px);
    max-width: calc(1em + 18px);
    height: var(--side-inputs-height, auto);
    min-height: 0;
    gap: 6px;
    border-left: 1px solid rgba(0, 0, 0, 0.2);
    padding-left: 0;
}

.manuscript-composer.vertical .manuscript-side-inputs input,
.manuscript-composer.vertical .manuscript-side-inputs select {
    writing-mode: vertical-rl;
    text-orientation: upright;
    height: 100%;
    min-height: 0;
    width: 100%;
    line-height: 1.1;
    padding: 8px 2px;
    white-space: nowrap;
}

.manuscript-composer.vertical .manuscript-side-inputs .manuscript-title-input,
.manuscript-composer.vertical .manuscript-side-inputs .manuscript-pen-input,
.manuscript-composer.vertical .manuscript-side-inputs .manuscript-mode-select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-self: stretch;
}

.editor-wide {
    grid-column: 1 / -1;
}

.editor-field input,
.editor-field textarea,
.editor-field select {
    width: 100%;
    max-width: 100%;
}

.mypage-section {
    margin-top: 12px;
}

.mypage-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.mypage-grid {
    margin-top: 6px;
}

.mypage-grid .novel-title {
    font-size: 1rem;
}

.mypage-draft-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.mypage-draft-actions .reader-link {
    padding: 4px 7px;
}

.draft-card {
    border-style: dashed;
}

.body-editor {
    --genko-cell: 1.95em;
    --genko-offset: 0;
    --genko-inline-end-correct: 0px;
    --genko-block-end-correct: 0px;
    --body-pad: 4px;
    --lead-before-char: calc((var(--genko-cell) - 1em) / 2);
    min-height: 400px;
    height: min(74dvh, calc(100dvh - 210px));
    line-height: var(--genko-cell);
    resize: vertical;
    white-space: pre-wrap;
    border-width: 3px;
    background-color: #fff;
    font-family: "BIZ UDMincho", "MS Gothic", "Noto Sans JP", monospace;
    font-size: 1rem;
    font-variant-east-asian: full-width;
    font-feature-settings: "fwid" 1;
    letter-spacing: calc(var(--genko-cell) - 1em);
    tab-size: 1;
    padding: var(--body-pad);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: auto;
    scrollbar-color: #555 #f0f0f0;
    scrollbar-gutter: stable;
    max-width: 100%;
    min-width: 0;
}

.body-editor::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.body-editor::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.body-editor::-webkit-scrollbar-thumb {
    background: #666;
    border: 2px solid #f0f0f0;
}

.body-editor::-webkit-scrollbar-thumb:hover {
    background: #444;
}

.body-editor.horizontal {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    padding-top: var(--body-pad);
    padding-left: calc(var(--body-pad) + var(--lead-before-char));
    padding-right: calc(var(--body-pad) + var(--genko-inline-end-correct));
    padding-bottom: var(--body-pad);
    overflow-y: scroll;
    overflow-x: hidden;
}

.body-editor.vertical {
    writing-mode: vertical-rl;
    text-orientation: upright;
    height: min(78dvh, calc(100dvh - 190px));
    min-height: 420px;
    padding-top: calc(var(--body-pad) + var(--lead-before-char));
    padding-right: var(--body-pad);
    padding-left: var(--body-pad);
    padding-bottom: calc(var(--body-pad) + var(--genko-block-end-correct));
    overflow-x: scroll;
    overflow-y: hidden;
}

label {
    display: grid;
    gap: 4px;
}

input,
textarea,
select,
button {
    font: inherit;
    border: 2px solid var(--line);
    border-radius: 0;
    padding: 7px 8px;
}

button {
    background: var(--accent);
    color: white;
    border: 2px solid #000;
    cursor: pointer;
}

a {
    color: #000;
}

a:hover,
button:hover {
    filter: invert(1);
}

.error {
    color: #b00020;
    font-weight: 700;
}

.inline {
    display: inline-block;
}

.novel-detail .body {
    white-space: pre-wrap;
    background: var(--paper);
    border: 2px solid var(--line);
    border-radius: 0;
    padding: 10px;
}

.gallery-piece {
    background: #fff;
    border: 3px solid #000;
    padding: 10px;
    box-shadow: 6px 6px 0 #000;
}

.novel-detail .body.vertical {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    max-height: 520px;
    overflow-x: auto;
    overflow-y: hidden;
}

.comments .comment {
    background: var(--paper);
    border: 2px solid var(--line);
    border-radius: 0;
    padding: 8px;
    margin-bottom: 6px;
}

.gallery-comments {
    margin-top: 10px;
    border-top: 3px solid #000;
    padding-top: 8px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 8px 0;
}

.reader-link {
    display: inline-block;
    text-decoration: none;
    border: 2px solid #000;
    background: #000;
    color: #fff;
    padding: 5px 8px;
}

.reader-cta {
    margin: 10px 0 8px;
    padding: 8px;
    border: 2px solid #000;
    background: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.reader-cta-copy {
    flex: 1 1 320px;
    min-width: 220px;
}

.reader-cta-lead {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
}

.reader-cta-excerpt {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: #1f1f1f;
}

.reader-link-primary {
    font-size: 0.95rem;
    font-weight: 800;
    padding: 8px 12px;
    box-shadow: 3px 3px 0 #000;
}

.reader-description {
    margin: 8px 0 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.reader-layout {
    background: #fff;
    border: none;
    box-shadow: none;
    padding: 0;
    min-height: 100dvh;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 0;
    overflow: hidden;
}

.reader-head h1 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.2;
}

.reader-head {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 5;
    border-bottom: 1px solid #000;
    padding: clamp(4px, 0.8vw, 8px) clamp(8px, 1.6vw, 14px);
    padding-top: calc(clamp(4px, 0.8vw, 8px) + env(safe-area-inset-top));
    display: flex;
    align-items: center;
    gap: clamp(6px, 1vw, 12px);
    flex-wrap: nowrap;
    overflow-x: auto;
}

.reader-title-block {
    min-width: clamp(140px, 24vw, 220px);
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.reader-title-block h1 {
    display: inline;
    max-width: min(45vw, 560px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-unified-brand {
    flex: 0 0 auto;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: 0.04em;
    border: 2px solid #000;
    padding: 2px 6px;
    background: #fff;
    line-height: 1.2;
}

.reader-meta-inline {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.2;
    padding-bottom: 0;
}

.reader-toolbar {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin: 0;
    width: auto;
    flex: 0 0 auto;
}

@media (max-width: 980px) {
    .reader-layout[data-writing-mode="horizontal"] .reader-head {
        display: flex;
    }

    .reader-head {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .reader-title-block {
        width: 100%;
    }

    .reader-title-block h1 {
        max-width: min(84vw, 640px);
    }

    .reader-toolbar {
        width: 100%;
        flex-wrap: wrap;
        gap: 6px;
    }

    .reader-layout[data-writing-mode="horizontal"] .reader-body.horizontal {
        width: min(100%, 720px);
    }
}

.reader-toolbar.collapsed {
    display: none;
}

.reader-toolbar label {
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.reader-toolbar button {
    align-self: center;
    padding: 2px 5px;
    font-size: 0.7rem;
}

.reader-progress {
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #000;
    padding: 2px 5px;
    font-weight: 700;
    background: #fff;
    font-size: 0.7rem;
}

.reader-toolbar select {
    min-width: 56px;
    padding: 2px 4px;
    height: 24px;
}

.reader-frame {
    border: none;
    border-top: 1px solid #000;
    background: #fff;
    overflow: auto;
    padding: 14px 16px;
    min-height: 0;
    height: 100%;
}

.reader-frame.width-narrow .reader-body {
    max-width: 520px;
}

.reader-frame.width-normal .reader-body {
    max-width: 760px;
}

.reader-frame.width-wide .reader-body {
    max-width: 980px;
}

.reader-frame.width-full .reader-body {
    max-width: none;
}

.reader-body {
    white-space: normal;
    margin: 0 auto;
    letter-spacing: 0.01em;
    line-break: strict;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.reader-inline-meta {
    padding: 0;
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.35em;
}

.reader-inline-title {
    margin: 0;
    font-size: 1.28em;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: inherit;
}

.reader-inline-author {
    margin: 0;
    font-size: 0.84em;
    color: #303030;
    align-self: center;
}

.reader-text {
    display: block;
    white-space: pre-wrap;
    text-indent: 0;
}

.reader-body.horizontal {
    writing-mode: horizontal-tb;
    max-width: min(92vw, 860px);
    margin: 0 auto;
    line-height: 1.9;
}

.reader-body.vertical {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    height: auto;
    min-height: 0;
    box-sizing: border-box;
    padding-block: 0.35em;
    margin: 0 0 0 auto;
    width: max-content;
    max-width: none;
    word-break: normal;
    overflow-wrap: normal;
    line-height: 1.6;
}

.reader-layout[data-writing-mode="vertical"] .reader-frame {
    overflow-x: auto;
    overflow-y: hidden;
}

.reader-body.vertical .reader-inline-meta {
    display: flex;
    margin-top: 0;
    margin-bottom: 0;
    margin-left: 12px;
    margin-right: 0;
    padding: 0;
    gap: 0.9em;
    align-items: center;
}

.reader-body.vertical .reader-inline-author {
    align-self: center;
}

.reader-body.vertical .reader-text {
    display: block;
    padding-top: 0;
    padding-block: 0.35em;
    padding-inline: 0.15em;
}

.reader-layout[data-writing-mode="horizontal"] .reader-body.horizontal>.reader-inline-meta {
    width: max-content;
    max-width: 100%;
    margin-inline: auto;
    display: grid;
    justify-items: center;
    align-items: center;
    gap: 0.25em;
    text-align: center;
    max-width: min(92%, 620px);
}

.reader-layout[data-writing-mode="horizontal"] .reader-body.horizontal>.reader-inline-meta .reader-inline-title,
.reader-layout[data-writing-mode="horizontal"] .reader-body.horizontal>.reader-inline-meta .reader-inline-author {
    display: block;
    width: max-content;
    max-width: 100%;
    margin-inline: auto;
    text-align: center;
    justify-self: center;
    align-self: center;
}

.reader-layout[data-writing-mode="horizontal"] .reader-body.horizontal {
    width: min(92vw, calc((100vh - 132px) * 0.709), 760px);
    max-width: none;
}

@media (min-width: 721px) {
    .reader-layout[data-writing-mode="horizontal"] .reader-frame.width-full .reader-body.horizontal {
        width: min(92vw, calc((100vh - 132px) * 0.709), 760px);
    }
}

.tag-filter {
    margin-top: 8px;
}

.tag-filter-title {
    margin: 0 0 5px;
    font-size: 0.82rem;
    color: var(--muted);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag-list.compact {
    margin: 5px 0;
}

.tag-chip {
    display: inline-block;
    border: 2px solid #000;
    padding: 2px 6px;
    text-decoration: none;
    background: #fff;
    font-size: 0.8rem;
    line-height: 1.3;
}

.tag-chip.active {
    background: #000;
    color: #fff;
}

@media (max-width: 720px) {
    body {
        overflow-x: hidden;
    }

    .container,
    .editor-container,
    .reader-container {
        width: 100%;
        margin: 0;
        padding-left: 8px;
        padding-right: 8px;
    }

    .site-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .site-header nav,
    .header-editor-tabs {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    .site-header-title,
    .site-header-status {
        flex: none;
        width: 100%;
        text-align: left;
    }

    nav a,
    nav button,
    .header-editor-tabs .editor-section-link {
        margin-left: 0;
        padding: 5px 8px;
        font-size: 0.84rem;
    }

    .novel-detail .body.vertical {
        writing-mode: horizontal-tb;
        max-height: none;
        overflow: visible;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .frame-card {
        height: auto;
        min-height: 380px;
    }

    .cover {
        height: clamp(150px, 42vw, 220px);
    }

    .reader-frame {
        padding: 10px 12px;
        margin-top: 0;
    }

    .reader-head {
        position: sticky;
        top: 0;
    }

    .reader-layout[data-writing-mode="vertical"] .reader-body.vertical {
        writing-mode: vertical-rl;
        text-orientation: mixed;
        line-height: 1.6;
    }

    .reader-layout[data-writing-mode="vertical"] .reader-frame {
        padding-top: 10px;
        margin-top: 0;
    }

    .reader-layout[data-writing-mode="horizontal"] .reader-body.horizontal {
        writing-mode: horizontal-tb;
        line-height: 1.8;
    }

    .reader-body.horizontal {
        max-width: none;
        line-height: 1.8;
    }

    .reader-frame {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .reader-layout[data-writing-mode="vertical"] .reader-frame {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .reader-toolbar {
        justify-content: flex-start;
        width: auto;
        gap: 5px;
    }

    .reader-head {
        gap: 8px;
    }

    .reader-layout[data-writing-mode="horizontal"] .reader-head,
    .reader-layout[data-writing-mode="vertical"] .reader-head {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        overflow-x: visible;
        padding: 8px;
        padding-top: calc(8px + env(safe-area-inset-top));
    }

    .reader-layout[data-writing-mode="horizontal"] .reader-title-block,
    .reader-layout[data-writing-mode="vertical"] .reader-title-block {
        order: 1;
        width: 100%;
        min-width: 0;
    }

    .reader-layout[data-writing-mode="horizontal"] .reader-toolbar,
    .reader-layout[data-writing-mode="vertical"] .reader-toolbar {
        order: 2;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }

    .reader-title-block h1 {
        max-width: 74vw;
    }

    .editor-form {
        grid-template-columns: 1fr;
    }

    .editor-shell {
        margin-top: 10px;
        padding-left: 8px;
        padding-right: 8px;
    }

    .body-editor.vertical {
        height: min(62dvh, calc(100dvh - 210px));
        min-height: 300px;
    }

    .manuscript-composer,
    .manuscript-composer.vertical {
        grid-template-columns: minmax(0, 1fr);
    }

    .editor-meta-launcher {
        display: none;
    }

    .editor-draft-actions-desktop {
        display: none;
    }

    .editor-meta-drawer {
        position: static;
        grid-column: 1;
        grid-row: auto;
        width: 100%;
        max-height: none;
        border-width: 2px;
        padding-top: 10px;
        transform: none;
        opacity: 1;
        pointer-events: auto;
    }

    .manuscript-field,
    .manuscript-field.meta-drawer-open {
        grid-template-columns: minmax(0, 1fr);
    }

    .editor-mobile-switch {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        margin-top: 8px;
        grid-column: 1 / -1;
    }

    .editor-mobile-switch button {
        background: #fff;
        color: #000;
    }

    .editor-mobile-switch button.active {
        background: #000;
        color: #fff;
    }

    .editor-publish-mobile {
        display: block;
        margin-top: 8px;
        width: 100%;
        background: #000;
        color: #fff;
    }

    .manuscript-field:not(.mobile-meta-section) .editor-meta-drawer {
        display: none;
    }

    .manuscript-field.mobile-meta-section .manuscript-composer {
        display: none;
    }

    .manuscript-field.mobile-meta-section .editor-meta-drawer {
        display: grid;
    }

    .manuscript-composer.vertical .manuscript-side-inputs {
        width: 100%;
        min-width: 0;
        max-width: none;
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1.9fr) minmax(0, 1.3fr) minmax(0, 0.8fr);
        border-left: 0;
        padding-left: 0;
    }

    .manuscript-composer.vertical .manuscript-side-inputs input,
    .manuscript-composer.vertical .manuscript-side-inputs select {
        writing-mode: vertical-rl;
        text-orientation: upright;
        min-height: 56px;
        padding: 8px 2px;
        line-height: 1.1;
        white-space: nowrap;
    }

    .body-editor {
        min-height: 280px;
        height: min(58dvh, calc(100dvh - 230px));
        --genko-cell: 1.75em;
        text-transform: full-width;
        font-size: 0.96rem;
    }
}

@media (max-width: 420px) {
    .brand-main {
        font-size: 0.92rem;
    }

    .brand-sub {
        font-size: 0.6rem;
    }

    .grid {
        gap: 8px;
    }

    .card,
    .gallery-piece,
    .hero {
        padding: 8px;
    }

    .reader-frame {
        padding: 8px;
    }
}