/* Manga → X3 — same plain high-contrast language as the rest of the site:
   white paper, black serif text, blue links, red working accents. */

.manga-to-xteink-shell {
    max-width: 860px;
    margin: 0 auto;
    padding-top: 10px;
}

.manga-to-xteink-shell h1 {
    margin-bottom: 2px;
}

.subtitle {
    margin-top: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #555555;
}

.intro {
    max-width: 640px;
}

/* --- dropzone --- */

.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 34px 20px;
    border: 2px dashed #000000;
    background: #ffffff;
    text-align: center;
    font-family: var(--font-mono);
}

.dropzone.drag {
    border-color: #cc0000;
    background: #fff0f0;
}

.dropzone span {
    color: #777777;
    font-size: 0.8rem;
}

.dropzone small {
    color: #666666;
    font-size: 0.72rem;
}

.dropzone-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.file-button {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #000000;
    background: #ffffff;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.14);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.file-button:hover {
    background: #cc0000;
    color: #ffffff;
}

.file-button input {
    display: none;
}

/* --- device picker --- */

.device-picker {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin: 0 0 12px;
    font-family: var(--font-mono);
}

.device-label {
    align-self: center;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #cc0000;
    margin-right: 2px;
}

.device-choice {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 7px 14px;
    border: 1px solid #000000;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.14);
}

.device-choice input {
    display: none;
}

.device-choice small {
    color: #666666;
    font-size: 0.72rem;
}

.device-choice:hover {
    border-color: #cc0000;
}

.device-choice.active {
    background: #0000ff;
    border-color: #0000ff;
    color: #ffffff;
    box-shadow: none;
}

.device-choice.active small {
    color: #ccccff;
}

/* --- settings --- */

.advanced {
    border: 1px solid #000000;
    background: #ffffff;
    margin: 12px 0 18px;
}

.advanced summary {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 12px;
    cursor: pointer;
    font-family: var(--font-mono);
}

.advanced summary:hover .advanced-title {
    color: #cc0000;
}

.advanced-title {
    font-size: 0.78rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.advanced-summary {
    font-size: 0.75rem;
    color: #666666;
}

.advanced[open] .advanced-summary {
    display: none;
}

.advanced .settings {
    margin: 0;
    padding: 4px 12px 12px;
}

.settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.settings fieldset {
    border: 1px solid #000000;
    padding: 10px 12px;
    margin: 0;
    background: #ffffff;
}

.settings legend {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #cc0000;
    padding: 0 6px;
}

.option {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
    line-height: 1.35;
}

.option input {
    margin-right: 6px;
}

.option small {
    display: block;
    margin-left: 22px;
    color: #666666;
    font-size: 0.78rem;
}

.option.disabled {
    opacity: 0.45;
    cursor: default;
}

.option.inline {
    display: inline-block;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* --- actions --- */

.actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin: 16px 0 20px;
}

.actions-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.actions button {
    padding: 8px 16px;
    border: 1px solid #000000;
    background: #ffffff;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.14);
}

.actions button.primary {
    background: #0000ff;
    color: #ffffff;
    border-color: #0000ff;
}

.actions button:hover:not(:disabled) {
    background: #cc0000;
    border-color: #cc0000;
    color: #ffffff;
}

.actions button:disabled {
    opacity: 0.4;
    cursor: default;
    box-shadow: none;
}

/* --- job list --- */

.jobs {
    list-style: none;
    padding: 0;
    margin: 0 0 30px;
}

.job {
    border: 1px solid #000000;
    background: #ffffff;
    margin-bottom: 10px;
    padding: 8px 12px;
}

.job.error {
    border-color: #cc0000;
}

.job-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.job-info {
    flex: 1 1 auto;
    min-width: 180px;
    display: flex;
    flex-direction: column;
}

.job-name {
    font-weight: bold;
    word-break: break-all;
}

.job-sizes {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #555555;
}

.job button {
    padding: 4px 10px;
    border: 1px solid #000000;
    background: #ffffff;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
}

.job button:hover {
    background: #cc0000;
    color: #ffffff;
}

.job button.remove {
    border: none;
    font-size: 1rem;
    padding: 0 6px;
    background: transparent;
    color: #999999;
}

.job button.remove:hover {
    color: #cc0000;
    background: transparent;
}

.badge {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 8px;
    border: 1px solid #999999;
    color: #666666;
    white-space: nowrap;
}

.badge.working {
    border-color: #0000ff;
    color: #0000ff;
}

.badge.done {
    border-color: #007700;
    color: #007700;
}

.badge.stale {
    border-color: #aa6600;
    color: #aa6600;
    text-transform: none;
}

.badge.error {
    border-color: #cc0000;
    color: #cc0000;
    text-transform: none;
    white-space: normal;
}

.warnings {
    margin: 6px 0 0;
    padding-left: 30px;
    font-size: 0.8rem;
    color: #aa6600;
}

/* --- page previews --- */

.preview-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 6px;
    margin-top: 8px;
}

