:root {
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-soft: #dbeafe;
    --primary-text: #ffffff;
    --ok: #16a34a;
    --ok-soft: #dcfce7;
    --bad: #dc2626;
    --bad-soft: #fee2e2;
    --warn: #b45309;
    --warn-soft: #fef3c7;
    --radius: 14px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f172a;
    --card: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #334155;
    --primary-soft: #1e3a8a;
    --ok-soft: #14532d;
    --bad-soft: #7f1d1d;
    --warn: #fbbf24;
    --warn-soft: #422006;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary); }
h1 { font-size: 1.35rem; margin: 0 0 6px; }
h2 { font-size: 1.1rem; margin: 0 0 10px; }
p { margin: 0 0 12px; }
code { font-size: .95em; background: var(--bg); padding: 1px 6px; border-radius: 6px; }
.hidden { display: none !important; }

/* Telefonda tarayıcıdan açıldığında yalnızca tanıtım ekranı görünür */
html.gated .app-only { display: none !important; }
html:not(.gated) .gate-only { display: none !important; }

/* ---- Üst çubuk ve alt menü ---- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; }
.brand img { border-radius: 7px; }
.user { display: flex; align-items: center; gap: 12px; font-size: .9rem; min-width: 0; }
.user a { color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user form { margin: 0; }

/* ---- Menü: telefonda alt çubuk, geniş ekranda sol kenar çubuğu ---- */
.appnav a { text-decoration: none; }
.appnav .ico { display: flex; align-items: center; justify-content: center; font-style: normal; }
.nav-item { color: var(--muted); font-weight: 600; transition: background .2s, color .2s; }
.nav-item.active { color: var(--primary); }
:root[data-theme="dark"] .nav-item.active { color: #bfdbfe; }
.nav-item.fab { color: #fff; background: var(--primary); }

@media (max-width: 759px) {
    .appnav {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: 20px;
        z-index: 20;
        display: flex;
        flex-direction: column;
        padding: 0;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 26px;
        overflow: hidden;
        box-shadow: 0 10px 30px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .08);
    }
    :root[data-theme="dark"] .appnav { box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
    .nav-brand, .nav-user { display: none; }
    .nav-item {
        flex: 1 1 0;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 2px 1px;
        font-size: .68rem;
        line-height: 1.2;
    }
    .nav-item .ico { width: 100%; max-width: 52px; height: 30px; border-radius: 999px; transition: background .2s; }
    .nav-item .ico svg { width: 21px; height: 21px; }
    .nav-item.active .ico { background: var(--primary-soft); }
    .nav-item .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .nav-item .lbl[data-short] { font-size: 0; }
    .nav-item .lbl[data-short]::after { content: attr(data-short); font-size: .68rem; }
    .nav-row { display: flex; align-items: center; }
    .nav-main { order: 2; padding: 6px 4px; }
    /* Yukarı kaydırınca açılan ikinci satır (5'ten fazla öğe olduğunda) */
    .nav-more {
        order: 1;
        justify-content: center;
        max-height: 0;
        padding: 0 4px;
        opacity: 0;
        border-bottom: 1px solid transparent;
        transition: max-height .25s ease, padding .25s ease, opacity .2s ease, border-color .25s;
    }
    .nav-more .nav-item { flex: 0 0 20%; }
    .appnav.open .nav-more { max-height: 90px; padding: 2px 4px 8px; opacity: 1; border-bottom-color: var(--border); }
    .appnav { touch-action: none; overscroll-behavior: contain; }
    /* Tutamaç: geniş dokunma alanı */
    .nav-handle { order: 0; display: flex; justify-content: center; align-items: center; width: 100%; height: 22px; padding: 4px 0 0; border: 0; background: none; cursor: pointer; }
    .nav-handle span { width: 40px; height: 5px; border-radius: 2px; background: var(--border); transition: background .2s; }
    :root[data-theme="dark"] .nav-handle span { background: #475569; }
    .nav-handle + .nav-main { padding-top: 0; }
    /* Yeni sınav düğmesi: çubuğun içinde dolu daire */
    .nav-item.fab { flex: 0 0 auto; width: 46px; height: 46px; margin: 0 6px; padding: 0; justify-content: center; border-radius: 50%; box-shadow: 0 4px 12px rgba(37, 99, 235, .35); }
    .nav-item.fab .ico { width: auto; height: auto; background: none; }
    .nav-item.fab svg { width: 24px; height: 24px; }
    .nav-item.fab .lbl { display: none; }
    .nav-item.fab.active { box-shadow: 0 0 0 3px var(--primary-soft); }
    .has-nav .container { padding-bottom: 120px; }
}

@media (min-width: 760px) {
    /* Kenar çubuğunda satırlar tek liste olur, çekmece tutamacı gizlenir */
    .nav-row { display: contents; }
    .nav-handle { display: none; }
    .has-nav { padding-left: 240px; }
    .has-nav .topbar { display: none; }
    .appnav {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 20;
        width: 240px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: calc(env(safe-area-inset-top) + 18px) 14px 16px;
        background: var(--card);
        border-right: 1px solid var(--border);
        overflow-y: auto;
    }
    .nav-brand { order: -2; display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; color: var(--text); font-weight: 700; }
    .nav-brand img { border-radius: 8px; }
    .nav-item { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 12px; font-size: .95rem; }
    .nav-item:hover { background: var(--bg); color: var(--text); }
    .nav-item.active { background: var(--primary-soft); }
    .nav-item.fab { order: -1; justify-content: center; margin-bottom: 12px; gap: 8px; }
    .nav-item.fab:hover { background: var(--primary); color: #fff; filter: brightness(1.08); }
    .nav-user { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; font-size: .9rem; }
    .nav-user form { margin: 0; }
    .nav-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px);
}
.login, .narrow { max-width: 440px; margin: 0 auto; }
.login { padding-top: 4vh; }
.login-card { padding: 28px 24px 20px; }
.login-card .app-icon { margin: 0 0 12px; }
.login-card h1 { margin: 0 0 4px; }
.login-card .lead { margin: 0 0 20px; }
.login-card .stack { gap: 14px; }
.login-card .btn.primary { margin-top: 4px; }
.login-card .foot { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---- Kartlar ve düzen ---- */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}
.card.error { border-color: var(--bad); color: var(--bad); }
.card.success { border-color: var(--ok); }
.highlight-card { border-color: var(--primary); }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.app-icon { border-radius: 16px; margin: 4px 0 10px; }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; font-size: .9rem; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

.row { display: flex; gap: 10px; margin: 12px 0; align-items: center; }
.row > .btn, .row > label.btn { flex: 1; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { flex: none; }
.row form { margin: 0; }
.row input { flex: 1; }

.grid-2 { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; white-space: pre-line; }
.alert.success { background: var(--ok-soft); color: var(--ok); }
.alert.error { background: var(--bad-soft); color: var(--bad); }
:root[data-theme="dark"] .alert.success, :root[data-theme="dark"] .alert.error { color: var(--text); }
.warn { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 10px; font-size: .92rem; }
.note { font-size: .9rem; background: var(--bg); border-radius: 10px; padding: 10px 12px; text-align: left; }
.note.success { color: var(--ok); }

/* ---- Butonlar ve formlar ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 34px; padding: 4px 12px; font-size: .88rem; border-radius: 10px; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; }
.link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label, label.quick { display: flex; flex-direction: column; gap: 4px; font-size: .92rem; font-weight: 600; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; }
textarea { resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
.check-row { flex-direction: row !important; align-items: center; gap: 10px !important; font-weight: 400 !important; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; font-weight: 400 !important; flex-direction: row !important; }
.search { max-width: 260px; }

/* ---- Listeler ---- */

.list { list-style: none; margin: 0; padding: 0; }
.list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
}
.list li:first-child { border-top: 0; }
.list li > a, .list li > span:first-child { display: flex; flex-direction: column; min-width: 0; color: var(--text); text-decoration: none; }
.list li form { margin: 0; }
.list.compact li { padding: 7px 0; }
.list .actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.list li .check { color: var(--ok); font-weight: 700; visibility: hidden; }
.list li.done .check { visibility: visible; }
.list li.done { color: var(--muted); }
.list li[hidden] { display: none; }

.badge { flex: none; display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: .8rem; font-weight: 600; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.score { font-size: 1.3rem; font-weight: 700; color: var(--primary); }

.features { padding-left: 20px; margin: 0 0 10px; }
.features li { margin-bottom: 8px; }

details > summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: 10px; }
.class-group[hidden] { display: none; }

/* ---- İstatistik, tablo, karşılaştırma ---- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; text-align: center; margin: 10px 0; }
.stats div { background: var(--bg); border-radius: 10px; padding: 8px 4px; display: flex; flex-direction: column; }
.stats span { font-size: .75rem; color: var(--muted); }
.stats b { font-size: 1.2rem; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }
tr.absent td { color: var(--muted); }

.compare { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.compare-head { display: none; }
.compare-row {
    display: grid;
    grid-template-columns: 2.2em 1fr 1fr auto;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--bg);
    font-size: .92rem;
}
.compare-row span:first-child { color: var(--muted); }
.compare-row span:nth-child(3) { color: var(--muted); }
.compare-row span:nth-child(3)::before { content: "→ "; }
.compare-row.ok { background: var(--ok-soft); color: var(--text); }
.compare-row.bad { background: var(--bad-soft); color: var(--text); }
.compare-row .mark { font-weight: 700; font-size: .85rem; }
.compare-row.ok .mark { color: var(--ok); }
.compare-row.bad .mark { color: var(--bad); }
.compare-row.blank .mark { color: var(--muted); font-weight: 400; }
:root[data-theme="dark"] .compare-row.ok .mark, :root[data-theme="dark"] .compare-row.bad .mark { color: var(--text); }

/* ---- Cevap anahtarı ---- */

.key-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 18px; margin-top: 12px; }
.key-row { display: flex; align-items: center; gap: 4px; }
.key-row > span { width: 2.2em; text-align: right; color: var(--muted); font-size: .9rem; margin-right: 4px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.opt span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    font-size: .85rem;
    font-weight: 600;
    color: var(--muted);
}
.opt input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.opt input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.sticky-save { position: sticky; bottom: 0; padding: 12px 0 calc(env(safe-area-inset-bottom) + 12px); background: linear-gradient(transparent, var(--bg) 35%); }
.sticky-save .btn { width: 100%; }

/* ---- Optik okutma ---- */

.preview canvas { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ok); margin: 0 2px 0 8px; }
.dot.multi { border-color: var(--bad); }
.answer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; margin-top: 10px; }
.answer-grid div { display: flex; justify-content: space-between; padding: 4px 8px; border-radius: 8px; background: var(--bg); font-size: .9rem; }
.answer-grid span { color: var(--muted); }
.answer-grid .blank b { color: var(--muted); }
.answer-grid .multi { color: var(--bad); }

.spinner {
    display: inline-block;
    flex: none;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: -3px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Tanıtım / kurulum ekranı ---- */

#install-btn { width: 100%; margin: 8px 0 4px; }
.steps { text-align: left; margin-top: 12px; }
.steps ol { padding-left: 22px; margin: 0 0 12px; }
.steps li { margin-bottom: 8px; }
.key { vertical-align: -3px; color: var(--primary); }
.steps.highlight { animation: pulse 1.2s ease 2; border-radius: 10px; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 transparent; }
    50% { box-shadow: 0 0 0 4px var(--primary); }
}
#install-hint { margin-top: 8px; color: var(--primary); font-weight: 600; }

.link-card {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    color: var(--text);
    text-decoration: none;
}

/* ---- Sınav formu ---- */

.segmented { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented label { position: relative; flex-direction: row !important; font-weight: 600 !important; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 6px 14px; border-radius: 9px; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); }
/* Tam genişlik: sekmeler eşit bölünür */
.segmented.full { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; width: 100%; }
.segmented.full label { display: block !important; }
.segmented.full span { text-align: center; padding: 9px 12px; }
.segmented.full.three { grid-template-columns: 1fr 1fr 1fr; }
fieldset[hidden], div[hidden], .booklet-pane[hidden] { display: none !important; }
textarea.plain { font-family: inherit; font-size: 1rem; }
.sections { display: flex; flex-direction: column; gap: 8px; }
.section-row { display: grid; grid-template-columns: 1fr 90px auto; gap: 8px; align-items: center; }
.section-row input[type=number] { text-align: center; }
.error-note { background: var(--bad-soft); color: var(--bad); }
:root[data-theme="dark"] .error-note { color: var(--text); }
.note { white-space: pre-line; }
.wide-form { max-width: 560px; }
.description { white-space: pre-line; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.badge.kind { background: var(--primary-soft); color: var(--primary); vertical-align: 2px; }
:root[data-theme="dark"] .badge.kind { color: #bfdbfe; }
.badge.ok-badge { background: var(--ok-soft); color: var(--ok); }
.block { display: block; }
.list li.stacked { flex-direction: column; align-items: stretch; }
.list-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.list li.stacked .description { margin: 8px 0 0; }
.score-input { width: 90px !important; text-align: center; }
.card.warn-card { border-color: var(--warn); }
h3 { font-size: .95rem; margin: 14px 0 6px; color: var(--muted); }

.legend { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.legend span { background: var(--bg); border-radius: 8px; padding: 4px 10px; font-size: .9rem; }
.score-input.invalid { outline: 2px solid var(--bad); }
.badge.status { background: var(--warn-soft); color: var(--warn); }

/* Yazılı sınav notları: 5 Pekiyi ... 1 Geçmez; durumlar: Kopya siyah, Girmedi mavi, Muaf yeşil */
.grade { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 700; font-size: .92rem; white-space: nowrap; }
.score .grade { font-size: 1rem; }
.stats .grade { font-size: 1.05rem; }
.grade.g5 { background: #15803d; color: #fff; }
.grade.g4 { background: #bbf7d0; color: #14532d; }
.grade.g3 { background: #fef08a; color: #713f12; }
.grade.g2 { background: #fed7aa; color: #7c2d12; }
.grade.g1 { background: #dc2626; color: #fff; }
.grade.st-kopya { background: #111827; color: #fff; }
.grade.st-girmedi { background: #2563eb; color: #fff; }
.grade.st-muaf { background: #16a34a; color: #fff; }
:root[data-theme="dark"] .grade.g4 { background: #166534; color: #dcfce7; }
:root[data-theme="dark"] .grade.g3 { background: #854d0e; color: #fef9c3; }
:root[data-theme="dark"] .grade.g2 { background: #9a3412; color: #ffedd5; }
:root[data-theme="dark"] .grade.st-kopya { background: #000; color: #fff; box-shadow: inset 0 0 0 1px #475569; }
/* Puan giriş kutusu da girilen değere göre renklenir */
.score-input.g5, .score-input.g4, .score-input.g3, .score-input.g2, .score-input.g1,
.score-input.st-kopya, .score-input.st-girmedi, .score-input.st-muaf { font-weight: 700 !important; border-color: transparent !important; }
.score-input.g5 { background: #15803d !important; color: #fff !important; }
.score-input.g4 { background: #bbf7d0 !important; color: #14532d !important; }
.score-input.g3 { background: #fef08a !important; color: #713f12 !important; }
.score-input.g2 { background: #fed7aa !important; color: #7c2d12 !important; }
.score-input.g1 { background: #dc2626 !important; color: #fff !important; }
.score-input.st-kopya { background: #111827 !important; color: #fff !important; }
.score-input.st-girmedi { background: #2563eb !important; color: #fff !important; }
.score-input.st-muaf { background: #16a34a !important; color: #fff !important; }
:root[data-theme="dark"] .score-input.g4 { background: #166534 !important; color: #dcfce7 !important; }
:root[data-theme="dark"] .score-input.g3 { background: #854d0e !important; color: #fef9c3 !important; }
:root[data-theme="dark"] .score-input.g2 { background: #9a3412 !important; color: #ffedd5 !important; }
:root[data-theme="dark"] .score-input.st-kopya { background: #000 !important; box-shadow: inset 0 0 0 1px #475569; }
.legend .grade { font-size: .85rem; }
.stack.sub { padding-left: 28px; gap: 8px; }
.grid-2.tight { gap: 8px; }
@media (min-width: 480px) { .grid-2.tight { grid-template-columns: 1fr 1fr; } }

/* ---- Ayarlar: açma/kapama anahtarı ---- */

.switch-row { flex-direction: row !important; align-items: center; justify-content: space-between; gap: 16px; font-weight: 400 !important; }
.switch-row b { font-size: 1rem; }
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 50px !important; height: 30px !important; border-radius: 999px; background: var(--border); position: relative; cursor: pointer; transition: background .15s; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
input.switch:checked { background: var(--ok); }
input.switch:checked::after { transform: translateX(20px); }
input.switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sub-options { gap: 10px !important; padding-left: 4px; transition: opacity .15s; }
.sub-options.disabled { opacity: .45; pointer-events: none; }
.badge.this-device { background: var(--ok-soft); color: var(--ok); vertical-align: 1px; }

/* ---- Optik düzenleyici ---- */

.editor-canvas { width: 100%; height: auto; display: block; border-radius: 8px; border: 1px solid var(--border); background: #fff; margin-bottom: 8px; }
.editor-layout { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) {
    .editor-layout { grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); align-items: start; }
    .editor-view { position: sticky; top: 110px; }
    .container:has(.editor-layout) { max-width: 1280px; }
}
.field-list { display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow-y: auto; margin-bottom: 10px; }
.field-card { border: 1.5px solid var(--border); border-radius: 12px; padding: 10px; cursor: pointer; }
.field-card.selected { border-color: var(--bad); }
.field-card.weak:not(.selected) { border-color: var(--warn); }
.field-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.field-grid label { display: flex; flex-direction: column; gap: 2px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.field-grid input, .field-grid select { padding: 6px 8px !important; font-size: .9rem !important; }
.field-grid .span-2 { grid-column: 1 / -1; }
.field-card .row { margin: 8px 0 0; }

/* Oluşturulan hesap şifrelerini yazdırırken yalnızca o kart çıksın */
@media print {
    .topbar, .appnav, .card:not(.highlight-card), .grid-2, .btn, h1 { display: none !important; }
    body, .card { background: #fff; color: #000; border: 0; }
}

/* ---- Deneme analizi ---- */
.viz-root, .stat-grid {
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --chart-grid: #e5e7eb;
}
:root[data-theme="dark"] .viz-root, :root[data-theme="dark"] .stat-grid {
    --series-1: #3987e5;
    --series-2: #d95926;
    --chart-grid: #334155;
}
#analysis-type { margin-top: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 14px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-value .trend { font-size: .75em; }
.stat-value.up .trend { color: var(--ok); }
.stat-value.down .trend { color: var(--bad); }
.stat-sub { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .85rem; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: currentColor; flex: none; }
.key.s1 { background: var(--series-1); }
.key.s2 { background: var(--series-2); }
.chart-box { position: relative; margin-top: 8px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-box .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-box .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-box .crosshair { stroke: var(--muted); stroke-width: 1; }
.viz-root .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-root .line.s1 { stroke: var(--series-1); }
.viz-root .line.s2 { stroke: var(--series-2); }
.viz-root .dot { stroke: var(--card); stroke-width: 2; transition: r .12s; }
.viz-root .dot.s1 { fill: var(--series-1); }
.viz-root .dot.s2 { fill: var(--series-2); }
.chart-box .end-label { fill: var(--text); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-box .end-label.muted { fill: var(--muted); font-weight: 600; }
/* Seçili denemenin değerleri grafiğin üstünde sabit satırda (çizgilerin üstünü kapatmaz) */
.chart-readout { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; min-height: 44px; padding: 8px 0 6px; font-size: .85rem; border-bottom: 1px solid var(--border); }
.readout-head { display: flex; flex-direction: column; min-width: 0; margin-right: auto; line-height: 1.3; }
.readout-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readout-head .muted { font-size: .78rem; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-row b { font-variant-numeric: tabular-nums; }
.analysis-table td.num { font-variant-numeric: tabular-nums; }
.spark { display: block; overflow: visible; }
@media (max-width: 520px) {
    .stat-grid > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .analysis-table .hide-sm { display: none; }
    .analysis-table th, .analysis-table td { padding-left: 6px; padding-right: 6px; }
}

/* ---- Soru-Cevap ---- */
.subject-bar { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 10px; padding: 2px 16px 6px; scrollbar-width: none; }
.subject-bar::-webkit-scrollbar { display: none; }
.subject-bar a { flex: none; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--muted); font-size: .9rem; font-weight: 600; text-decoration: none; }
.subject-bar a.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.feed-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.feed-filters .segmented { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented a.seg { display: block; padding: 6px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .88rem; text-decoration: none; white-space: nowrap; }
.segmented a.seg.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.feed-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.feed-chips .chip { font-size: .85rem; color: var(--muted); text-decoration: none; background: var(--card); font-weight: 600 !important; }
.feed-chips .chip.on { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--primary); }
:root[data-theme="dark"] .feed-chips .chip.on, :root[data-theme="dark"] .badge.subject { color: #bfdbfe; }
.feed { display: flex; flex-direction: column; gap: 10px; }
.q-card { display: flex; gap: 10px; padding: 12px 14px 12px 6px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.q-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; color: var(--text); text-decoration: none; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; color: var(--muted); font-size: .8rem; }
.badge.subject { background: var(--primary-soft); color: var(--primary); }
.badge.teacher { background: var(--ok-soft); color: var(--ok); }
.q-title { font-weight: 700; font-size: 1.02rem; line-height: 1.35; overflow-wrap: anywhere; }
.q-excerpt { color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.q-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 2px; color: var(--muted); font-size: .82rem; }
.status { font-weight: 700; }
.status.open { color: var(--warn); }
.status.solved { color: var(--ok); }
.q-thumb { flex: none; align-self: center; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--bg); }
.q-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pager { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.empty-state { text-align: center; }

/* Oy kutusu */
.vote { flex: none; display: flex; flex-direction: column; align-items: center; gap: 0; width: 40px; }
.vote-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.vote-btn:hover:not(:disabled) { background: var(--bg); }
.vote-btn:disabled { opacity: .35; cursor: default; }
.vote-score { font-size: .95rem; font-variant-numeric: tabular-nums; }
.vote.up .vote-btn[data-value="1"], .vote.up .vote-score { color: #ea580c; }
.vote.down .vote-btn[data-value="-1"], .vote.down .vote-score { color: #4f46e5; }
:root[data-theme="dark"] .vote.down .vote-btn[data-value="-1"], :root[data-theme="dark"] .vote.down .vote-score { color: #818cf8; }
.vote.busy { opacity: .6; pointer-events: none; }

/* Soru detayı ve cevaplar */
.q-detail-row { display: flex; gap: 8px; margin-left: -8px; }
.q-detail-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.q-detail h1 { margin: 0; overflow-wrap: anywhere; }
.post-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.answers-head { margin: 18px 2px 10px; }
.answer .author { color: var(--text); }
form.inline { display: inline; margin: 0; }
.danger-text { color: var(--bad); font-size: .85rem; }
.narrow-wide { max-width: 680px; margin-left: auto; margin-right: auto; }
.field-label { display: block; font-size: .92rem; font-weight: 600; margin-bottom: 6px; }

/* Fotoğraf/video galerisi */
.media-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.media-grid.single { grid-template-columns: 1fr; }
.media-grid video, .media-thumb { width: 100%; border-radius: 10px; background: #000; }
.media-grid video { max-height: 70vh; }
.media-thumb { display: block; padding: 0; border: 0; cursor: zoom-in; overflow: hidden; aspect-ratio: 4 / 3; background: var(--bg); }
.media-grid.single .media-thumb { aspect-ratio: auto; }
.media-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.media-grid.single .media-thumb img { height: auto; max-height: 70vh; object-fit: contain; }
.lightbox { max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; margin: 0; padding: 0; border: 0; background: rgba(0, 0, 0, .92); }
.lightbox::backdrop { background: rgba(0, 0, 0, .92); }
.lightbox img { width: 100%; height: 100%; object-fit: contain; }

/* Yükleyici */
.upload-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.upload-list:not(:empty) { margin-bottom: 8px; }
.upload-tile { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--border); }
.upload-tile img, .upload-tile video { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .55; transition: opacity .2s; }
.upload-tile.done img, .upload-tile.done video { opacity: 1; }
.upload-tile.video::after { content: "▶"; position: absolute; left: 6px; bottom: 4px; color: #fff; font-size: .8rem; text-shadow: 0 1px 3px #000; }
.upload-bar { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: var(--primary); transition: width .2s; }
.upload-tile.done .upload-bar { display: none; }
.upload-tile.failed { border-color: var(--bad); }
.upload-tile.failed .upload-bar { top: 0; height: auto; width: 100% !important; padding: 6px; background: var(--bad-soft); color: var(--bad); font-size: .72rem; font-weight: 600; }
.upload-remove { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.upload-pick { gap: 8px; }
.upload-hint { margin: 6px 0 0; }

/* ---- Yapay zekâ çözümü ---- */
.ai-card { border-color: #c7b8f5; }
:root[data-theme="dark"] .ai-card { border-color: #4c3f86; }
.ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ai-head h2 { margin: 0; }
.ai-badge { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, #7c3aed, #2563eb); color: #fff; }
.ai-chip { padding: 1px 8px; border-radius: 999px; background: #ede9fe; color: #6d28d9; font-weight: 700; font-size: .75rem; }
:root[data-theme="dark"] .ai-chip { background: #3b2a6b; color: #ddd6fe; }
.ai-note { margin: 0 0 8px; }
.ai-wait { display: flex; align-items: center; gap: 6px; }
.ai-opt { align-items: flex-start; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

.ai-player { border-radius: 14px; overflow: hidden; background: #20352b; box-shadow: inset 0 0 0 6px #6b4f2a; }
.board {
    height: 300px;
    overflow-y: auto;
    padding: 18px 20px 8px;
    color: #f4f1e8;
    font: 1.15rem/1.55 "Chalkboard SE", "Comic Sans MS", "Segoe Print", sans-serif;
    scrollbar-width: none;
}
.board::-webkit-scrollbar { display: none; }
.board-step { display: none; margin-bottom: 14px; transition: opacity .3s; }
.board-step.shown { display: block; opacity: .45; }
.board-step.now { opacity: 1; }
.board-title { color: #9fd3ff; font-weight: 700; }
.board-line { padding-left: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Tebeşirle yazılıyormuş gibi soldan sağa açılır */
.board-step.write .board-line { animation: chalk .7s ease-out both; animation-delay: var(--d); }
@keyframes chalk { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.board-final { display: none; margin: 6px 0 14px; padding: 8px 12px; border: 2px dashed #ffd76a; border-radius: 10px; color: #ffd76a; font-weight: 700; }
.board-final.shown { display: block; animation: chalk .8s ease-out both; }
.board-caption { margin: 0; padding: 10px 16px; min-height: 3.2em; background: rgba(0, 0, 0, .28); color: #e7efe9; font-size: .92rem; line-height: 1.45; }
.player-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px 12px; background: rgba(0, 0, 0, .28); color: #f4f1e8; }
.pbtn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: inherit; cursor: pointer; flex: none; }
.pbtn.play { background: #f4f1e8; color: #20352b; width: 46px; height: 46px; }
.ai-player .i-pause, .ai-player.playing .i-play { display: none; }
.ai-player.playing .i-pause { display: block; }
.seek { flex: 1; min-width: 0; accent-color: #ffd76a; }
.step-count { flex: none; min-width: 36px; text-align: right; font-size: .85rem; font-variant-numeric: tabular-nums; }
.ai-actions { margin: 10px 0 4px; }
.ai-written { margin-top: 10px; }
.ai-written summary { font-weight: 700; cursor: pointer; }
.ai-steps { margin: 10px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 12px; }
.ai-steps p { margin: 4px 0 0; color: var(--muted); }
.ai-board-lines { margin-top: 4px; padding: 8px 12px; border-radius: 8px; background: var(--bg); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ai-answer { display: flex; align-items: baseline; gap: 10px; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--ok-soft); }
.ai-answer span { color: var(--ok); font-weight: 700; font-size: .85rem; }
.ai-tip { margin: 10px 0 0; color: var(--muted); }
.ai-limit-form { align-items: center; gap: 8px; margin: 0; }
.ai-limit-form input { width: 76px !important; padding: 6px 10px !important; }
