/* Sınavlarda kod renklendirme ve kod cevap alanı (exam-codehl.js). Live, Grade ve /Grade (öğrenci geri bildirimi) yükler. */
/* ---------- Kod renklendirme (Prism; renkler tema değişkenlerinden, açık/koyu temada okunur) ---------- */
.exam-code-pre,
.exam-code-editor__hl {
    font-family: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
    color: var(--text-primary);
    tab-size: 4;
}

.exam-code-pre .token.comment,
.exam-code-pre .token.prolog,
.exam-code-pre .token.doctype,
.exam-code-editor__hl .token.comment,
.exam-code-editor__hl .token.prolog,
.exam-code-editor__hl .token.doctype {
    color: var(--exam-muted-ink, var(--text-secondary));
    font-style: italic;
}

.exam-code-pre .token.keyword,
.exam-code-pre .token.atom,
.exam-code-pre .token.selector,
.exam-code-editor__hl .token.keyword,
.exam-code-editor__hl .token.atom,
.exam-code-editor__hl .token.selector {
    color: var(--exam-accent-ink, var(--accent-primary));
    font-weight: 700;
}

.exam-code-pre .token.string,
.exam-code-pre .token.char,
.exam-code-pre .token.attr-value,
.exam-code-pre .token.regex,
.exam-code-editor__hl .token.string,
.exam-code-editor__hl .token.char,
.exam-code-editor__hl .token.attr-value,
.exam-code-editor__hl .token.regex {
    color: var(--exam-ok-ink, var(--accent-success));
}

.exam-code-pre .token.number,
.exam-code-pre .token.boolean,
.exam-code-pre .token.constant,
.exam-code-pre .token.symbol,
.exam-code-editor__hl .token.number,
.exam-code-editor__hl .token.boolean,
.exam-code-editor__hl .token.constant,
.exam-code-editor__hl .token.symbol {
    color: var(--exam-warn-ink, var(--accent-warning));
}

.exam-code-pre .token.function,
.exam-code-pre .token.class-name,
.exam-code-pre .token.tag,
.exam-code-pre .token.builtin,
.exam-code-editor__hl .token.function,
.exam-code-editor__hl .token.class-name,
.exam-code-editor__hl .token.tag,
.exam-code-editor__hl .token.builtin {
    color: var(--exam-violet-ink, #8b5cf6);
}

.exam-code-pre .token.directive,
.exam-code-pre .token.important,
.exam-code-pre .token.attr-name,
.exam-code-editor__hl .token.directive,
.exam-code-editor__hl .token.important,
.exam-code-editor__hl .token.attr-name {
    color: var(--exam-bad-ink, var(--accent-danger));
}

.exam-code-pre .token.operator,
.exam-code-pre .token.punctuation,
.exam-code-editor__hl .token.operator,
.exam-code-editor__hl .token.punctuation {
    color: color-mix(in srgb, var(--text-secondary) 55%, var(--text-primary));
}

/* ---------- Kod cevap alanı: gerçek textarea üstte (saydam), renkli katman altta ---------- */
.exam-code-editor {
    position: relative;
    border-radius: 0.9rem;
    background: color-mix(in srgb, var(--text-primary) 6%, var(--bg-primary));
    box-shadow: var(--neu-page-inset, inset 3px 3px 6px rgba(0, 0, 0, 0.2));
    overflow: hidden;
}

.exam-code-editor__hl,
.exam-code-editor .exam-code-editor__input {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.8rem 1rem;
    border: 0;
    border-radius: 0;
    box-sizing: border-box;
    font-family: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
    font-size: 0.9rem;
    line-height: 1.55;
    letter-spacing: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    tab-size: 4;
}

.exam-code-editor__hl {
    min-height: 9rem;
    pointer-events: none;
    background: transparent;
    overflow: hidden;
}

.exam-code-editor__hl code {
    font: inherit;
    white-space: inherit;
}

/* Sitenin genel textarea kuralları (özgüllük daha yüksek) katmanla hizayı ve saydamlığı bozmasın: ölçüler ve zemin burada kesin */
.exam-code-editor .exam-code-editor__input {
    position: absolute !important;
    inset: 0;
    height: 100% !important;
    min-height: 0 !important;
    padding: 0.8rem 1rem !important;
    border: 0 !important;
    border-radius: 0 !important;
    resize: none !important;
    overflow: hidden !important;
    background: transparent !important;
    box-shadow: none !important;
    font-family: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace !important;
    font-size: 0.9rem !important;
    line-height: 1.55 !important;
    letter-spacing: 0 !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    white-space: pre-wrap !important;
    color: transparent !important;
    -webkit-text-fill-color: transparent;
    caret-color: var(--text-primary);
}

.exam-code-editor .exam-code-editor__input::placeholder {
    -webkit-text-fill-color: var(--exam-muted-ink, var(--text-secondary));
    color: var(--exam-muted-ink, var(--text-secondary));
}

.exam-code-editor .exam-code-editor__input:focus {
    outline: 2px solid color-mix(in srgb, var(--accent-primary) 70%, transparent);
    outline-offset: -2px;
}

/* Prism yüklenemedi: katman gizlenir, metin textarea'da düz görünür */
.exam-code-editor.is-plain .exam-code-editor__hl {
    visibility: hidden;
}

.exam-code-editor.is-plain .exam-code-editor__input {
    color: var(--text-primary) !important;
    -webkit-text-fill-color: var(--text-primary);
}

/* iOS: 16px altı yazı alanına odaklanınca sayfayı yakınlaştırır; iki katman aynı boyutta kalmalı */
@media (pointer: coarse) {
    .exam-code-editor__hl,
    .exam-code-editor .exam-code-editor__input {
        font-size: 16px !important;
    }
}