.preview-strip img {
    width: 76px;
    height: 114px;
    object-fit: contain;
    border: 1px solid #cccccc;
    background: #ffffff;
    image-rendering: pixelated;
}

.page-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.page-thumb:disabled {
    cursor: default;
}

.page-thumb:hover:not(:disabled) img {
    border-color: #cc0000;
}

.page-thumb.edited img {
    border-color: #0000ff;
}

.thumb-num {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: #888888;
}

.page-thumb.edited .thumb-num {
    color: #0000ff;
}

.edit-hint {
    margin: 4px 0 0;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: #888888;
}

.link-button {
    border: none;
    background: transparent;
    color: #0000ff;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 0 4px;
}

.link-button:hover {
    text-decoration: underline;
}

/* --- page editor --- */

.editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 1000;
}

.editor {
    background: #ffffff;
    border: 2px solid #000000;
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.3);
    width: min(980px, 100%);
    height: calc(100vh - 36px);
    max-height: 900px;
    display: flex;
    flex-direction: column;
}

.editor-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 12px;
    border-bottom: 1px solid #000000;
}

.editor-title {
    word-break: break-all;
    font-size: 0.95rem;
}

.editor-pageno {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #555555;
    white-space: nowrap;
}

.editor-key-hint {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: #0000ff;
    white-space: nowrap;
}

.editor-zoom {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.editor-nav {
    display: flex;
    gap: 4px;
}

.zoom-button,
.editor-nav button {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 3px 8px;
    border: 1px solid #000000;
    background: #ffffff;
    cursor: pointer;
}

.zoom-button:hover,
.editor-nav button:hover:not(:disabled) {
    background: #cc0000;
    border-color: #cc0000;
    color: #ffffff;
}

.zoom-button.active {
    background: #000000;
    color: #ffffff;
}

.editor-nav button:disabled {
    opacity: 0.35;
    cursor: default;
}

.editor-close {
    border: none;
    background: transparent;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    color: #999999;
    padding: 0 4px;
}

.editor-close:hover {
    color: #cc0000;
}

.editor-body {
    display: flex;
    gap: 14px;
    padding: 12px;
    flex: 1 1 auto;
    min-height: 0;
}

.editor-canvas-wrap {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    background: #eeeeee;
    border: 1px solid #000000;
    display: flex;
}

#editor-canvas {
    display: block;
    margin: auto; /* centers when smaller, scrolls cleanly when zoomed in */
    background: #ffffff;
    border: 1px solid #cccccc;
}

.zoom-fit #editor-canvas {
    max-width: calc(100% - 16px);
    max-height: calc(100% - 16px);
    width: auto;
    height: auto;
}

/* zoom-100 / zoom-200 pixel sizes are set inline by the editor,
   since they depend on the selected device's panel resolution */
.zoom-100 #editor-canvas,
.zoom-200 #editor-canvas {
    image-rendering: pixelated;
}

.editor-controls {
    flex: 0 0 252px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}

.editor-controls fieldset {
    border: 1px solid #000000;
    padding: 8px 10px;
    margin: 0;
    background: #ffffff;
}

.editor-controls legend {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #cc0000;
    padding: 0 6px;
}

.editor-controls .option {
    margin-bottom: 5px;
    font-size: 0.88rem;
}

.editor-note {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: #aa6600;
}

.editor-field-note {
    display: block;
    margin-top: 5px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    line-height: 1.35;
    color: #666666;
}

.slider {
    display: block;
    margin-bottom: 8px;
    cursor: pointer;
}

.slider span {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #333333;
}

.slider input[type='range'] {
    width: 100%;
}

.slider.disabled {
    opacity: 0.45;
    cursor: default;
}

.editor-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.editor-actions button {
    padding: 7px 10px;
    border: 1px solid #000000;
    background: #ffffff;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.14);
}

.editor-actions button.primary {
    background: #0000ff;
    color: #ffffff;
    border-color: #0000ff;
}

.editor-actions button.apply-all {
    border-color: #0000ff;
    color: #0000ff;
}

.editor-actions button:hover:not(:disabled) {
    background: #cc0000;
    border-color: #cc0000;
    color: #ffffff;
}

.editor-actions button:disabled {
    opacity: 0.45;
    cursor: default;
    box-shadow: none;
}

.editor-status {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #555555;
    min-height: 1.2em;
    margin: 0;
}

.editor-status.working { color: #0000ff; }
.editor-status.dirty { color: #aa6600; }
.editor-status.done { color: #007700; }
.editor-status.error { color: #cc0000; }

@media (max-width: 760px) {
    .editor-body {
        flex-direction: column;
        overflow-y: auto;
    }

    .editor-canvas-wrap {
        flex: none;
        height: 55vh;
    }

    .editor-controls {
        flex: none;
        overflow: visible;
    }
}

/* --- notes --- */

.notes {
    border-top: 1px solid #000000;
    padding-top: 10px;
    max-width: 700px;
}

.notes h2 {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #cc0000;
}

.notes li {
    margin-bottom: 8px;
    font-size: 0.92rem;
}

@media (max-width: 600px) {
    body {
        padding: 15px;
    }
}
