:root {
  --bg: #f5f4fb;
  --surface: #ffffff;
  --surface-2: #f0eef9;
  --text: #1d1b2c;
  --muted: #6b6883;
  --line: #e2dff0;
  --accent: #5b3fd9;
  --accent-2: #4a31bd;
  --accent-soft: #ece8ff;
  --good: #16a34a;
  --good-soft: #dcfce7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 20, 80, .06), 0 4px 16px rgba(30, 20, 80, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
[hidden] { display: none !important; }

/* ---------- кнопки и поля ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .6em 1.1em; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #fca5a5; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: .35em .7em; font-size: .875rem; border-radius: 8px; }
.btn.big { padding: .85em 1.5em; font-size: 1.1rem; border-radius: 12px; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.input, textarea.input, select.input {
  width: 100%; padding: .65em .8em; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea.input { resize: vertical; min-height: 5em; }
label.field { display: block; margin-bottom: 1em; }
label.field > span { display: block; font-size: .875rem; font-weight: 600; color: var(--muted); margin-bottom: .3em; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.badge { display: inline-block; padding: .1em .55em; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge.live { background: #fee2e2; color: #b91c1c; }
.badge.self { background: #dbeafe; color: #1d4ed8; }
.badge.ended { background: var(--surface-2); color: var(--muted); }
.badge.good { background: var(--good-soft); color: var(--good); }

/* ---------- шапка ---------- */

.topbar {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .7rem 1.2rem; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.logo { font-weight: 800; font-size: 1.15rem; color: var(--accent); text-decoration: none; letter-spacing: -.01em; }
.logo b { color: var(--text); }
.page { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

/* ---------- уведомления ---------- */

#toasts { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); display: grid; gap: .5rem; z-index: 100; width: min(92vw, 420px); }
.toast { background: #1d1b2c; color: #fff; padding: .7em 1em; border-radius: 10px; box-shadow: var(--shadow); animation: pop .2s ease-out; }
.toast.error { background: var(--bad); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

.conn { width: .6rem; height: .6rem; border-radius: 50%; background: var(--bad); display: inline-block; }
.conn.on { background: var(--good); }

/* ---------- слайд ---------- */

.slide-body h2 { font-size: clamp(1.3rem, 3.2vw, 2rem); margin-bottom: .6em; }
.slide-body .slide-text { white-space: pre-wrap; font-size: clamp(1rem, 2vw, 1.2rem); }
.slide-body .slide-img { display: block; margin: 0 auto 1em; max-height: 60vh; border-radius: 10px; object-fit: contain; }
.slide-body .slide-img:only-child { margin-bottom: 0; }

.type-chip { display: inline-flex; gap: .3em; align-items: center; font-size: .8rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: .15em .6em; border-radius: 999px; margin-bottom: .8em; }

/* варианты ответа */
.options { display: grid; gap: .6rem; margin-top: 1rem; }
.option {
  display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left;
  padding: .8em 1em; border: 2px solid var(--line); border-radius: 12px; background: var(--surface);
  font: inherit; font-size: 1.05rem; color: var(--text); cursor: pointer; transition: border-color .15s, background .15s;
}
.option:hover:not(:disabled) { border-color: #c4b8f7; }
.option .letter { flex: none; width: 2rem; height: 2rem; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; color: var(--muted); }
.option.selected { border-color: var(--accent); background: var(--accent-soft); }
.option.selected .letter { background: var(--accent); color: #fff; }
.option.correct { border-color: var(--good); background: var(--good-soft); }
.option.correct .letter { background: var(--good); color: #fff; }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.wrong .letter { background: var(--bad); color: #fff; }
.option:disabled { cursor: default; }

/* столбики результатов */
.bars { display: grid; gap: .55rem; margin-top: 1rem; }
.bar { display: grid; grid-template-columns: 2rem 1fr auto; gap: .6rem; align-items: center; }
.bar .letter { width: 2rem; height: 2rem; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; color: var(--muted); }
.bar.correct .letter { background: var(--good); color: #fff; }
.bar .track { position: relative; height: 2.2rem; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: #b9aaf5; border-radius: 8px; transition: width .4s ease; }
.bar.correct .fill { background: #86efac; }
.bar .label { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 .7rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .num { font-weight: 700; min-width: 4.5em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* общие ответы класса */
.answers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; margin-top: 1rem; }
.answer-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .8rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .5rem; }
.answer-card .who { font-weight: 700; font-size: .9rem; display: flex; align-items: center; gap: .5rem; }
.answer-card .text { white-space: pre-wrap; word-break: break-word; }
.answer-card img { border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; background: #fff; aspect-ratio: 16/9; object-fit: contain; width: 100%; }
.answer-card.shared { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* рисовалка */
.drawpad { display: grid; gap: .6rem; margin-top: 1rem; }
.drawpad canvas { width: 100%; aspect-ratio: 16/9; background: #fff; border: 2px solid var(--line); border-radius: 12px; touch-action: none; cursor: crosshair; }
.drawpad .tools { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.swatch { width: 2rem; height: 2rem; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.active { box-shadow: 0 0 0 3px var(--accent); }

/* окно поверх страницы */
.modal { position: fixed; inset: 0; background: rgba(20, 16, 40, .7); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal > .card { max-width: min(96vw, 1100px); max-height: 94vh; overflow: auto; padding: 1.5rem; position: relative; }
.modal img.zoom { max-height: 85vh; border-radius: 10px; background: #fff; }
.modal .close { position: absolute; top: .5rem; right: .5rem; }

/* ---------- вход ученика ---------- */

.join-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(1200px 600px at 20% -10%, #e1d9ff 0%, transparent 60%), var(--bg); }
.join-card { width: min(100%, 420px); padding: 2rem 1.6rem; text-align: center; }
.join-card .logo { font-size: 1.6rem; display: block; margin-bottom: .3rem; }
.code-input { text-align: center; font-size: 2rem; font-weight: 800; letter-spacing: .3em; text-transform: uppercase; padding: .4em; }

/* ---------- экран ученика ---------- */

.student-main { max-width: 820px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.stage { padding: clamp(1rem, 3vw, 2rem); }
.status-line { margin-top: 1rem; padding: .7em 1em; border-radius: 10px; background: var(--surface-2); font-weight: 600; }
.status-line.good { background: var(--good-soft); color: #166534; }
.status-line.bad { background: var(--bad-soft); color: #991b1b; }
.waiting { text-align: center; padding: 3rem 1rem; }
.waiting .big-emoji { font-size: 3rem; }
.self-nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: .7rem 1rem; display: flex; gap: .5rem; align-items: center; justify-content: center; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; flex: 1; max-width: 300px; }
.progress > div { height: 100%; background: var(--accent); transition: width .3s; }

@media (max-width: 560px) {
  .student-bar { flex-wrap: nowrap; padding: .6rem .8rem; }
  .student-bar .logo, .student-bar #student-name { display: none; }
}

/* ---------- кабинет учителя ---------- */

.auth-card { max-width: 420px; margin: 3rem auto; padding: 2rem; }
.tabs { display: flex; gap: .25rem; background: var(--surface-2); padding: .25rem; border-radius: 10px; margin-bottom: 1.2rem; }
.tabs button { flex: 1; border: 0; background: transparent; padding: .5em; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.lesson-card { display: flex; flex-direction: column; overflow: hidden; }
.lesson-card .cover { aspect-ratio: 16/9; background: linear-gradient(135deg, #ece8ff, #dbeafe); display: grid; place-items: center; font-size: 2.5rem; overflow: hidden; }
.lesson-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.lesson-card .body { padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.lesson-card h3 { font-size: 1.05rem; margin: 0; word-break: break-word; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .8rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.section-title { display: flex; align-items: center; gap: .75rem; margin: 2rem 0 1rem; }
.section-title h2 { margin: 0; font-size: 1.3rem; }

/* ---------- редактор ---------- */

.editor { display: grid; grid-template-columns: 240px minmax(0, 1fr) minmax(0, 1fr); height: calc(100vh - 57px); }
.editor > * { overflow-y: auto; }
.slide-list { border-right: 1px solid var(--line); background: var(--surface); padding: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.slide-item { display: grid; grid-template-columns: 1.6rem 1fr; gap: .4rem; padding: .5rem; border-radius: 10px; border: 2px solid transparent; cursor: pointer; background: var(--surface-2); }
.slide-item.active { border-color: var(--accent); background: var(--accent-soft); }
.slide-item .n { font-weight: 800; color: var(--muted); font-size: .85rem; }
.slide-item .t { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-item .k { font-size: .75rem; color: var(--muted); }
.slide-item .thumb { grid-column: 2; aspect-ratio: 16/9; border-radius: 6px; object-fit: cover; width: 100%; }
.slide-form { padding: 1.2rem; border-right: 1px solid var(--line); }
.slide-preview { padding: 1.2rem; background: var(--bg); }
.slide-preview .stage { position: sticky; top: 0; }
.opt-row { display: grid; grid-template-columns: 2rem 1fr auto auto; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.opt-row .letter { font-weight: 800; color: var(--muted); text-align: center; }
.check { display: inline-flex; align-items: center; gap: .35em; font-size: .85rem; cursor: pointer; user-select: none; }
.img-drop { border: 2px dashed var(--line); border-radius: 12px; padding: 1rem; text-align: center; color: var(--muted); }
.img-drop img { max-height: 180px; border-radius: 8px; display: block; margin: 0 auto .6rem; }
.menu { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(30, 20, 80, .15); padding: .35rem; z-index: 30; min-width: 220px; }
.menu button { display: flex; width: 100%; gap: .6rem; align-items: center; border: 0; background: none; padding: .55rem .7rem; border-radius: 8px; font: inherit; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--surface-2); }

@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; height: auto; }
  .slide-list { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .slide-item { min-width: 150px; }
  .slide-preview { display: none; }
}

/* ---------- живой урок (учитель) ---------- */

.live-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; height: calc(100vh - 57px); }
.live-main { overflow-y: auto; padding: 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.live-side { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 1rem; }
.controls { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.controls .counter { font-weight: 700; min-width: 5em; text-align: center; font-variant-numeric: tabular-nums; }
.code-chip { font-weight: 800; letter-spacing: .15em; background: var(--accent-soft); color: var(--accent); padding: .3em .7em; border-radius: 8px; cursor: pointer; border: 0; font-size: 1rem; }
.student-row { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.student-row:last-child { border-bottom: 0; }
.student-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-row.offline .name { color: var(--muted); }
.strip { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; }
.strip button { flex: none; min-width: 2.4rem; height: 2.4rem; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); font: inherit; font-weight: 700; cursor: pointer; }
.strip button.q { border-style: dashed; }
.strip button.active { border-color: var(--accent); background: var(--accent); color: #fff; }

.join-screen { text-align: center; padding: 1rem 2rem; }
.join-screen .code { font-size: clamp(3rem, 12vw, 7rem); font-weight: 900; letter-spacing: .12em; color: var(--accent); line-height: 1.1; }
.join-screen .url { font-size: 1.3rem; font-weight: 600; }
.join-screen svg { width: 240px; height: 240px; }

@media (max-width: 900px) {
  .live-layout { grid-template-columns: 1fr; height: auto; }
  .live-side { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- отчёт ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1.2rem; }
.stat { padding: 1rem; }
.stat .v { font-size: 1.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .85rem; }
.report td.cell { min-width: 120px; max-width: 260px; font-size: .9rem; }
.report td.cell.good { background: #f0fdf4; }
.report td.cell.bad { background: #fef2f2; }
.report td.cell img { width: 120px; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; background: #fff; }
.report .clip { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.report th .q { text-transform: none; letter-spacing: 0; font-size: .82rem; color: var(--text); display: block; max-width: 220px; }

body:has(.self-nav) #toasts { bottom: 5rem; }

/* живой черновик ученика у учителя */
.live-ink { aspect-ratio: 16/9; background: #fff center / contain no-repeat; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: zoom-in; }
.live-ink canvas { display: block; width: 100%; height: 100%; }
.zoom-live .live-ink { width: min(84vw, 1040px); cursor: default; }
.answer-card.drafting { border-style: dashed; border-color: #f59e0b; }
.badge.drafting { background: #fef3c7; color: #92400e; animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .55; } }

/* игры на пары */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .6rem; margin-top: 1rem; }
.game-card { position: relative; aspect-ratio: 1; padding: 0; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; overflow: hidden; font: inherit; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.game-card .face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; padding: .4rem; }
.game-card .face img { flex: 1; min-height: 0; max-width: 100%; object-fit: contain; }
.game-card .face span { font-weight: 700; font-size: clamp(.8rem, 2.4vw, 1.05rem); text-align: center; word-break: break-word; line-height: 1.2; }
.game-card .back { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(135deg, #7c5cf0, #4a31bd); color: #fff; font-size: 2.2rem; font-weight: 900; transition: opacity .25s, transform .25s; }
.game-card.open .back { opacity: 0; transform: scale(.85); pointer-events: none; }
.game-card.picked { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.game-card.good { border-color: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.game-card.bad { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); animation: shake .35s; }
.game-card.found::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(22, 163, 74, .5); color: #fff; font-size: 2.6rem; font-weight: 900; }
.game-card:disabled { cursor: default; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.pairs-key { display: grid; gap: .5rem; margin-top: 1rem; }
.pair-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; }
.mini-card { position: relative; height: 96px; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.mini-card .face { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .4rem; padding: .3rem; }
.mini-card .face img { max-height: 100%; min-width: 0; max-width: 70%; object-fit: contain; }
.mini-card .face span { font-weight: 700; text-align: center; }
.game-progress { display: flex; align-items: center; gap: .5rem; }
.game-progress .track { flex: 1; height: .6rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.game-progress .track > div { height: 100%; background: var(--good); }
/* редактор пар */
.pair-edit { display: grid; grid-template-columns: 1.5rem 1fr 1fr auto; gap: .5rem; align-items: start; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.pair-edit .n { font-weight: 800; color: var(--muted); padding-top: .5rem; }
.side-edit { display: grid; gap: .35rem; }
.side-edit .thumb { height: 72px; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; background: #fff; cursor: pointer; overflow: hidden; color: var(--muted); font-size: .8rem; text-align: center; }
.side-edit .thumb img { max-height: 100%; max-width: 100%; object-fit: contain; }

/* варианты ответа с картинками — плиткой */
.option .opt-label { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.options.tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.options.tiles .option { flex-direction: column; align-items: stretch; gap: .5rem; padding: .5rem; }
.options.tiles .opt-img { aspect-ratio: 4/3; display: grid; place-items: center; background: #fff; border-radius: 8px; overflow: hidden; }
.options.tiles .opt-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.options.tiles .opt-label { gap: .5rem; font-size: .95rem; }
.bar .label { gap: .5rem; }
.bar-img { height: 1.7rem; width: 2.4rem; object-fit: contain; border-radius: 4px; background: #fff; flex: none; }
.opt-row { grid-template-columns: 2rem 3.2rem 1fr auto auto; }
.opt-thumb { width: 3.2rem; height: 2.4rem; border: 1px dashed var(--line); border-radius: 6px; background: #fff; display: grid; place-items: center; cursor: pointer; overflow: hidden; font-size: 1rem; color: var(--muted); padding: 0; }
.opt-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* «Карточки с ответом» — стикеры на доске */
.answer-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; padding: 1rem; border-radius: 14px; background: #fdf6dc; }
.acard { position: relative; background: #fff; border: 2px solid transparent; border-radius: 16px; padding: 1.1rem .8rem .8rem; box-shadow: 0 2px 8px rgba(80, 60, 0, .12); display: flex; flex-direction: column; gap: .5rem; }
.acard .pin { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); width: 18px; height: 18px; border-radius: 50%; background: #3b82f6; box-shadow: 0 2px 3px rgba(0, 0, 0, .25); }
.acard img { max-height: 140px; width: 100%; object-fit: contain; cursor: zoom-in; }
.acard-text { font-weight: 700; text-align: center; font-size: 1.1rem; }
.acard-hint { font-size: .85rem; color: var(--muted); text-align: center; }
.acard-input { display: flex; gap: .35rem; align-items: center; }
.acard-input .input { text-align: center; font-weight: 600; }
.acard-mark { font-size: 1.2rem; }
.acard.ok { border-color: var(--good); background: #f0fdf4; }
.acard.ok .input { background: #dcfce7; color: #166534; }
.acard.wrong { border-color: #fca5a5; }
.acard.shake { animation: shake .35s; }
.acard-solution { font-size: .85rem; font-weight: 700; color: #166534; background: var(--good-soft); border-radius: 8px; padding: .25em .5em; text-align: center; }

/* «Филворд» */
.ws { display: grid; gap: .8rem; margin-top: 1rem; }
.ws-grid { display: grid; gap: 2px; width: min(100%, 560px); aspect-ratio: 1; margin: 0 auto; user-select: none; -webkit-user-select: none; touch-action: none; background: var(--line); border: 2px solid var(--line); border-radius: 10px; overflow: hidden; }
.ws-cell { display: grid; place-items: center; background: #fff; font-weight: 800; line-height: 1; cursor: pointer; transition: background .15s; }
.ws-cell.sel { background: #c7d2fe !important; }
.ws-cell.bad { background: var(--bad-soft) !important; }
.ws-list { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.ws-item { padding: .3em .7em; border-radius: 999px; background: var(--surface-2); font-size: .95rem; }
.ws-item.done strong { text-decoration: line-through; }

/* редакторы карточек и филворда */
.item-edit { display: grid; grid-template-columns: 1.5rem 90px 1fr auto; gap: .5rem; align-items: start; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.item-edit .n { font-weight: 800; color: var(--muted); padding-top: .5rem; }
.item-edit .thumb { height: 90px; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; background: #fff; cursor: pointer; overflow: hidden; color: var(--muted); font-size: .8rem; text-align: center; }
.item-edit .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.item-edit .fields { display: grid; gap: .35rem; }
.word-edit { display: grid; grid-template-columns: 1.5rem 1fr 1.6fr auto; gap: .4rem; align-items: center; margin-bottom: .35rem; }
.word-edit .n { font-weight: 800; color: var(--muted); }
.checks { display: grid; gap: .4rem; margin: .6rem 0 1rem; }
