:root {
  --bg: #F3F5FC;
  --grid: #E4E8F5;
  --card: #FFFFFF;
  --text: #1C2147;
  --muted: #565C80;
  --accent: #5B45E0;
  --accent-dark: #4632BD;
  --accent-soft: #ECEAFD;
  --accent-track: #8877EA;
  --on-accent: #FFFFFF;
  --kid-bubble: #5B45E0;
  --kid-text: #FFFFFF;
  --owl-bubble: #FFFFFF;
  --border: #D9DEF0;
  --border-strong: #C4CAE0;
  --yellow: #FFD43B;
  --yellow-soft: #FFF4C2;
  --on-yellow: #1C2147;
  --good: #12805C;
  --good-text: #0B5E43;
  --good-soft: #E6F4EE;
  --good-border: #BFE3D2;
  --warn-soft: #FFF1DC;
  --warn-text: #6B3B00;
  --danger: #B4232F;
  --shadow: none;
  --display: "Unbounded", "Golos Text", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14162B; --grid: #1B1E38; --card: #1F2240; --text: #EEF0FA; --muted: #A4A9C9;
    --accent: #6E5AE8; --accent-dark: #B9AEF7; --accent-soft: #2A2A55; --accent-track: #8877EA;
    --kid-bubble: #5B45E0; --owl-bubble: #1F2240; --border: #33375C; --border-strong: #454A73;
    --yellow-soft: #3A3414; --good: #3FBF92; --good-text: #7FDDBB; --good-soft: #12332A; --good-border: #1E5443;
    --warn-soft: #3A2A12; --warn-text: #FFCF8A; --danger: #F27C86;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background-color: var(--bg); color: var(--text);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  font: 16px/1.4 "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }

.screen { min-height: 100%; max-width: 760px; margin: 0 auto; }

/* Профили */
#profiles { padding: 32px 16px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.hero { text-align: center; }
.hero h1 { margin: 8px 0 4px; font-size: 28px; }
.hero p { margin: 0; color: var(--muted); font-size: 19px; }
.owl { font-size: 72px; line-height: 1; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-4deg); } }
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; width: 100%; }
.kid {
  position: relative; background: var(--card); border: 2px solid var(--border); border-radius: 24px;
  padding: 20px 12px 16px; text-align: center; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.kid:hover, .kid:focus-visible { transform: translateY(-3px); border-color: var(--accent); outline: none; }
.kid .ava { font-size: 54px; line-height: 1.1; }
.kid .name { font-weight: 700; font-size: 20px; margin-top: 6px; }
.kid .meta { color: var(--muted); font-size: 15px; }
.kid .edit { position: absolute; top: 8px; right: 8px; border: 0; background: none; font-size: 16px; cursor: pointer; opacity: .55; padding: 6px; }
.kid .edit:hover { opacity: 1; }

.btn {
  border: 0; border-radius: 14px; padding: 12px 20px; background: var(--accent); color: #fff;
  font-weight: 600; cursor: pointer;
}
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: transparent; color: var(--danger); padding-left: 4px; }

dialog { border: 0; border-radius: 24px; padding: 24px; width: min(420px, calc(100% - 32px)); background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20, 10, 50, .4); }
dialog h2 { margin: 0 0 16px; }
dialog label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-weight: 600; }
dialog input, dialog select { border: 2px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--bg); font-weight: 400; }
.avatars { border: 0; padding: 0; margin: 0 0 18px; }
.avatars legend { font-weight: 600; margin-bottom: 6px; }
#avatarPick { display: flex; flex-wrap: wrap; gap: 6px; }
#avatarPick button { font-size: 28px; width: 48px; height: 48px; border-radius: 14px; border: 2px solid transparent; background: var(--bg); cursor: pointer; }
#avatarPick button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.row { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }

