:root {
    --card: #fff;
    --border: #e5e7eb;
    --bg: #f7fafc;
    --fg: #0f172a;
    --muted: #64748b;
    --accent: #0f172a;
}

html,
body {
    margin: 0;
    background: linear-gradient(135deg, #eef2ff, #ffffff 50%, #ecfeff);
    min-height: 100vh;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--fg);
    font: 16px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
        Arial;
}

.wrap {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
}

h1 {
    margin: 0 0 6px;
    font-size: 24px;
}

h3 {
    margin: 0 0 8px;
}

.small {
    font-size: 12px;
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 14px;
}

@media (min-width: 980px) {
    .grid {
        grid-template-columns: 1fr 1fr;
    }
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04);
}

.pad {
    padding: 16px;
}

textarea,
input,
select,
button {
    font: inherit;
}

textarea {
    width: 100%;
    min-height: 350px;
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    background: #fff;
}

input,
select {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    background: #fff;
}

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

button {
    cursor: pointer;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    padding: 8px 12px;
}

button.secondary {
    background: #fff;
    color: var(--fg);
    border: 1px solid var(--border);
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", monospace;
}

.template {
    white-space: pre-wrap;
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 10px;
    background: #f8fafc;
}

.out {
    min-height: 120px;
}

.pill {
    display: inline-block;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    margin: 2px;
}

.pillchip.PLOT {
    background: #e0f2fe;
    border-color: #bae6fd;
}

.pillchip.SIGNAL {
    background: #fde68a;
    border-color: #fcd34d;
}

.hl {
    padding: 0 3px;
    border-radius: 6px;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.hl.PLOT {
    background: #e0f2fe;
}

.hl.SIGNAL {
    background: #fde68a;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: #fff;
}

.pillchip {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
}

.list {
    max-height: 200px;
    overflow: auto;
}

.ann-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    border-top: 1px dashed var(--border);
    padding-top: 8px;
    margin-top: 8px;
}

.flow {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    overflow: auto;
}

#preview {
    font-size: 13px;
    max-height: 200px;
    overflow: auto;
}

#textInput {
    max-width: 93%;
    /* eller prøv fx 700px for fast bredde */
    margin: 0 auto;
    /* centrer inden for parent-div’en */
    display: block;
    /* så margin: auto virker */
    font-family: "IM Fell English", "EB Garamond", Georgia,
        "Times New Roman", serif;
    font-size: 16px;
    line-height: 1.6;
    color: #2b2a27;

    /* Pergament-lignende baggrund uden billeder */
    background: radial-gradient(120% 100% at 0% 0%,
            rgba(255, 255, 255, 0.7) 0%,
            rgba(255, 255, 255, 0) 60%),
        radial-gradient(120% 100% at 100% 100%,
            rgba(0, 0, 0, 0.06) 0%,
            rgba(0, 0, 0, 0) 60%),
        linear-gradient(to bottom, #f7f1e3, #f3ead7);
    border: 1px solid #d6ccb3;
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 40px 60px rgba(255, 255, 255, 0.35),
        0 1px 0 rgba(0, 0, 0, 0.03);
    padding: 22px 18px;

    /* Små typografiske detaljer */
    caret-color: #7a5c30;
    letter-spacing: 0.01em;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    /* Gør afsnit pænere at skrive */
    hyphens: auto;
    white-space: pre-wrap;
    /* bevar linjeskift */
    overflow-wrap: anywhere;
    /* undgå horizontalt scroll */
}

/* Placeholder i antikt look */
#textInput::placeholder {
    color: #9a8f7a;
    font-style: italic;
}

/* Fokusramme i varm tone */
#textInput:focus {
    outline: 2px solid #d9c7a1;
    outline-offset: 2px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
}

.icon-btn.secondary {
    background: #fff;
    color: var(--fg);
    border: 1px solid var(--border);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 1px, 1px);
    white-space: nowrap;
    border: 0;
}

button:disabled,
.label-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    /* blocks clicks */
}