.is-empty {
    opacity: 0.4;
}

.mod-drag-wrapper {
    position: relative;
}

.mod-drag-handle {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: rgba(0, 0, 0, 0.25);
    font-size: 13px;
    line-height: 1;
    user-select: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
}

.mod-drag-handle.visible {
    opacity: 1;
}

.drag-over-top {
    border-top: 3px solid #3b82f6 !important;
}

.drag-over-bottom {
    border-bottom: 3px solid #3b82f6 !important;
}

.dragging-module {
    opacity: 0.5;
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

.doc-episode-wrapper {
    position: relative;
    border: 2.5px solid #185FA5;
    border-radius: 10px;
    padding: 32px 18px 18px;
    margin: 36px 0 28px;
    background: transparent;
    page-break-inside: auto;
    break-inside: auto;
}

.doc-episode-header-tab {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: #185FA5;
    color: #fff;
    padding: 3px 18px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--work-font);
    border-radius: 6px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    user-select: none;
}

.doc-group-footer-a4 { display: none; }
.doc-episode-header  { display: none; }

.doc-render-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 32px 0 24px;
    color: #a0aec0;
    font-size: 11px;
    font-family: sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    user-select: none;
}

.doc-render-line {
    flex: 1;
    height: 1px;
    background: #cbd5e0;
    opacity: 0.3;
}

.doc-render-label {
    flex-shrink: 0;
    opacity: 0.4;
}

.doc-block-drag-handle {
    position: absolute;
    left: -15px;
    top: 0;
    bottom: 0;
    width: 15px;
    cursor: grab;
    z-index: 10;
}

.doc-page-node-wrapper {
    position: relative;
    margin-bottom: 100px;
    padding: 0;
}

.doc-page-node-paper {
    position: relative;
    background: #fff;
    width: 100%;
    aspect-ratio: 1 / 1.414;
    box-sizing: border-box;
    display: grid;
    grid-template-rows: 1fr auto 1fr auto;
    padding: 10% 12% 8%;
    overflow: hidden;
    font-family: var(--work-font);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.doc-page-zone-top {
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.doc-page-zone-center {
    grid-row: 2;
    display: flex;
    flex-direction: column;
}

.doc-page-zone-bottom {
    grid-row: 3;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.doc-page-zone-footer {
    grid-row: 4;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.page-field {
    outline: none;
    min-height: 1.4em;
}

.page-field-title {
    font-size: 1.7em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #222;
    text-align: center;
    white-space: pre-wrap;
}

.page-field-about {
    font-size: 0.95em;
    line-height: 1.7;
    color: #444;
    text-align: center;
    white-space: pre-wrap;
}

.page-field-date {
    font-size: 0.85em;
    color: #666;
    text-align: center;
    letter-spacing: 1px;
}

.page-field-freetext {
    flex: 1;
    min-height: 0;
    font-size: 1em;
    line-height: 1.9;
    color: #222;
    white-space: pre-wrap;
    overflow-y: auto;
}

.doc-module-copyright-row {
    width: 100%;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}

.page-copyright-sign {
    font-size: 0.85em;
    color: #666;
    user-select: none;
    flex-shrink: 0;
    line-height: 1.4em;
}

.page-freetext-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.doc-module-title,
.doc-module-about {
    width: 100%;
    text-align: center;
}

.doc-module-date {
    width: 100%;
    text-align: center;
}

.doc-block-heading-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.doc-block-heading-wrapper .doc-block-heading {
    margin-bottom: 0;
    flex-shrink: 0;
}

.doc-block-heading-wrapper .doc-block-heading[contenteditable="true"] {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.doc-block-time-a4 {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 11px;
    font-family: var(--work-font);
    color: #888;
    white-space: nowrap;
    padding: 1px 4px;
    background: rgba(0,0,0,0.04);
    border-radius: 4px;
}
.a4-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 10px;
    background: var(--ui-bg-deep);
    border-bottom: 1px solid var(--ui-border);
    user-select: none;
    flex-shrink: 0;
}
.a4tb-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--ui-text-dim);
    width: 28px;
    height: 26px;
    padding: 0;
    border-radius: var(--ui-radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.a4tb-btn:hover:not(:disabled) { background: rgba(255,255,255,0.08); color: var(--ui-text); }
.a4tb-btn.on { background: var(--ui-accent); color: #fff; }
.a4tb-btn:disabled { opacity: 0.35; cursor: default; }
.a4tb-sep { width: 1px; height: 16px; background: var(--ui-border); margin: 0 6px; }
.a4tb-spacer { flex: 1; }
.a4tb-read { width: auto; padding: 0 10px; gap: 6px; font-size: 11px; font-family: var(--ui-font); }

#a4-canvas.a4-read-mode, #a4-canvas.a4-read-mode * { user-select: text !important; }
.a4-content.rm-content { font-family: var(--work-font); font-size: 14px; line-height: 1.6; color: #111; }
.rm-content p { margin: 0 0 1em; }
.rm-heading { font-weight: bold; text-transform: uppercase; }
.rm-dialog { text-align: center; padding: 0 100px; }
.rm-page { text-align: center; }
.rs-timing { float: right; color: #808080; font-weight: normal; }
.rm-content .rs-timing { float: none; margin-left: 14px; text-transform: none; }
.rs-total { text-align: center; font-weight: bold; margin-top: 40px; padding-top: 20px; border-top: 1px solid #e0e0e0; }

.a4-read-mode .a4-wrapper { flex-direction: column; align-items: center; }

.a4-read-mode .a4-paper.rm-sheet, .a4-read-mode .a4-paper.rm-sheet * { user-select: text; }
.a4-read-mode .a4-paper.rm-sheet {
    background-image: none !important;
    height: auto;
    min-height: 1123px;
    margin: 0 0 28px;
}
.a4-read-mode .a4-paper.rm-sheet:last-child { margin-bottom: 0; }
.a4-read-mode .rm-pageno {
    position: absolute;
    bottom: 14px;
    right: 18px;
    font-size: 10px;
    font-family: sans-serif;
    color: #a0a0a0;
    letter-spacing: 0.5px;
    pointer-events: none;
    user-select: none !important;
}

.page-zone-ph {
    align-self: center;
    color: #999;
    font-family: var(--work-font);
    font-size: 12px;
    text-align: center;
    padding: 5px 14px;
    margin: 2px 0;
    border: 1px dashed rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    opacity: 0.55;
    transition: opacity 0.15s, border-color 0.15s, background 0.15s, color 0.15s;
}
.page-zone-ph:hover {
    opacity: 1;
    color: #185FA5;
    border-color: rgba(55, 138, 221, 0.45);
    background: rgba(24, 95, 165, 0.06);
}
#a4-canvas.a4-read-mode .page-zone-ph { display: none; }
@media print { .page-zone-ph { display: none; } }