/* Чат */
#chat { height: 100dvh; display: flex; flex-direction: column; }
.bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--card); border-bottom: 1px solid var(--border);
}
.who { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 19px; min-width: 0; }
.who span { font-size: 28px; }
.who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stars { font-weight: 700; background: #fff4cc; color: #8a6300; border-radius: 999px; padding: 4px 12px; transition: transform .3s; }
.stars.pop { transform: scale(1.35); }
.icon { border: 0; background: none; font-size: 22px; width: 44px; height: 44px; border-radius: 12px; cursor: pointer; display: grid; place-items: center; flex: none; }
.icon:hover { background: var(--accent-soft); }

.messages { flex: 1; overflow-y: auto; padding: 16px 12px 8px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 85%; padding: 12px 16px; border-radius: 20px; white-space: normal; overflow-wrap: anywhere; box-shadow: var(--shadow); }
.msg.user { align-self: flex-end; background: var(--kid-bubble); color: var(--kid-text); border-bottom-right-radius: 6px; }
.msg.assistant { align-self: flex-start; background: var(--owl-bubble); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.msg.assistant::before { content: "🦉"; display: block; font-size: 18px; margin-bottom: 2px; }
.msg.correct { border: 2px solid var(--good); }
.msg.error { background: #fee2e2; color: #7f1d1d; border-color: #fecaca; }
.msg p { margin: 0 0 8px; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 4px 0 8px; padding-left: 22px; }
.msg img { max-width: 100%; max-height: 260px; border-radius: 12px; display: block; margin-bottom: 8px; }
.msg .photoNote { opacity: .8; font-size: 14px; }
.typing span { display: inline-block; width: 8px; height: 8px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.welcome { text-align: center; color: var(--muted); margin: auto 16px; }
.welcome .owl { font-size: 64px; }
.welcome b { color: var(--text); }

.composer { background: var(--card); border-top: 1px solid var(--border); padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.inputRow { display: flex; align-items: flex-end; gap: 6px; }
textarea { flex: 1; resize: none; border: 2px solid var(--border); border-radius: 20px; padding: 9px 14px; background: var(--bg); max-height: 160px; min-height: 44px; outline: none; }
textarea:focus { border-color: var(--accent); }
.send { background: var(--accent); color: #fff; border-radius: 50%; }
.send:hover { background: var(--accent); filter: brightness(1.1); }
.send:disabled { opacity: .4; }
.photo { cursor: pointer; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; }
.previews:not(:empty) { margin-bottom: 8px; }
.previews div { position: relative; }
.previews img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; border: 2px solid var(--border); }
.previews button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--text); color: var(--bg); font-size: 13px; cursor: pointer; }

/* Праздник */
.celebrate { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; pointer-events: none; z-index: 20; }
.bigStar { font-size: 140px; animation: starPop 1.6s ease-out forwards; }
.cheer { font-size: 30px; font-weight: 800; color: var(--accent); background: var(--card); padding: 6px 20px; border-radius: 999px; box-shadow: var(--shadow); animation: fadeOut 1.8s ease-out forwards; }
@keyframes starPop { 0% { transform: scale(0) rotate(-90deg); } 30% { transform: scale(1.2) rotate(10deg); } 50% { transform: scale(1); } 85% { opacity: 1; } 100% { transform: translateY(-40vh) scale(.3); opacity: 0; } }
@keyframes fadeOut { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 19; }
@media (prefers-reduced-motion: reduce) { .owl, .bigStar { animation: none; } }

/* Вход */
#login { padding: 48px 16px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.loginForm { display: flex; flex-direction: column; gap: 12px; width: min(320px, 100%); }
.loginForm input { border: 2px solid var(--border); border-radius: 14px; padding: 12px 14px; background: var(--card); text-align: center; font-size: 20px; }
.loginForm input:focus { border-color: var(--accent); outline: none; }
.loginError { color: var(--danger); text-align: center; min-height: 1.4em; margin: 0; }

/* В установленном приложении — отступ под чёлку iPhone на главном экране */
#profiles, #login { padding-top: max(32px, calc(env(safe-area-inset-top) + 16px)); }

/* Выбор репетитора */
#tutors { padding-bottom: 24px; }
.bar.plain { background: transparent; border: 0; }
.pickTitle { text-align: center; margin: 8px 16px 16px; font-size: 24px; }
.tutorList { display: grid; gap: 14px; padding: 0 16px; }
.tutor {
  display: flex; align-items: center; gap: 16px; text-align: left; width: 100%;
  background: var(--card); border: 2px solid var(--border); border-radius: 24px; padding: 12px;
  cursor: pointer; box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
.tutor:hover, .tutor:focus-visible { transform: translateY(-2px); border-color: var(--accent); outline: none; }
.tutor img { width: 92px; height: 92px; border-radius: 20px; object-fit: cover; flex: none; }
.tutor .tName { font-weight: 700; font-size: 20px; }
.tutor .tSubj { color: var(--accent); font-weight: 600; font-size: 15px; margin: 2px 0 4px; }
.tutor .tAbout { color: var(--muted); font-size: 15px; line-height: 1.35; }
.tutor .tLast { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Фото репетитора в шапке и сообщениях */
.who img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.msg.assistant::before { content: none; }
.msg .tutorPic { width: 28px; height: 28px; max-height: none; border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; margin: 0 6px 4px 0; }
.msg .tutorTag { font-size: 13px; font-weight: 700; color: var(--accent); vertical-align: middle; }
.welcome .tutorBig { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow); border: 4px solid var(--card); }
.appLogo { width: 96px; height: 96px; border-radius: 24px; box-shadow: var(--shadow); }

/* Голосовой ввод */
.mic { border-radius: 50%; }
.mic.listening { background: #ef4444; color: #fff; animation: micPulse 1.2s ease-in-out infinite; }
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .5); } 50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } }
.inputRow .icon { width: 40px; }
textarea.listening { border-color: #ef4444; }
@media (prefers-reduced-motion: reduce) { .mic.listening { animation: none; } }

/* Домашка */
.hwSummary { margin: 4px 16px 8px; }
.hwCard { background: var(--card); border: 2px solid var(--border); border-radius: 24px; padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer; }
.hwCard.todo { border-color: #f59e0b; }
.hwCard.clear { border-color: var(--good); }
.hwCard h3 { margin: 0 0 6px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.hwCard h3 .count { margin-left: auto; font-size: 14px; background: #fef3c7; color: #92400e; border-radius: 999px; padding: 2px 10px; }
.hwCard ul { margin: 0; padding-left: 20px; color: var(--text); }
.hwCard li { margin: 2px 0; }
.hwCard .more { color: var(--accent); font-weight: 600; margin-top: 6px; font-size: 15px; }
.hwCard .overdue { color: var(--danger); }
.kid .badge { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 700; background: #fef3c7; color: #92400e; border-radius: 999px; padding: 2px 10px; }

#homework { padding-bottom: 32px; }
.hwActions { display: flex; gap: 10px; padding: 0 16px 12px; }
.hwActions .btn { flex: 1; }
.hwList { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }
.hwGroup { font-weight: 700; color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .03em; margin: 10px 4px 0; }
.hwGroup.overdue { color: var(--danger); }
.hwItem { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow); }
.hwItem.done { opacity: .6; box-shadow: none; }
.hwItem.done .hwText { text-decoration: line-through; }
.hwItem .hwSubj { font-weight: 700; padding-right: 32px; }
.hwItem .hwText { margin: 2px 0 8px; overflow-wrap: anywhere; }
.hwItem .hwBtns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hwItem .hwBtns button { border: 0; border-radius: 12px; padding: 7px 12px; font-size: 15px; font-weight: 600; cursor: pointer; }
.hwItem .solve { background: var(--accent); color: #fff; display: inline-flex; align-items: center; gap: 6px; }
.hwItem .solve img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.hwItem .mark { background: var(--accent-soft); color: var(--accent); }
.hwItem .del { position: absolute; top: 6px; right: 6px; background: none !important; color: var(--muted); padding: 6px !important; }
.hwItem .byTutor { font-size: 13px; color: var(--good); font-weight: 600; flex: none; }
.hwEmpty { text-align: center; color: var(--muted); padding: 24px 8px; }

.reminderCard { margin: 20px 16px 0; background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 14px 16px; }
.reminderCard h3 { margin: 0 0 8px; font-size: 17px; }
.reminderCard .rRow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.reminderCard input[type="time"] { border: 2px solid var(--border); border-radius: 10px; padding: 6px 8px; background: var(--bg); }
.reminderCard .note { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.reminderCard .ok { color: var(--good); font-weight: 600; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }

#hwDialog textarea { border: 2px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--bg); font-weight: 400; resize: vertical; }
.hint { color: var(--muted); margin: -8px 0 12px; }
.diaryItems { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; margin-bottom: 16px; }
.diaryItem { display: grid; grid-template-columns: 1fr auto; gap: 6px; background: var(--bg); border-radius: 14px; padding: 10px; }
.diaryItem input { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; background: var(--card); min-width: 0; }
.diaryItem .dSubj { font-weight: 700; }
.diaryItem .dRemove { grid-row: 1 / span 3; grid-column: 2; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); align-self: start; }
.loading { text-align: center; padding: 20px; color: var(--muted); }
.hwDoneNote { margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--good); }
.hwItem .hwDue { font-weight: 400; color: var(--muted); font-size: 14px; }

/* Источники домашки */
.hwActions { flex-wrap: wrap; }
.hwActions .btn { flex: 1 1 40%; padding: 12px 10px; font-size: 15px; }
.srcTag { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 8px; margin-left: 4px; vertical-align: 1px; }
.srcTag.kundelik { background: #dbeafe; color: #1e40af; }
.srcTag.courses { background: #fde68a; color: #92400e; }
.segmented { display: flex; gap: 6px; background: var(--bg); border-radius: 14px; padding: 4px; margin: 12px 0; }
.segmented button { flex: 1; border: 0; border-radius: 10px; padding: 8px; background: none; font-weight: 600; cursor: pointer; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
#hwDialog select { border: 2px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--bg); font-weight: 400; }
.kForm { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.kForm input { border: 2px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--bg); }
.kErr { color: var(--danger); font-size: 14px; margin: 6px 0 0; }
.shareBanner { width: 100%; background: #fef3c7; color: #92400e; border-radius: 16px; padding: 12px 14px; font-weight: 600; text-align: center; }
.kForm select { border: 2px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--bg); }
.reminderCard .rRow .btn { padding: 9px 14px; font-size: 15px; }
.reminderCard .qr { display: block; width: 240px; height: 240px; margin: 8px auto 12px; border-radius: 12px; background: #fff; padding: 6px; }
.pinBtn { width: 100%; margin: 0 0 14px; }

/* Родитель: переписка детей */
.linkBtn { border: 0; background: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 8px; }
.linkBtn:hover { color: var(--accent); }
.kidCode { font-size: 28px; font-weight: 700; letter-spacing: 3px; margin: 4px 0 12px; user-select: all; }
#parent { padding-bottom: 32px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 8px; scrollbar-width: none; }
.chips button { flex: none; border: 2px solid var(--border); background: var(--card); border-radius: 999px; padding: 6px 14px; font-weight: 600; cursor: pointer; color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.chips button img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.parentStats { margin: 4px 16px 4px; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; font-size: 15px; }
.parentStats:empty { display: none; }
.parentLog { padding: 0 12px; display: flex; flex-direction: column; gap: 10px; }
.dayHead { color: var(--muted); font-size: 13px; font-weight: 700; margin: 14px 6px 0; }
.dayHead::first-letter { text-transform: uppercase; }
.sess { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.sessHead { display: flex; gap: 10px; align-items: center; }
.sessPics { display: flex; flex: none; }
.sessPics img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--card); }
.sessPics img + img { margin-left: -14px; }
.sessWhen { display: flex; flex-direction: column; min-width: 0; }
.sessWhen b { font-size: 16px; }
.sessWhen span { color: var(--muted); font-size: 13px; }
.night { font-style: normal; color: #b45309; font-weight: 700; margin-left: 4px; }
.sessFacts { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.sessSum { margin-top: 8px; font-size: 15px; line-height: 1.45; }
.sessSum p { margin: 6px 0 0; }
.sumSubj { font-weight: 700; color: var(--accent); font-size: 14px; }
.sumHard { color: var(--text); opacity: .85; }
.sumWarn { background: #fff4e5; color: #8a4b00; border-radius: 10px; padding: 8px 10px; }
.sumWait { color: var(--muted); font-style: italic; }
.sessHw { margin-top: 6px; font-size: 14px; color: var(--good); }
.sessOpen { margin-top: 10px; width: 100%; border: 1px solid var(--border); background: var(--accent-soft); color: var(--accent); font-weight: 700; border-radius: 12px; padding: 9px; cursor: pointer; font-size: 15px; }
.sessLog { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.pline { border-left: 3px solid var(--border); padding: 2px 0 2px 10px; font-size: 15px; overflow-wrap: anywhere; }
.pline.user { border-color: var(--accent); }
.pline.user .ptext { font-weight: 600; }
.pline.correct { border-color: #f5b301; }
.pwho { font-size: 12px; font-weight: 700; color: var(--muted); }
.pline.user .pwho { color: var(--accent); }
.pwho span { font-weight: 400; margin-left: 6px; }
.ptext p { margin: 2px 0; }
.ptext ul, .ptext ol { margin: 2px 0; padding-left: 20px; }
.pline.assistant .ptext { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); cursor: pointer; }
.pline.assistant.full .ptext { display: block; color: var(--text); }
.pline img.shot { max-width: 100%; max-height: 220px; border-radius: 10px; display: block; margin: 4px 0; cursor: zoom-in; }
.pline.breakLog { border-color: var(--good); color: var(--good); font-size: 14px; }
@media (prefers-color-scheme: dark) { .sumWarn { background: #3a2a12; color: #ffcf8a; } .night { color: #fbbf24; } }
.parentEmpty { text-align: center; color: var(--muted); padding: 32px 16px; }
.parentPin { margin: 24px 16px 0; text-align: center; }

/* Переменка */
.breakScreen { position: fixed; inset: 0; z-index: 30; background: linear-gradient(160deg, #a29bfe, #6c5ce7 55%, #fd79a8); display: flex; flex-direction: column; overflow-y: auto; padding: max(12px, env(safe-area-inset-top)) 16px 24px; }
.breakTop { display: flex; justify-content: space-between; }
.breakTop .icon { background: rgba(255,255,255,.25); color: #fff; }
.breakCard { margin: auto; width: min(460px, 100%); background: var(--card); border-radius: 28px; padding: 24px 20px; text-align: center; box-shadow: 0 20px 50px rgba(40, 20, 100, .35); }
.breakCard h2 { margin: 8px 0; font-size: 24px; }
.breakCard p { color: var(--muted); margin: 6px 0; }
.breakTutor { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 4px solid var(--accent-soft); }
.breakKinds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.breakKinds button { border: 2px solid var(--border); background: var(--bg); border-radius: 20px; padding: 14px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text); }
.breakKinds button:hover { border-color: var(--accent); }
.breakKinds span { font-size: 40px; }
.breakKinds small { color: var(--muted); }
.breakStep { color: var(--muted); font-weight: 600; font-size: 14px; }
.breakBig { font-size: 110px; line-height: 1.1; margin: 8px 0; }
.bounce { animation: bounce 1s ease-in-out infinite; }
@keyframes bounce { 50% { transform: translateY(-14px) scale(1.05); } }
.breakCount { font-size: 54px; font-weight: 800; color: var(--accent); margin: 4px 0 12px; }
.breakBar { height: 12px; background: var(--accent-soft); border-radius: 999px; overflow: hidden; margin: 0 0 12px; }
.breakBar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.btn.big { font-size: 20px; padding: 14px 28px; margin: 4px 0 8px; }
.eyesArea { position: relative; height: 260px; display: grid; place-items: center; background: var(--bg); border-radius: 20px; margin-top: 12px; overflow: hidden; }
.eyesStar { font-size: 44px; will-change: transform; }
.balloonArea { height: 240px; display: grid; place-items: center; }
.balloon { font-size: 70px; }
.breakHint { font-weight: 600; }
.gameCard { padding: 14px; }
.gameHud { display: flex; justify-content: space-around; font-size: 20px; margin-bottom: 10px; }
.gameArea { position: relative; height: min(60vh, 440px); background: radial-gradient(circle at 50% 30%, #2d2a6e, #14123a); border-radius: 20px; overflow: hidden; touch-action: manipulation; }
.gameArea .breakHint { color: #fff; opacity: .7; margin-top: 40%; }
.gameStar { position: absolute; border: 0; background: none; font-size: 44px; cursor: pointer; padding: 6px; animation: pop .25s ease-out; }
.gameStar.caught { transform: scale(1.8); opacity: 0; transition: .2s; }
@keyframes pop { from { transform: scale(0); } }
.breakNudge { align-self: center; background: #fef3c7; color: #92400e; border-radius: 18px; padding: 10px 14px; text-align: center; font-weight: 600; max-width: 92%; }
.breakNudge .row { justify-content: center; margin-top: 8px; }
.breakNudge .btn { padding: 8px 14px; font-size: 15px; }
.msg.breakLog { align-self: center; background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; font-size: 14px; padding: 8px 14px; }
@media (prefers-reduced-motion: reduce) { .bounce { animation: none; } }

/* Вход, регистрация, кабинет родителя */
#welcome, #kidWait { padding: max(40px, calc(env(safe-area-inset-top) + 24px)) 16px 32px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
#kidSignup, #parentAuth, #approve, #profiles { padding-bottom: 32px; }
.hero.small h1 { font-size: 24px; }
.hero.small .appLogo { width: 64px; height: 64px; border-radius: 16px; }
.roleBtns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(440px, 100%); }
.roleBtn { border: 2px solid var(--border); background: var(--card); border-radius: 24px; padding: 22px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; box-shadow: var(--shadow); color: var(--text); }
.roleBtn:hover { border-color: var(--accent); transform: translateY(-2px); }
.roleBtn span { font-size: 52px; }
.roleBtn b { font-size: 19px; }
.roleBtn small { color: var(--muted); }
.authForm { width: min(440px, calc(100% - 32px)); margin: 8px auto 0; display: flex; flex-direction: column; gap: 12px; }
.authForm h2 { margin: 0; }
.authForm label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.authForm input, .authForm select { border: 2px solid var(--border); border-radius: 12px; padding: 11px 12px; background: var(--card); font-weight: 400; }
.socialBtns { display: flex; flex-direction: column; gap: 8px; }
.btn.social { width: 100%; }
.btn.apple { background: #000; color: #fff; }
.btn.google { background: #fff; color: #333; border: 2px solid var(--border); }
.or { text-align: center; color: var(--muted); font-size: 14px; margin-top: 4px; }
.waitCode { font-size: 44px; font-weight: 800; letter-spacing: .08em; color: var(--accent); font-variant-numeric: tabular-nums; }
.waitQr { width: 220px; height: 220px; border-radius: 16px; background: #fff; padding: 8px; box-shadow: var(--shadow); display: block; margin: 0 auto; }
.note.center, .center { text-align: center; }
.familyStatus { margin: 8px 16px; background: var(--card); border: 2px solid var(--border); border-radius: 18px; padding: 12px 14px; font-weight: 600; }
.familyStatus.ok { border-color: #a7f3d0; }
.familyStatus.warn { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.familyStatus small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
#profiles .kids { padding: 0 16px; margin-top: 8px; }
.kid .badge.pending { background: #e0e7ff; color: #3730a3; }
.parentActions { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.familySettings { margin: 0 16px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px; }
.familySettings summary { font-weight: 700; cursor: pointer; }
.familySettings .rRow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.inviteCode { font-family: ui-monospace, monospace; font-size: 20px; font-weight: 700; background: var(--accent-soft); color: var(--accent); padding: 4px 10px; border-radius: 10px; letter-spacing: .05em; }
.approveKid { display: flex; align-items: center; gap: 12px; background: var(--card); border: 2px solid var(--border); border-radius: 18px; padding: 12px 14px; font-size: 18px; }
.approveKid span { font-size: 44px; }
.consent { background: var(--card); border-radius: 18px; padding: 4px 14px; color: var(--text); font-size: 15px; }
.consentCheck { flex-direction: row !important; align-items: flex-start; font-weight: 600; }
.consentCheck input { margin-top: 3px; flex: none; }
#kidWait .tutorBig { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow); border: 4px solid var(--card); }
#kidWait .hero h1 { margin-top: 10px; }
#profiles > .familyStatus, #profiles > .parentActions, #profiles > .familySettings, #profiles > .kids { align-self: stretch; margin-left: 0; margin-right: 0; }
#profiles > .parentActions { padding: 0; }
#profiles > .kids { padding: 0; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
#approve { padding-top: max(16px, env(safe-area-inset-top)); } /* у остальных экранов отступ под вырез даёт шапка .bar.plain */
#approve .authForm { margin-top: 24px; }
.billing { margin-top: 10px; font-weight: 400; }
.billing .rRow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn.plan { width: 100%; margin-top: 8px; }
.joinHint { grid-column: 1 / -1; background: var(--accent-soft); border-radius: 18px; padding: 12px 14px; }
.joinHint .rRow { display: flex; gap: 8px; margin-top: 6px; }
.joinHint input { flex: 1; min-width: 0; border: 2px solid var(--border); border-radius: 12px; padding: 9px 12px; background: var(--card); }

/* Переключатель языка: Рус / Қаз */
.langSwitch { flex: none; display: inline-flex; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.langSwitch button { border: 0; background: none; border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.langSwitch button[aria-pressed="true"] { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }

/* ---------- Новый дизайн: тетрадь в клетку, фиолетовый, жёлтые звёзды ---------- */
.display { margin: 0; font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1.2; overflow-wrap: anywhere; }
.hello { font-size: 15px; color: var(--muted); }
.starIcon { width: 1em; height: 1em; flex: none; }
.screen { padding-left: 20px; padding-right: 20px; }
#chat { padding: 0; }
.authForm, .parentHead { width: 100%; max-width: 480px; margin-left: auto; margin-right: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border-radius: 14px; padding: 10px 16px; font-weight: 600; font-size: 15px; }
.btn.big { min-height: 56px; width: 100%; font-size: 17px; font-weight: 700; border-radius: 16px; margin: 0; padding: 10px 16px; }
.btn.ghost { background: var(--accent-soft); color: var(--accent-dark); }
.btn.outline { background: var(--card); color: var(--text); border: 2px solid var(--text); }
.btn.outlineSoft { background: var(--card); color: var(--text); border: 1px solid var(--border-strong); }
.btn.dashed { background: var(--card); color: var(--text); border: 2px dashed var(--border-strong); }
.btn.danger { color: var(--danger); }
.icon { color: var(--text); }
.icon:hover { background: var(--accent-soft); }
.linkBtn { min-height: 44px; }
.note { color: var(--muted); }
input, select, textarea { font-size: 16px !important; }

/* Звёзды */
.stars { display: inline-flex; align-items: center; gap: 4px; flex: none; height: 32px; padding: 0 10px; border-radius: 16px; background: var(--yellow); color: var(--on-yellow); font-weight: 700; font-size: 14px; }
.stars.big { height: 44px; padding: 0 14px; border-radius: 22px; font-size: 17px; gap: 6px; }

/* Первый экран */
#welcome { min-height: 100dvh; display: flex; flex-direction: column; align-items: stretch; gap: 24px; padding: max(24px, calc(env(safe-area-inset-top) + 12px)) 24px max(28px, env(safe-area-inset-bottom)); max-width: 480px; }
.welcomeLang { display: flex; justify-content: flex-end; }
.welcomePics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.welcomePics img { width: 100%; height: 150px; border-radius: 20px; object-fit: cover; margin-top: 28px; }
.welcomePics img:nth-child(2) { margin-top: 0; }
.welcomeText { display: flex; flex-direction: column; gap: 12px; }
.welcomeText .display { font-size: 30px; }
.welcomeText p { margin: 0; font-size: 18px; }
.roleBtns { margin-top: auto; display: flex; flex-direction: column; gap: 10px; width: 100%; }

/* Регистрация ученика */
.bar.plain { padding: max(8px, env(safe-area-inset-top)) 0 0; margin-left: -12px; }
.bar.plain .display { flex: 1; min-width: 0; }
#kidSignup, #parentAuth, #approve { padding-bottom: 32px; }
.authForm { margin-top: 8px; gap: 16px; }
.authForm label, .fieldLabel { font-size: 15px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 8px; }
.authForm input:not([type="checkbox"]), .kForm input, dialog input, dialog select { min-height: 52px; padding: 0 16px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--card); }
.authForm input:focus, .kForm input:focus { border: 2px solid var(--accent); outline: none; }
.gradePick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.gradePick button { height: 48px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); font-weight: 600; cursor: pointer; }
.agePick button { height: 56px; font-size: 18px; }
.agePick .ageAdult { grid-column: span 6; }
.gradePick button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.avatars legend { font-size: 15px; margin-bottom: 8px; }
#signupAvatars, #avatarPick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
#signupAvatars button, #avatarPick button { width: auto; height: 56px; font-size: 28px; border: 0; border-radius: 16px; background: var(--accent-soft); cursor: pointer; }
#signupAvatars button[aria-pressed="true"], #avatarPick button[aria-pressed="true"] { background: var(--yellow); box-shadow: inset 0 0 0 3px #1C2147; }

/* Ученик ждёт разрешения; конец пробного периода */
#kidWait, #kidEnded { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; padding: max(40px, calc(env(safe-area-inset-top) + 24px)) 24px max(28px, env(safe-area-inset-bottom)); max-width: 480px; }
#kidWait p, #kidEnded p { margin: 0; font-size: 16px; }
#kidEnded { padding-top: max(80px, calc(env(safe-area-inset-top) + 48px)); }
#kidEnded p { font-size: 17px; }
.tutorSquare { width: 96px; height: 96px; border-radius: 24px; object-fit: cover; }
.tutorSquare.big { width: 120px; height: 120px; border-radius: 28px; }
.waitBox { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px; border-radius: 20px; background: var(--card); border: 1px solid var(--border); }
.waitCode { font-family: var(--display); font-size: 30px; letter-spacing: 2px; color: var(--text); font-weight: 700; }
.waitQr { width: 170px; height: 170px; box-shadow: none; }
#waitShare, #endedShare { margin-top: auto; }

/* Вход родителя */
.socialBtns { gap: 10px; }
.btn.social { min-height: 52px; font-size: 16px; }
.btn.apple { background: #000; }
.btn.google { background: var(--card); color: var(--text); border: 1px solid var(--border-strong); }
.or { display: flex; align-items: center; gap: 10px; margin: 6px 0 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.segmented { background: var(--grid); padding: 4px; margin: 0; border-radius: 14px; gap: 4px; }
.segmented button { min-height: 44px; border-radius: 11px; }
.segmented button[aria-pressed="true"] { color: var(--text); box-shadow: none; }
.kForm { gap: 12px; margin-top: 0; }

/* Родитель: главная */
#profiles { padding: max(24px, calc(env(safe-area-inset-top) + 12px)) 16px 32px; align-items: stretch; gap: 12px; max-width: 520px; }
.parentHead { display: flex; flex-direction: column; gap: 2px; padding: 0 4px; }
.parentHead .hello:empty { display: none; }
.familyStatus, .familyStatus.ok, .familyStatus.warn { margin: 0; border: 1px solid var(--border); border-radius: 16px; font-size: 14px; }
.familyStatus.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn-text); }
.familyStatus.warn small { color: var(--warn-text); }
.billing { margin-top: 10px; }
.billing .btn { width: 100%; }
.kids { display: flex; flex-direction: column; gap: 10px; }
#profiles > .kids { padding: 0; margin: 0; }
.kid { display: flex; flex-direction: column; gap: 10px; text-align: left; border: 1px solid var(--border); border-radius: 18px; padding: 14px; }
.kid:hover, .kid:focus-visible { transform: none; border-color: var(--accent); }
.kidTop { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kid .ava { font-size: 24px; line-height: 1; }
.kid .name { margin: 0; font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kidGrade { color: var(--muted); font-size: 14px; flex: none; }
.kid .edit { position: static; margin-left: auto; width: 40px; height: 40px; display: grid; place-items: center; color: var(--muted); opacity: 1; flex: none; margin-top: -8px; margin-right: -8px; margin-bottom: -8px; }
.kidActive { font-size: 13px; font-weight: 600; }
.kidActive.yes { color: var(--good-text); }
.kidActive.no { color: var(--warn-text); }
.kidMeta { font-size: 14px; color: var(--muted); }
.kidDiary { align-self: flex-start; min-height: 44px; padding: 0 8px 0 0; margin: -8px 0 -10px; border: 0; background: none; color: var(--accent-dark); font-weight: 600; font-size: 14px; cursor: pointer; }
.segs { display: grid; gap: 6px; }
.segs i { display: block; height: 8px; border-radius: 4px; background: var(--accent-track); }
.segs i.on { background: var(--yellow); }
.segs.green i { background: var(--border); }
.segs.green i.on { background: var(--good); }
.parentActions, #profiles > .parentActions { padding: 0; margin-top: 4px; gap: 8px; }
.actionPair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.actionPair .btn { min-height: 56px; }
.familySettings { background: none; border: 0; padding: 4px; }
#profiles > .familySettings { margin: 0; }
.familySettings summary { color: var(--muted); font-weight: 600; font-size: 15px; text-align: center; min-height: 44px; display: flex; align-items: center; justify-content: center; list-style: none; }
.familySettings summary::-webkit-details-marker { display: none; }
.familySettings[open] #familySettings { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 4px 14px; }
.joinHint { background: var(--accent-soft); }

/* Разрешение родителя */
.approveKid { background: var(--accent); border: 0; color: var(--on-accent); border-radius: 16px; padding: 14px; }
.approveKid .note { color: var(--on-accent); }
.consent { border: 1px solid var(--border); border-radius: 16px; padding: 4px 14px; }
.consentFree { font-weight: 600; }
.consentCheck { background: var(--card); border: 2px solid var(--accent); border-radius: 16px; padding: 12px 14px; }
.consentCheck input { width: 24px; height: 24px; min-height: 0 !important; margin: 0; }
.aiConsent { display: flex; flex-direction: row !important; font-weight: 400 !important; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; color: var(--muted); text-align: left; cursor: pointer; }
.aiConsent input { width: 22px; height: 22px; min-height: 0 !important; margin: 0; flex: none; accent-color: var(--accent); }
.docLinks a, .aiConsent a { color: var(--accent); }
#approve .row .btn { flex: 1; min-height: 56px; }
#approve .row .spacer { display: none; }

/* Главная ребёнка */
#tutors { padding-top: max(20px, calc(env(safe-area-inset-top) + 8px)); padding-bottom: 28px; max-width: 520px; }
.backFloat { margin: -8px 0 4px -12px; }
.kidHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 20px; }
.kidHello { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hwSummary { margin: 0 0 20px; }
.hwCard, .hwCard.todo, .hwCard.clear { display: flex; flex-direction: column; gap: 12px; width: 100%; padding: 18px; border: 0; border-radius: 20px; background: var(--accent); color: var(--on-accent); text-align: left; cursor: pointer; font-size: 15px; }
.hwCardTop { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hwCardTop b { font-size: 17px; font-weight: 600; }
.hwNext { line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pickTitle { margin: 0 0 10px; text-align: left; font-size: 15px; font-weight: 600; color: var(--muted); }
.tutorList { padding: 0; gap: 10px; }
.tutor { gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 20px; }
.tutor:hover, .tutor:focus-visible { transform: none; }
.tutor img { width: 72px; height: 72px; border-radius: 16px; }
.tutor .tName { font-size: 17px; }
.tutor .tSubj { color: var(--muted); font-weight: 400; font-size: 14px; margin: 3px 0 0; }
.tutor .tLast { color: var(--accent-dark); font-weight: 600; margin-top: 3px; }
.footLang { display: flex; justify-content: center; margin-top: 20px; }
.langSwitch { background: var(--card); }
.langSwitch button { min-height: 32px; }
.langSwitch button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; }

/* Чат */
.bar:not(.plain) { padding: max(8px, env(safe-area-inset-top)) 8px 10px; gap: 6px; }
#chat .bar .icon { width: 36px; }
.who { gap: 8px; }
.who img { width: 40px; height: 40px; border-radius: 12px; display: block; }
.whoText { display: flex; flex-direction: column; min-width: 0; }
.whoText b { font-size: 15px; }
.whoText small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.messages { padding: 16px; gap: 10px; }
.msg { max-width: 84%; padding: 12px 14px; font-size: 16px; line-height: 1.4; border-radius: 18px; }
.msg.user { border-radius: 18px 18px 6px 18px; }
.msg.assistant { border-radius: 18px 18px 18px 6px; }
.msg.correct { background: var(--yellow-soft); border: 2px solid var(--yellow); }
.correctHead { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-family: var(--display); font-weight: 700; font-size: 14px; }
.correctHead .starIcon { width: 18px; height: 18px; }
.msg.error { background: var(--warn-soft); color: var(--warn-text); border-color: transparent; }
.welcome .tutorBig { width: 96px; height: 96px; border-radius: 24px; border: 0; }
.composer { padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.inputRow { gap: 8px; }
.inputRow .icon, .inputRow .photo { width: 44px; height: 44px; border-radius: 14px; flex: none; }
.photo { background: var(--accent-soft); color: var(--accent-dark); }
.mic, .send, .send:hover { background: var(--accent); color: var(--on-accent); border-radius: 14px; }
.mic:hover { background: var(--accent); }
textarea { border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; line-height: 1.4; scrollbar-width: none; }
textarea::-webkit-scrollbar { display: none; }
textarea:placeholder-shown { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Пока поле пустое — микрофон; появился текст или фото — кнопка отправки. */
.inputRow:has(#mic:not([hidden])):has(#input:placeholder-shown) .send { display: none; }
.composer:has(.previews:not(:empty)) .send { display: grid !important; }
.inputRow:has(#input:not(:placeholder-shown)) .mic:not(.listening) { display: none; }
.composer:has(.previews:not(:empty)) .mic:not(.listening) { display: none; }
.bigStar { color: var(--yellow); }
.cheer { font-family: var(--display); font-size: 22px; color: var(--text); }

/* Дневник */
#homework { padding-bottom: 32px; max-width: 520px; }
#homework .bar.plain, #parent .bar.plain { margin-bottom: 8px; gap: 6px; }
.hwList { padding: 0; gap: 10px; }
.hwGroup { text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 600; color: var(--muted); margin: 8px 0 -2px; }
.hwGroup.overdue { color: var(--danger); }
.hwItem { display: flex; gap: 12px; padding: 14px; border-radius: 18px; }
.hwItem.next { border: 2px solid var(--accent); }
.hwItem.done { opacity: 1; background: var(--good-soft); border-color: var(--good-border); }
.hwItem.done .hwText { text-decoration: none; color: var(--good-text); }
.hwItem .mark { flex: none; width: 44px; height: 44px; margin: -8px 0 0 -8px; padding: 0; border: 0; background: none; display: grid; place-items: center; cursor: pointer; }
.hwItem .box { display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--border-strong); border-radius: 8px; color: #fff; }
.hwItem.next .box { border-color: var(--accent); }
.hwItem.done .box { background: var(--good); border-color: var(--good); }
.hwBody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hwHead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.hwItem .hwSubj { font-size: 17px; padding: 0; min-width: 0; overflow-wrap: anywhere; }
.hwTag { flex: none; font-size: 12px; color: var(--muted); }
.hwItem.done .hwTag { color: var(--good-text); }
.hwItem .hwText { margin: 0; font-size: 15px; line-height: 1.35; }
.hwItem .hwDue { font-size: 13px; color: var(--muted); }
.hwItem .hwBtns { margin-top: 6px; gap: 6px; flex-wrap: nowrap; align-items: stretch; }
.hwItem .hwBtns:has(.solve) { margin-top: 8px; }
.hwItem .solve { flex: 1; min-width: 0; min-height: 44px; justify-content: center; background: var(--accent-soft); color: var(--accent-dark); }
.hwItem .hwBtns .solve { padding: 7px 8px; font-size: 14px; }
.hwItem.next .solve { background: var(--accent); color: var(--on-accent); }
.hwItem .del { position: static; margin-left: auto; width: 44px; height: 44px; display: grid; place-items: center; padding: 0 !important; }
.hwItem.done .hwBtns { position: absolute; right: 6px; bottom: 6px; margin: 0; }
.hwActions { flex-direction: column; flex-wrap: nowrap; padding: 0; margin-top: 16px; gap: 8px; }
.hwActions .btn { flex: none; width: 100%; min-height: 52px; font-size: 16px; }
.reminderCard { margin: 16px 0 0; border-radius: 18px; }

/* Родитель: занятия */
#parent { padding-bottom: 32px; max-width: 520px; padding-left: 16px; padding-right: 16px; }
.chips { padding: 0 0 12px; }
.chips button { min-height: 44px; padding: 0 18px; border: 1px solid var(--border); border-radius: 22px; }
.chips button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.parentStats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 4px; padding: 0; background: none; border: 0; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); min-width: 0; }
.tile b { font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.tile span { font-size: 13px; color: var(--muted); }
.parentLog { padding: 0; }
.dayHead { font-size: 14px; font-weight: 600; margin: 10px 4px -2px; }
.sess { border-radius: 18px; }
.sessPics img { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--card); }
.sumSubj { color: var(--accent-dark); }
.sumHard { background: var(--bg); padding: 8px 10px; border-radius: 10px; font-size: 14px; opacity: 1; }
.sumWarn { background: var(--warn-soft); color: var(--warn-text); font-size: 14px; }
.sessOpen { min-height: 44px; border: 0; color: var(--accent-dark); font-weight: 600; }
.pline.user .pwho, .inviteCode { color: var(--accent-dark); }

/* Подписка */
#paywall { min-height: 100dvh; display: flex; flex-direction: column; gap: 14px; padding: max(12px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom)); max-width: 480px; }
.closeBtn { align-self: flex-end; margin-right: -10px; margin-bottom: -10px; }
.payLead { margin: -8px 0 0; font-size: 15px; color: var(--muted); }
.payList { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 15px; line-height: 1.3; }
.payList li { position: relative; padding-left: 30px; }
.payList li::before { content: ""; position: absolute; left: 0; top: 0; width: 20px; height: 20px; background: var(--good);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.500l4.500 4.500L19 7.500'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.500l4.500 4.500L19 7.500'/%3E%3C/svg%3E") center / contain no-repeat; }
.payPlans { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.plan { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 68px; padding: 12px 16px; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--card); text-align: left; cursor: pointer; }
.plan[aria-pressed="true"] { border: 3px solid var(--accent); padding: 10px 14px; }
.planName { display: flex; flex-direction: column; gap: 2px; font-size: 17px; }
.planName small { font-size: 13px; color: var(--muted); }
.planPrice { font-size: 18px; flex: none; }
.planBadge { position: absolute; top: -11px; left: 14px; padding: 2px 10px; border-radius: 10px; background: var(--yellow); color: var(--on-yellow); font-size: 12px; font-weight: 700; }
#payBuy, #payWeb { margin-top: auto; }
.payFine { margin: 0; font-size: 12px; line-height: 1.35; color: var(--muted); text-align: center; }
#payRestore { align-self: center; }

/* Переменка */
.breakScreen { background: var(--accent); }
.breakTop .icon { background: var(--accent-dark); color: #fff; }
.breakCard { box-shadow: none; }
.breakCard h2 { font-family: var(--display); font-size: 22px; }
.breakTutor { border-radius: 16px; border: 2px solid var(--accent-soft); }
.breakKinds button { border: 1px solid var(--border); border-radius: 16px; }
.breakCount { font-family: var(--display); color: var(--text); }
.breakBar { background: var(--accent-soft); }
.breakBar i { background: var(--yellow); }
.breakNudge { background: var(--yellow-soft); color: var(--text); }
.msg.breakLog { background: var(--good-soft); color: var(--good-text); border-color: var(--good-border); }
.shareBanner { background: var(--yellow-soft); color: var(--text); }

/* Диалоги */
dialog { border-radius: 20px; }
dialog h2 { font-family: var(--display); font-size: 20px; }
/* Окно «Аккаунт» ученика 13+: ряды кнопок не слипаются, подписка — во всю ширину */
#teenDialog .row { margin-top: 12px; }
#teenDialog #teenPay { width: 100%; }
#teenDialog .docLinks { margin-top: 16px; }
.kid .badge { display: none; }
/* Kundelik и Telegram выключены у семьи — карточка пустая, рамку не показываем */
.reminderCard:empty { display: none; }
