* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #000000;
    --surface: #0a0a0a;
    --border: #222;
    --text: #e6edf3;
    --text-muted: #555;
    --primary: #fff;
    --primary-hover: #ccc;
    --error: #f85149;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
}

/* Two-column layout */
.layout {
    display: flex;
    min-height: 100vh;
}

.col-code {
    flex: 1;
    min-width: 0;
    border-right: 1px solid var(--border);
}

.col-sidebar {
    width: 300px;
    flex-shrink: 0;
}

.sidebar-inner {
    position: sticky;
    top: 0;
    padding: 28px 24px;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Buttons */
.btn {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 0;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: border-color 0.15s, background 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    border-color: var(--text-muted);
    background: #111;
}

.btn-primary {
    background: #fff;
    color: #000;
    border-color: #fff;
    font-weight: 600;
}

.btn-primary:hover {
    background: #ccc;
    border-color: #ccc;
}

.btn-small {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-full {
    width: 100%;
}

/* Form fields */
label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.field-group {
    display: flex;
    flex-direction: column;
}

select,
input[type="password"],
input[type="text"] {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 0;
    font-size: 0.875rem;
    outline: none;
    font-family: inherit;
    width: 100%;
}

select:focus,
input:focus {
    border-color: #555;
}

select {
    cursor: pointer;
}

/* CodeMirror - create */
#editor-wrap {
    height: 100vh;
    overflow: hidden;
}

#editor-wrap .CodeMirror {
    height: 100%;
    background: var(--surface);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* CodeMirror - view */
#view-editor {
    min-height: 100vh;
}

#view-editor .CodeMirror {
    min-height: 100vh;
    height: auto;
    background: var(--surface);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Share result */
.result {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.result label {
    margin-bottom: 0;
}

.result-row {
    display: flex;
    gap: 6px;
}

.result-row input {
    flex: 1;
    background: var(--bg);
    font-size: 0.8rem;
}

.hidden {
    display: none !important;
}

.error {
    padding: 10px 14px;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    color: var(--error);
    font-size: 0.875rem;
}

.expiry-note {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    margin-top: auto;
}

/* View sidebar */
.paste-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

.meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.meta-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.lang-badge {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 3px 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.lock-badge {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 3px 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

/* Password gate - centered overlay */
#password-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.gate-box {
    text-align: center;
    padding: 40px;
    max-width: 380px;
    width: 100%;
}

.gate-box h2 {
    font-size: 1.25rem;
    margin-bottom: 6px;
}

.gate-box p {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.password-form {
    display: flex;
    gap: 8px;
}

.password-form input {
    flex: 1;
}

/* Not Found */
.not-found {
    text-align: center;
    padding: 80px 20px;
}

.not-found h2 {
    margin-bottom: 8px;
    font-size: 1.5rem;
}

.not-found p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 700px) {
    .layout {
        flex-direction: column;
        min-height: auto;
    }

    .col-code {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    #editor-wrap {
        height: 50vh;
    }

    #view-editor {
        min-height: 50vh;
    }

    #view-editor .CodeMirror {
        min-height: 50vh;
    }

    .col-sidebar {
        width: 100%;
    }

    .sidebar-inner {
        position: static;
        height: auto;
        padding: 20px;
    }
}
