
/* reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0f0f0f;
    --bg2:       #1a1a1a;
    --bg3:       #222;
    --border:    #2e2e2e;
    --text:      #d4d4d4;
    --text-dim:  #666;
    --accent:    #e8e8e8;
    --green:     #4ec994;
    --font-mono: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body { height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
}

.global-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
}

.global-header strong { color: var(--accent); }

.upload-main {
    display: flex;
    justify-content: center;
    padding: 60px 20px;
}

.upload-inner { width: 100%; max-width: 560px; }

.upload-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
    font-family: var(--font-mono);
}

.upload-desc { color: var(--text-dim); font-size: 14px; margin-bottom: 32px; }

.alert {
    background: #2a1a1a;
    border: 1px solid #6b2020;
    color: #f87171;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 20px;
}

.drop-zone {
    border: 1px dashed var(--border);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin-bottom: 32px;
}

.drop-zone:hover,
.drop-zone.drag-over { border-color: #555; background: var(--bg2); }

.drop-zone input[type="file"] { display: none; }
.drop-label { color: var(--text-dim); font-size: 14px; }
.drop-file  { margin-top: 8px; font-family: var(--font-mono); font-size: 13px; color: var(--green); }

.form-section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-dim);
    margin-bottom: 16px;
    font-family: var(--font-mono);
}

.field { margin-bottom: 14px; }

.field label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 5px;
    font-family: var(--font-mono);
}

.req { color: #f87171; }

.field input {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 12px;
    font-size: 14px;
    font-family: var(--font-mono);
    outline: none;
    transition: border-color .15s;
}

.field input:focus { border-color: #555; }

.btn-submit {
    margin-top: 24px;
    background: var(--accent);
    color: #0f0f0f;
    border: none;
    padding: 11px 28px;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: opacity .15s;
}

.btn-submit:hover { opacity: .85; }

/* Editor */
.editor-page { overflow: hidden; }
.editor-layout { display: flex; height: 100vh; }

.side {
    width: 280px;
    min-width: 280px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.side-logo {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-dim);
}

.side-logo strong { color: var(--accent); }

.side-section { padding: 16px; border-bottom: 1px solid var(--border); }

.side-step {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.file-list { list-style: none; }

.file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}

.file-name {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.file-row select {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 3px 6px;
    outline: none;
}

.radio-list { display: flex; flex-direction: column; gap: 10px; }

.radio-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    font-family: var(--font-mono);
}

.tab-list { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }

.tab-btn {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 4px 10px;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.tab-btn:hover  { background: #2a2a2a; color: var(--text); }
.tab-btn.active { background: var(--accent); color: #0f0f0f; border-color: var(--accent); }

.sel-status { display: flex; gap: 12px; margin-bottom: 8px; }
.sel-item { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.sel-item.ok { color: var(--green); }

.side-hint { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

.side-bottom {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--border);
}

.btn-convert {
    width: 100%;
    background: var(--accent);
    color: #0f0f0f;
    border: none;
    padding: 11px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s;
}

.btn-convert:disabled             { opacity: .3; cursor: not-allowed; }
.btn-convert:not(:disabled):hover { opacity: .85; }

.convert-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    text-align: center;
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 42px;
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
    flex-shrink: 0;
}

.toolbar-file { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); }
.view-toggle  { display: flex; gap: 4px; }

.toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 5px 14px;
    cursor: pointer;
    transition: all .15s;
}

.toggle-btn:hover  { color: var(--text); }
.toggle-btn.active { background: var(--bg3); color: var(--accent); border-color: #444; }

.view-panel { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.view-panel.hidden { display: none; }

#previewFrame { flex: 1; border: none; width: 100%; background: #fff; }

.source-pre {
    flex: 1;
    overflow: auto;
    padding: 24px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    white-space: pre;
    cursor: text;
    user-select: text;
    tab-size: 2;
}

.sel-tooltip {
    position: absolute;
    z-index: 100;
    background: var(--bg3);
    border: 1px solid var(--border);
    display: flex;
    gap: 1px;
    box-shadow: 0 4px 12px rgba(0,0,0,.5);
}

.sel-tooltip.hidden { display: none; }

.sel-tooltip button {
    background: var(--bg3);
    border: none;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 7px 16px;
    cursor: pointer;
    transition: background .1s;
}

.sel-tooltip button:hover { background: #2e2e2e; color: var(--accent); }
