/* ============================================
   המערכתAI — אפליקציית תלמיד (mobile-first)
   ============================================ */

:root {
	--sapp-bg: #0b1226;
	--sapp-bg2: #131c38;
	--sapp-card: #1a2547;
	--sapp-card2: #21306022;
	--sapp-ink: #eef2ff;
	--sapp-muted: #a3b4dc;
	--sapp-accent: #6366f1;
	--sapp-accent2: #22d3ee;
	--sapp-ok: #34d399;
	--sapp-warn: #fbbf24;
	--sapp-danger: #f87171;
	--sapp-radius: 18px;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	background: var(--sapp-bg);
	color: var(--sapp-ink);
	font-family: 'Heebo', system-ui, sans-serif;
	-webkit-font-smoothing: antialiased;
	height: 100%;
	min-height: 100%;
}

body.sapp {
	overflow: hidden;
	overscroll-behavior: none;
}

body.sapp.sapp--sheet-open {
	touch-action: none;
}

.sapp__root {
	width: 100%;
	max-width: none;
	margin: 0;
	height: 100dvh;
	height: 100vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	padding:
		env(safe-area-inset-top)
		max(10px, env(safe-area-inset-right))
		env(safe-area-inset-bottom)
		max(10px, env(safe-area-inset-left));
}

.sapp-app {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
}

.sapp-app__main {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

/* שכבת חלונות — מעל התוכן, לא דוחפת */
.sapp-overlays {
	position: fixed;
	inset: 0;
	z-index: 200;
	pointer-events: none;
}

.sapp-sheet-backdrop {
	position: fixed;
	inset: 0;
	border: 0;
	padding: 0;
	margin: 0;
	background: rgb(2 6 23 / 62%);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.28s ease;
	cursor: default;
}

.sapp-sheet-backdrop.is-visible {
	opacity: 1;
	pointer-events: auto;
}

.sapp-sheet-handle {
	width: 38px;
	height: 4px;
	margin: 0 auto 10px;
	border-radius: 999px;
	background: rgb(148 163 184 / 45%);
}

/* ---------- Login ---------- */

.sapp-login {
	display: flex;
	flex-direction: column;
	justify-content: center;
	flex: 1 1 auto;
	min-height: 0;
	gap: 22px;
}

.sapp-login__logo {
	text-align: center;
}

.sapp-login__logo-mark {
	display: inline-grid;
	place-items: center;
	width: 84px;
	height: 84px;
	border-radius: 26px;
	background: linear-gradient(135deg, var(--sapp-accent), var(--sapp-accent2));
	font-size: 2.4rem;
	margin-bottom: 14px;
	box-shadow: 0 14px 44px rgb(99 102 241 / 35%);
}

.sapp-login__title {
	margin: 0;
	font-size: 1.7rem;
	font-weight: 900;
	letter-spacing: -0.02em;
}

.sapp-login__subtitle {
	margin: 6px 0 0;
	color: var(--sapp-muted);
	font-size: 0.95rem;
}

.sapp-card {
	background: linear-gradient(180deg, var(--sapp-card), #16203f);
	border: 1px solid #2b3a6b55;
	border-radius: var(--sapp-radius);
	padding: 20px;
}

.sapp-field {
	display: block;
	margin-bottom: 14px;
}

.sapp-field span {
	display: block;
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--sapp-muted);
	margin-bottom: 6px;
}

.sapp-input {
	width: 100%;
	padding: 14px 16px;
	font-size: 1.25rem;
	font-weight: 700;
	font-family: inherit;
	text-align: center;
	letter-spacing: 0.18em;
	color: var(--sapp-ink);
	background: #0e1730;
	border: 1.5px solid #2b3a6b;
	border-radius: 14px;
	outline: none;
	transition: border-color 0.15s;
}

.sapp-input:focus {
	border-color: var(--sapp-accent);
}

.sapp-btn {
	width: 100%;
	padding: 15px;
	font-size: 1.05rem;
	font-weight: 800;
	font-family: inherit;
	color: #fff;
	background: linear-gradient(135deg, var(--sapp-accent), #818cf8);
	border: 0;
	border-radius: 14px;
	cursor: pointer;
	transition: transform 0.1s, opacity 0.15s;
}

.sapp-btn:active { transform: scale(0.98); }
.sapp-btn:disabled { opacity: 0.45; cursor: default; }

.sapp-btn--ghost {
	background: transparent;
	border: 1.5px solid #2b3a6b;
	color: var(--sapp-muted);
	font-weight: 700;
}

.sapp-login__err {
	margin: 0;
	padding: 10px 14px;
	border-radius: 12px;
	background: #f8717122;
	border: 1px solid #f8717155;
	color: #fca5a5;
	font-size: 0.88rem;
	text-align: center;
}

.sapp-login__demo {
	margin: 0 0 10px;
	padding: 10px 14px;
	border-radius: 12px;
	background: #22d3ee18;
	border: 1px dashed #22d3ee66;
	color: #67e8f9;
	font-size: 0.85rem;
	text-align: center;
}

.sapp-login__demo--banner {
	margin-bottom: 12px;
	font-weight: 700;
}

.sapp-head__demo-badge {
	display: inline-flex;
	align-items: center;
	padding: 4px 9px;
	border-radius: 999px;
	border: 1px dashed rgb(34 211 238 / 45%);
	background: rgb(34 211 238 / 12%);
	color: #67e8f9;
	font-size: 0.62rem;
	font-weight: 800;
	line-height: 1;
	letter-spacing: 0.02em;
}

.sapp-login__hint {
	margin: 0;
	text-align: center;
	color: var(--sapp-muted);
	font-size: 0.8rem;
}

/* ---------- App shell ---------- */

.sapp-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 6px 2px 10px;
	flex: 0 0 auto;
}

.sapp-head__main {
	flex: 1;
	min-width: 0;
}

.sapp-head__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
	padding-top: 2px;
}

.sapp-head__hello {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 900;
}

.sapp-profile-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 0;
	padding: 7px 12px;
	border-radius: 999px;
	border: 1px solid rgb(129 140 248 / 35%);
	background: rgb(30 41 82 / 55%);
	color: #c7d2fe;
	font-family: inherit;
	font-size: 0.74rem;
	font-weight: 800;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.sapp-profile-toggle__icon {
	font-size: 0.95rem;
	line-height: 1;
}

.sapp-profile-toggle__chev {
	font-size: 0.72rem;
	line-height: 1;
	transition: transform 0.25s ease;
}

.sapp-profile-toggle.is-open .sapp-profile-toggle__chev {
	transform: rotate(180deg);
}

.sapp-profile-toggle.has-filter {
	border-color: rgb(34 211 238 / 45%);
	box-shadow: 0 0 0 1px rgb(34 211 238 / 22%);
}

.sapp-profile-panel {
	display: block;
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 210;
	max-height: min(82dvh, 620px);
	padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
	border-radius: 22px 22px 0 0;
	background: linear-gradient(180deg, rgb(24 36 68 / 98%), rgb(14 22 44 / 99%));
	border: 1px solid rgb(129 140 248 / 32%);
	border-bottom: 0;
	box-shadow: 0 -18px 40px rgb(0 0 0 / 42%);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	transform: translateY(calc(100% + 24px));
	transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
	pointer-events: auto;
	visibility: hidden;
}

.sapp-profile-panel.is-open {
	transform: translateY(0);
	visibility: visible;
}

.sapp-profile-panel__title {
	margin: 0 0 10px;
	font-size: 0.88rem;
	font-weight: 900;
	color: var(--sapp-ink);
}

.sapp-profile-panel__group {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 8px;
}

.sapp-profile-panel__group:last-of-type {
	margin-bottom: 0;
}

.sapp-profile-panel__label {
	display: block;
	width: 100%;
	margin-bottom: 2px;
	font-size: 0.64rem;
	font-weight: 800;
	color: var(--sapp-muted);
}

.sapp-profile-clear {
	display: block;
	width: 100%;
	margin-top: 8px;
	padding: 8px;
	border: 1px dashed rgb(129 140 248 / 35%);
	border-radius: 10px;
	background: transparent;
	color: #93c5fd;
	font-family: inherit;
	font-size: 0.72rem;
	font-weight: 800;
	cursor: pointer;
}

.sapp-profile-clear[hidden] {
	display: none;
}

.sapp-chip {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 700;
	background: #6366f126;
	color: #a5b4fc;
	border: 1px solid #6366f140;
}

.sapp-chip--filter {
	cursor: pointer;
	font-family: inherit;
	transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.sapp-chip--filter.is-active {
	background: linear-gradient(135deg, rgb(99 102 241 / 55%), rgb(56 189 248 / 42%));
	color: #f8fafc;
	border-color: rgb(34 211 238 / 45%);
	box-shadow: 0 4px 14px rgb(99 102 241 / 22%);
	transform: translateY(-1px);
}

.sapp-chip--info {
	background: rgb(51 65 85 / 35%);
	color: #cbd5e1;
	border-color: rgb(100 116 139 / 35%);
	cursor: default;
}

.sapp-chip--track {
	background: #22d3ee1c;
	color: #67e8f9;
	border-color: #22d3ee40;
}

.sapp-chip--subject {
	background: rgb(129 140 248 / 14%);
	color: #c4b5fd;
	border-color: rgb(129 140 248 / 32%);
}

.sapp-head__meta {
	margin: 3px 0 0;
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.sapp-head__logout {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 7px 11px;
	border-radius: 999px;
	border: 1px solid rgb(248 113 113 / 42%);
	background: rgb(127 29 29 / 28%);
	color: #fecaca;
	font-family: inherit;
	font-size: 0.72rem;
	font-weight: 800;
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.sapp-head__logout-icon {
	display: grid;
	place-items: center;
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
}

.sapp-head__logout-icon svg {
	width: 16px;
	height: 16px;
	display: block;
}

.sapp-head__logout:hover {
	background: rgb(153 27 27 / 38%);
	border-color: rgb(248 113 113 / 58%);
	box-shadow: 0 0 0 1px rgb(248 113 113 / 18%);
}

.sapp-head__logout:active {
	transform: scale(0.97);
}

@media (max-width: 380px) {
	.sapp-head__logout-text,
	.sapp-profile-toggle__text {
		display: none;
	}

	.sapp-head__logout,
	.sapp-profile-toggle {
		padding: 8px 9px;
	}
}

/* ---------- View switch ---------- */

.sapp-switch {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 4px;
	background: #0e1730;
	border-radius: 14px;
	padding: 4px;
	margin-bottom: 8px;
	flex: 0 0 auto;
}
	margin-bottom: 16px;
}

.sapp-switch button {
	padding: 10px;
	font-size: 0.9rem;
	font-weight: 800;
	font-family: inherit;
	color: var(--sapp-muted);
	background: transparent;
	border: 0;
	border-radius: 11px;
	cursor: pointer;
}

.sapp-switch button.is-active {
	background: linear-gradient(135deg, var(--sapp-accent), #818cf8);
	color: #fff;
}

/* ---------- Day strip ---------- */

.sapp-days {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 6px;
	margin-bottom: 18px;
}

.sapp-day-pill {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	padding: 9px 2px;
	border-radius: 13px;
	border: 1.5px solid transparent;
	background: #0e1730;
	color: var(--sapp-muted);
	font-family: inherit;
	cursor: pointer;
}

.sapp-day-pill strong {
	font-size: 1.05rem;
	color: var(--sapp-ink);
}

.sapp-day-pill span {
	font-size: 0.68rem;
	font-weight: 700;
}

.sapp-day-pill.is-selected {
	border-color: var(--sapp-accent);
	background: #6366f122;
}

.sapp-day-pill.is-today strong {
	color: var(--sapp-accent2);
}

/* ---------- Timeline (day view) ---------- */

.sapp-timeline {
	display: grid;
	gap: 10px;
	padding-bottom: 10px;
}

.sapp-lesson {
	display: flex;
	gap: 14px;
	align-items: stretch;
}

.sapp-lesson__period {
	display: grid;
	place-items: center;
	width: 46px;
	flex-shrink: 0;
	border-radius: 14px;
	background: #0e1730;
	font-size: 1.15rem;
	font-weight: 900;
	color: var(--sapp-muted);
}

.sapp-lesson__card {
	flex: 1;
	padding: 13px 16px;
	border-radius: 15px;
	background: linear-gradient(180deg, var(--sapp-card), #16203f);
	border: 1px solid #2b3a6b44;
	border-inline-start: 4px solid var(--lesson-color, var(--sapp-accent));
	position: relative;
}

.sapp-lesson--now .sapp-lesson__card {
	border-color: var(--sapp-accent2);
	box-shadow: 0 0 0 1.5px var(--sapp-accent2), 0 8px 30px rgb(34 211 238 / 18%);
}

.sapp-lesson--now .sapp-lesson__period {
	background: linear-gradient(135deg, var(--sapp-accent2), #0891b2);
	color: #06243a;
}

.sapp-lesson__subject {
	margin: 0;
	font-size: 1.02rem;
	font-weight: 800;
}

.sapp-lesson__meta {
	margin: 4px 0 0;
	font-size: 0.8rem;
	color: var(--sapp-muted);
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.sapp-lesson__badge {
	position: absolute;
	top: 10px;
	inset-inline-end: 12px;
	font-size: 0.66rem;
	font-weight: 800;
	padding: 3px 9px;
	border-radius: 999px;
}

.sapp-lesson__badge--exam {
	background: #f8717126;
	color: #fca5a5;
	border: 1px solid #f8717150;
}

.sapp-lesson__badge--now {
	background: #22d3ee26;
	color: #67e8f9;
	border: 1px solid #22d3ee55;
}

.sapp-lesson__badge--group {
	background: #fbbf2422;
	color: #fcd34d;
	border: 1px solid #fbbf2444;
}

.sapp-gap {
	display: flex;
	gap: 14px;
	align-items: center;
}

.sapp-gap__period {
	width: 46px;
	flex-shrink: 0;
	text-align: center;
	color: #475577;
	font-weight: 800;
}

.sapp-gap__line {
	flex: 1;
	border-top: 2px dashed #2b3a6b66;
	position: relative;
}

.sapp-gap__label {
	font-size: 0.7rem;
	color: #475577;
	font-weight: 700;
}

/* ---------- Week grid ---------- */

.sapp-week {
	overflow-x: auto;
	border-radius: var(--sapp-radius);
	border: 1px solid rgb(255 255 255 / 6%);
	background: linear-gradient(180deg, #0c0d14 0%, #0a0b12 100%);
	padding: 10px;
}

.sapp-week__board {
	position: relative;
}

.sapp-week__grid {
	display: grid;
	gap: 4px;
	min-width: 480px;
}

.sapp-week__day-head {
	font-size: 0.7rem;
	font-weight: 800;
	color: var(--sapp-muted);
	text-align: center;
	padding: 6px 2px;
}

.sapp-week__day-head.is-today {
	color: #f1f5f9;
	text-shadow: 0 0 12px rgb(255 255 255 / 18%);
}

.sapp-week__period-label {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1px;
	font-size: 0.72rem;
	font-weight: 800;
	color: #475577;
}

.sapp-week__period-time {
	font-size: 0.52rem;
	font-weight: 600;
	color: rgb(148 163 184 / 72%);
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.sapp-week__period-num {
	font-size: 0.62rem;
	font-weight: 800;
	color: rgb(100 116 139 / 85%);
	line-height: 1;
}

/* קו שעה נוכחית — עמודת היום */
.sapp-week__now {
	position: absolute;
	top: var(--now-line-top, 50%);
	inset-inline-start: calc(36px + (100% - 36px) * var(--today-col, 0) / var(--col-count, 6));
	width: calc((100% - 36px) / var(--col-count, 6));
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	gap: 0;
	pointer-events: none;
	z-index: 4;
}

.sapp-week__now-beam {
	flex: 1 1 auto;
	height: 1px;
	background: linear-gradient(
		90deg,
		rgb(255 255 255 / 0%) 0%,
		rgb(255 255 255 / 55%) 8%,
		rgb(255 255 255 / 88%) 50%,
		rgb(255 255 255 / 55%) 92%,
		rgb(255 255 255 / 0%) 100%
	);
	box-shadow:
		0 0 8px rgb(255 255 255 / 35%),
		0 0 18px rgb(255 255 255 / 12%);
}

.sapp-week__now-cap {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	flex: 0 0 auto;
	padding: 3px 7px 4px;
	border-radius: 999px;
	background: rgb(12 13 20 / 94%);
	border: 1px solid rgb(255 255 255 / 22%);
	box-shadow:
		0 0 10px rgb(255 255 255 / 18%),
		0 2px 8px rgb(0 0 0 / 35%);
}

.sapp-week__now-clock-icon {
	display: block;
	width: 11px;
	height: 11px;
	border: 1.5px solid rgb(255 255 255 / 75%);
	border-radius: 50%;
	position: relative;
	flex: 0 0 auto;
}

.sapp-week__now-clock-icon::before,
.sapp-week__now-clock-icon::after {
	content: '';
	position: absolute;
	background: rgb(255 255 255 / 85%);
	border-radius: 1px;
	left: 50%;
	top: 50%;
	transform-origin: 0 100%;
}

.sapp-week__now-clock-icon::before {
	width: 1px;
	height: 3px;
	transform: translate(-50%, -100%) rotate(0deg);
}

.sapp-week__now-clock-icon::after {
	width: 1px;
	height: 4px;
	transform: translate(-50%, -100%) rotate(90deg);
}

.sapp-week__now-clock {
	font-size: 0.58rem;
	font-weight: 800;
	color: #f8fafc;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.sapp-week__cell {
	min-height: 44px;
	border-radius: 9px;
	padding: 5px 7px;
	font-size: 0.66rem;
	font-weight: 700;
	line-height: 1.25;
	background: var(--lesson-color, var(--sapp-card));
	color: #07112c;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.sapp-week__cell--empty {
	background: #131c38;
}

.sapp-week__cell--exam {
	outline: 2px solid var(--sapp-danger);
	outline-offset: -2px;
}

.sapp-week__cell.is-filter-dim {
	opacity: 0.2;
	filter: saturate(0.4);
}

.sapp-week__cell.is-filter-match {
	opacity: 1;
	box-shadow: 0 0 0 2px rgb(34 211 238 / 55%);
	transform: scale(1.02);
}

.sapp-week__cell small {
	font-weight: 600;
	opacity: 0.75;
	font-size: 0.6rem;
}

/* ---------- Exams ---------- */

.sapp-exams {
	display: grid;
	gap: 10px;
}

.sapp-exam {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 16px;
	border-radius: 15px;
	background: linear-gradient(180deg, var(--sapp-card), #16203f);
	border: 1px solid #2b3a6b44;
}

.sapp-exam__count {
	display: grid;
	place-items: center;
	width: 58px;
	height: 58px;
	flex-shrink: 0;
	border-radius: 16px;
	background: #f8717119;
	border: 1.5px solid #f8717144;
	flex-direction: column;
}

.sapp-exam__count strong {
	font-size: 1.25rem;
	color: #fca5a5;
	line-height: 1;
}

.sapp-exam__count span {
	font-size: 0.58rem;
	font-weight: 700;
	color: #f87171aa;
}

.sapp-exam__count--today {
	background: #f8717133;
}

.sapp-exam__subject {
	margin: 0;
	font-size: 0.98rem;
	font-weight: 800;
}

.sapp-exam__meta {
	margin: 3px 0 0;
	font-size: 0.78rem;
	color: var(--sapp-muted);
}

/* ---------- 3D day scene — מסלול ויזואלי ---------- */

.sapp-scene {
	--now-pct: 50%;
	--scene-ink: #f4f7ff;
	--scene-muted: #94a3b8;
	position: relative;
	margin-top: 10px;
	padding: 14px 10px 12px;
	border-radius: 22px;
	background:
		radial-gradient(ellipse 120% 80% at 50% 0%, rgb(30 32 48 / 55%) 0%, transparent 58%),
		radial-gradient(ellipse 90% 70% at 50% 100%, rgb(18 20 32 / 40%) 0%, transparent 55%),
		linear-gradient(180deg, #0c0d14 0%, #0a0b12 48%, #080910 100%);
	border: 1px solid rgb(255 255 255 / 6%);
	box-shadow:
		0 16px 36px rgb(0 0 0 / 32%),
		inset 0 1px 0 rgb(255 255 255 / 4%);
	overflow: hidden;
}

/* בורר תלת-מימד — צד ימין (RTL: inline-start) */
.sapp-scene {
	padding-inline-start: 64px;
}

.sapp-layer-dial {
	position: absolute;
	inset-inline-start: 8px;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	flex-direction: column;
	gap: 8px;
	z-index: 7;
	perspective: 380px;
}

.sapp-layer-dial__btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	width: 48px;
	padding: 8px 4px;
	border-radius: 13px;
	border: 1px solid rgb(129 140 248 / 30%);
	background: linear-gradient(160deg, rgb(36 52 92 / 90%), rgb(20 32 62 / 94%));
	color: var(--scene-muted, #b8c8ea);
	font-family: inherit;
	font-size: 0.56rem;
	font-weight: 800;
	cursor: pointer;
	box-shadow:
		0 6px 14px rgb(0 0 0 / 25%),
		inset 0 1px 0 rgb(255 255 255 / 10%);
	transform: rotateY(-16deg);
	transform-origin: 100% 50%;
	transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.sapp-layer-dial__icon {
	font-size: 1rem;
	line-height: 1;
}

.sapp-layer-dial__text {
	line-height: 1;
}

.sapp-layer-dial__btn:hover {
	transform: rotateY(-6deg);
	color: #e2e8f0;
}

.sapp-layer-dial__btn.is-active {
	color: #eef2ff;
	border-color: rgb(56 189 248 / 55%);
	background: linear-gradient(160deg, rgb(99 102 241 / 92%), rgb(56 189 248 / 72%));
	transform: rotateY(0deg) scale(1.08);
	box-shadow:
		0 8px 20px rgb(99 102 241 / 38%),
		0 0 16px rgb(56 189 248 / 25%);
}

/* סיבוב הסצנה לפי מיקוד + פרופורציות כוכבי הלכת */
.sapp-scene {
	--core-scale: 1.05;
	--planet-teacher-scale: 0.88;
	--planet-room-scale: 0.88;
	--arm-teacher: 54px;
	--arm-room: 56px;
}

.sapp-scene--focus-lesson .sapp-scene__columns {
	transform: rotateX(3deg);
}

.sapp-scene--focus-teacher {
	--core-scale: 0.6;
	--planet-teacher-scale: 1.12;
	--planet-room-scale: 0.55;
	--arm-teacher: 56px;
}

.sapp-scene--focus-teacher .sapp-scene__columns {
	transform: rotateX(-8deg) translateY(5px);
}

.sapp-scene--focus-room {
	--core-scale: 0.6;
	--planet-room-scale: 1.55;
	--planet-teacher-scale: 0.55;
	--arm-room: 62px;
}

.sapp-scene--focus-room .sapp-scene__columns {
	transform: rotateX(10deg) translateY(-4px);
}

.sapp-scene__progress,
.sapp-scene__time-top {
	display: none;
}

.sapp-scene__stage {
	overflow: hidden;
	padding: 8px 0 4px;
	perspective: 950px;
	position: relative;
}

.sapp-scene__columns {
	display: flex;
	flex-direction: row;
	align-items: stretch;
	justify-content: stretch;
	gap: 2px;
	width: 100%;
	min-width: 0;
	min-height: 240px;
	padding: 4px 8px 0;
	position: relative;
	perspective: 700px;
	transform-style: preserve-3d;
	transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

/* קו "עכשיו" — אנכי דק עם שעון */
.sapp-scene__now-beam {
	position: absolute;
	top: 0;
	bottom: 28px;
	inset-inline-start: var(--now-pct);
	width: 0;
	transform: translateX(-50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	pointer-events: none;
	z-index: 6;
}

.sapp-scene__now-line {
	flex: 1 1 auto;
	width: 1px;
	min-height: 40px;
	background: linear-gradient(
		180deg,
		rgb(255 255 255 / 0%) 0%,
		rgb(255 255 255 / 55%) 12%,
		rgb(255 255 255 / 88%) 50%,
		rgb(255 255 255 / 55%) 88%,
		rgb(255 255 255 / 0%) 100%
	);
	box-shadow:
		0 0 8px rgb(255 255 255 / 35%),
		0 0 20px rgb(255 255 255 / 12%);
}

.sapp-scene__now-cap {
	display: grid;
	place-items: center;
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: rgb(12 13 20 / 92%);
	border: 1px solid rgb(255 255 255 / 22%);
	box-shadow:
		0 0 10px rgb(255 255 255 / 18%),
		0 2px 8px rgb(0 0 0 / 35%);
}

.sapp-scene__now-cap--bottom {
	width: auto;
	height: auto;
	min-width: 22px;
	padding: 4px 7px 5px;
	border-radius: 999px;
	display: inline-flex;
	flex-direction: row;
	align-items: center;
	gap: 4px;
	margin-top: 2px;
}

.sapp-scene__now-clock-icon {
	display: block;
	width: 11px;
	height: 11px;
	border: 1.5px solid rgb(255 255 255 / 75%);
	border-radius: 50%;
	position: relative;
}

.sapp-scene__now-clock-icon::before,
.sapp-scene__now-clock-icon::after {
	content: '';
	position: absolute;
	background: rgb(255 255 255 / 85%);
	border-radius: 1px;
	left: 50%;
	top: 50%;
	transform-origin: 0 100%;
}

.sapp-scene__now-clock-icon::before {
	width: 1px;
	height: 3px;
	transform: translate(-50%, -100%) rotate(0deg);
}

.sapp-scene__now-clock-icon::after {
	width: 1px;
	height: 4px;
	transform: translate(-50%, -100%) rotate(90deg);
}

.sapp-scene__now-clock {
	font-size: 0.58rem;
	font-weight: 800;
	color: #f8fafc;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

/* ציר זמן תחתון */
.sapp-scene__axis {
	position: absolute;
	inset-inline: 8px;
	bottom: 28px;
	height: 0;
	pointer-events: none;
	z-index: 3;
}

.sapp-scene__axis-line {
	position: absolute;
	inset-inline: 14px 0;
	top: 0;
	height: 1px;
	background: rgb(148 163 184 / 22%);
}

.sapp-scene__axis-arrow {
	position: absolute;
	top: -4px;
	inset-inline-start: 0;
	font-size: 0.55rem;
	font-weight: 800;
	color: rgb(148 163 184 / 38%);
	line-height: 1;
}

.sapp-scene__axis-now {
	display: none;
}

/* קו אנכי דק מאחורי כל כדור */
.sapp-scene__col-guide {
	position: absolute;
	top: 22%;
	bottom: 42px;
	inset-inline-start: 50%;
	width: 1px;
	transform: translateX(-50%);
	background: linear-gradient(
		180deg,
		rgb(148 163 184 / 0%) 0%,
		rgb(148 163 184 / 12%) 22%,
		rgb(148 163 184 / 18%) 78%,
		rgb(148 163 184 / 28%) 100%
	);
	pointer-events: none;
	z-index: 0;
}

.sapp-scene__col {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	position: relative;
	z-index: 1;
}

.sapp-scene__col--gap {
	flex: 0 0 5px;
	min-width: 5px;
	opacity: 0.35;
}

.sapp-scene__axis-tick {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex: 0 0 auto;
	width: 100%;
	margin-top: auto;
	padding-top: 2px;
	position: relative;
	z-index: 2;
}

.sapp-scene__axis-tick-mark {
	display: block;
	width: 1px;
	height: 7px;
	margin-bottom: 3px;
	border-radius: 999px;
	background: rgb(148 163 184 / 38%);
}

.sapp-scene__axis-tick-label {
	display: block;
	font-size: 0.52rem;
	font-weight: 600;
	color: rgb(148 163 184 / 72%);
	line-height: 1;
}

.sapp-scene__axis-tick.is-now .sapp-scene__axis-tick-mark {
	height: 8px;
	background: rgb(255 255 255 / 72%);
	box-shadow: 0 0 6px rgb(255 255 255 / 28%);
}

.sapp-scene__axis-tick.is-now .sapp-scene__axis-tick-label {
	color: #f1f5f9;
	font-weight: 700;
}

.sapp-scene__axis-tick.is-past .sapp-scene__axis-tick-label {
	color: rgb(148 163 184 / 55%);
}

.sapp-scene__tick,
.sapp-scene__time-rail {
	display: none;
}

.sapp-scene__now-badge {
	position: absolute;
	top: -8px;
	left: 50%;
	transform: translate(-50%, -100%);
	font-size: 0.75rem;
	background: rgb(248 250 252 / 12%);
	border-radius: 999px;
	padding: 2px 6px;
}

.sapp-node {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0;
	width: 100%;
	position: relative;
	z-index: 2;
	perspective: 520px;
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.sapp-node--gap {
	flex: 1 1 auto;
	opacity: 0.35;
}

.sapp-node__gap-dot {
	display: block;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #475569;
	margin: auto;
}

.sapp-node.is-past {
	opacity: 1;
	filter: saturate(1.05) brightness(1.18);
}

.sapp-node.is-past .sapp-node__orb {
	box-shadow:
		0 6px 16px rgb(0 0 0 / 16%),
		0 0 22px rgb(251 191 36 / 28%),
		0 0 0 1px rgb(251 191 36 / 22%),
		inset -2px -4px 8px rgb(0 0 0 / 10%),
		inset 1px 2px 8px rgb(255 255 255 / 32%);
}

.sapp-node.is-past .sapp-node__asset {
	border-color: rgb(251 191 36 / 38%);
	box-shadow:
		0 4px 10px rgb(0 0 0 / 16%),
		0 0 10px rgb(251 191 36 / 18%),
		inset 0 1px 0 rgb(255 255 255 / 18%);
}

.sapp-node.is-future {
	opacity: 0.76;
	filter: brightness(0.86) saturate(0.88);
}

.sapp-node.is-filter-dim,
.sapp-scene__col.is-filter-dim {
	opacity: 0.22;
	filter: saturate(0.45) brightness(0.88);
}

.sapp-node.is-filter-match,
.sapp-scene__col.is-filter-match {
	opacity: 1;
	z-index: 5;
}

.sapp-node.is-filter-match .sapp-node__orb {
	box-shadow:
		0 8px 18px rgb(0 0 0 / 22%),
		0 0 24px var(--orb-glow, rgb(129 140 248 / 48%)),
		0 0 0 2px rgb(34 211 238 / 42%),
		inset -2px -4px 8px rgb(0 0 0 / 12%);
}

.sapp-node.is-now {
	z-index: 3;
	filter: brightness(1.08) saturate(1.08);
}

.sapp-node.is-now .sapp-node__orb {
	animation-duration: 4.5s;
	box-shadow:
		0 10px 22px rgb(0 0 0 / 22%),
		0 0 32px var(--orb-glow, rgb(129 140 248 / 52%)),
		0 0 0 2px rgb(56 189 248 / 38%),
		inset -2px -4px 8px rgb(0 0 0 / 12%);
}

/* ---------- מערכת כוכבי לכת — orb מרכזי + ירחים ---------- */

.sapp-node__system {
	position: relative;
	width: 100%;
	height: 186px;
	transform-style: preserve-3d;
	animation: sapp-roll-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) backwards;
	animation-delay: calc(var(--ci, 0) * 50ms);
}

.sapp-scene--focus-teacher .sapp-node__system {
	animation-name: sapp-roll-up;
}

.sapp-scene--focus-room .sapp-node__system {
	animation-name: sapp-roll-down;
}

/* גליל שמסתובב — כניסה מעלה/מטה לפי המיקוד */
@keyframes sapp-roll-in {
	from { transform: rotateX(55deg) scale(0.88); opacity: 0; }
	to { transform: rotateX(0deg) scale(1); opacity: 1; }
}

@keyframes sapp-roll-up {
	from { transform: rotateX(-82deg); opacity: 0.1; }
	to { transform: rotateX(0deg); opacity: 1; }
}

@keyframes sapp-roll-down {
	from { transform: rotateX(82deg); opacity: 0.1; }
	to { transform: rotateX(0deg); opacity: 1; }
}

/* טבעות מסלול סביב הכדור */
.sapp-node__ring {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 70px;
	height: 70px;
	margin: -35px 0 0 -35px;
	border-radius: 50%;
	border: 1px solid rgb(148 163 184 / 22%);
	border-top-color: rgb(199 210 254 / 55%);
	transform: rotateX(68deg);
	animation: sapp-ring-spin 9s linear infinite;
	pointer-events: none;
	z-index: 1;
}

.sapp-node__ring--b {
	width: 92px;
	height: 92px;
	margin: -46px 0 0 -46px;
	border-style: dashed;
	border-color: rgb(129 140 248 / 18%);
	border-top-color: rgb(129 140 248 / 38%);
	animation-duration: 15s;
	animation-direction: reverse;
}

@keyframes sapp-ring-spin {
	from { transform: rotateX(68deg) rotateZ(0deg); }
	to { transform: rotateX(68deg) rotateZ(360deg); }
}

/* חוטים דקים + נקודות עגינה לכוכבי הלכת */
.sapp-node__arm,
.sapp-node__arm-tip {
	position: absolute;
	top: 50%;
	left: 50%;
	transform-origin: top center;
	pointer-events: none;
}

.sapp-node__arm {
	width: 1px;
	border-radius: 999px;
	z-index: 2;
}

.sapp-node__arm-tip {
	width: 0;
	z-index: 4;
}

.sapp-node__arm--teacher,
.sapp-node__arm-tip--teacher {
	height: var(--arm-teacher, 54px);
	animation: sapp-orbit-top 7s ease-in-out infinite;
	transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.sapp-node__arm--room,
.sapp-node__arm-tip--room {
	height: var(--arm-room, 56px);
	animation: sapp-orbit-bottom 8.5s ease-in-out infinite;
	transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.sapp-node__arm--teacher {
	background: linear-gradient(180deg, rgb(199 210 254 / 10%) 0%, rgb(165 180 252 / 70%) 85%);
	box-shadow: 0 0 6px rgb(165 180 252 / 22%);
}

.sapp-node__arm--room {
	background: linear-gradient(180deg, rgb(186 230 253 / 10%) 0%, rgb(125 211 252 / 65%) 85%);
	box-shadow: 0 0 6px rgb(125 211 252 / 20%);
}

/* תנודה מסלולית עדינה — כמו ירחים */
@keyframes sapp-orbit-top {
	0%, 100% { transform: rotate(173deg); }
	50% { transform: rotate(187deg); }
}

@keyframes sapp-orbit-bottom {
	0%, 100% { transform: rotate(8deg); }
	50% { transform: rotate(-8deg); }
}

/* כוכב לכת — בקצה החוט */
.sapp-node__planet {
	position: absolute;
	top: 100%;
	left: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	width: 58px;
	pointer-events: auto;
	cursor: pointer;
	transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.sapp-node__planet--teacher {
	transform: translate(-50%, -50%) rotate(180deg) scale(var(--planet-teacher-scale, 0.88));
}

.sapp-node__planet--room {
	transform: translate(-50%, -50%) scale(var(--planet-room-scale, 0.88));
}

.sapp-node__planet-label {
	font-size: 0.44rem;
	font-weight: 600;
	color: rgb(148 163 184 / 88%);
	text-align: center;
	line-height: 1.15;
	max-width: 52px;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
	word-break: break-word;
	transition: font-size 0.3s ease, color 0.3s ease;
}

.sapp-node__teacher-photo {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
	border: 1.5px solid rgb(148 163 184 / 35%);
	box-shadow:
		0 3px 8px rgb(0 0 0 / 16%),
		inset 0 0 0 1px rgb(255 255 255 / 12%);
	transition: box-shadow 0.32s ease;
	filter: saturate(0.82) brightness(0.96);
}

/* כדור מרכזי — השיעור */
.sapp-node__core {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -52%) scale(var(--core-scale, 1.05));
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	width: 94%;
	z-index: 3;
	cursor: pointer;
	transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ריבוע נכס — בתוך כוכב הלכת */
.sapp-node__asset {
	width: 100%;
	min-height: 28px;
	padding: 4px 3px;
	border-radius: 7px;
	display: grid;
	place-items: center;
	background: linear-gradient(145deg, rgb(147 197 253 / 95%), rgb(59 130 246 / 92%));
	border: 1px solid rgb(191 219 254 / 45%);
	box-shadow:
		0 4px 10px rgb(0 0 0 / 18%),
		0 0 10px rgb(125 211 252 / 18%),
		inset 0 1px 0 rgb(255 255 255 / 28%),
		inset 0 -2px 4px rgb(30 64 175 / 22%);
	transform: rotateX(8deg);
}

.sapp-node__asset--lab {
	background: linear-gradient(145deg, rgb(100 116 139 / 88%), rgb(71 85 105 / 92%));
	border-color: rgb(148 163 184 / 32%);
	box-shadow:
		0 4px 10px rgb(0 0 0 / 16%),
		inset 0 1px 0 rgb(255 255 255 / 18%),
		inset 0 -2px 4px rgb(30 41 59 / 18%);
}

.sapp-node__asset-text {
	font-size: 0.48rem;
	font-weight: 800;
	line-height: 1.15;
	color: #f8fafc;
	text-align: center;
	word-break: break-word;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-shadow: 0 1px 2px rgb(15 23 42 / 35%);
}

/* הילה מאחורי הכדור המרכזי — תחושת שמש */
.sapp-node__core::before {
	content: '';
	position: absolute;
	top: -10px;
	left: 50%;
	width: 68px;
	height: 68px;
	transform: translateX(-50%);
	border-radius: 50%;
	background: radial-gradient(circle, var(--orb-glow, rgb(129 140 248 / 30%)) 0%, transparent 68%);
	pointer-events: none;
	z-index: -1;
}

@media (prefers-reduced-motion: reduce) {
	.sapp-node__system,
	.sapp-node__ring,
	.sapp-node__arm,
	.sapp-node__arm-tip,
	.sapp-node__orb {
		animation: none !important;
	}
}

/* הדגשות לפי מיקוד */
.sapp-scene--focus-teacher .sapp-node__planet--teacher .sapp-node__planet-label {
	font-size: 0.48rem;
	font-weight: 600;
	color: rgb(203 213 225 / 92%);
	max-width: 56px;
}

.sapp-scene--focus-teacher .sapp-node__teacher-photo {
	filter: saturate(0.9) brightness(1);
	box-shadow:
		0 5px 12px rgb(0 0 0 / 20%),
		0 0 10px rgb(129 140 248 / 18%),
		inset 0 0 0 1px rgb(255 255 255 / 18%);
}

.sapp-scene--focus-teacher .sapp-node__core,
.sapp-scene--focus-teacher .sapp-node__planet--room,
.sapp-scene--focus-room .sapp-node__core,
.sapp-scene--focus-room .sapp-node__planet--teacher {
	opacity: 0.7;
	filter: brightness(0.92);
}

.sapp-scene--focus-room .sapp-node__asset {
	min-height: 34px;
	padding: 6px 4px;
}

.sapp-scene--focus-room .sapp-node__asset-text {
	font-size: 0.56rem;
}

.sapp-node__orb {
	position: relative;
	width: 78%;
	max-width: 46px;
	aspect-ratio: 1;
	height: auto;
	border-radius: 50%;
	background:
		radial-gradient(circle at 32% 26%, rgb(255 255 255 / 62%) 0%, color-mix(in srgb, var(--orb-color, #818cf8) 72%, #fff) 36%, color-mix(in srgb, var(--orb-color, #818cf8) 88%, #fff) 68%, color-mix(in srgb, var(--orb-color, #818cf8) 55%, #c7d2fe) 100%);
	box-shadow:
		0 6px 14px rgb(0 0 0 / 18%),
		0 0 18px var(--orb-glow, rgb(129 140 248 / 32%)),
		inset -2px -4px 8px rgb(0 0 0 / 12%),
		inset 1px 2px 8px rgb(255 255 255 / 28%);
	transform: rotateX(8deg) translateZ(6px);
	animation: sapp-orb-float 5.5s ease-in-out infinite;
}

.sapp-node__orb-shine {
	position: absolute;
	inset: 12% 18% auto 22%;
	height: 28%;
	border-radius: 50%;
	background: rgb(255 255 255 / 38%);
	filter: blur(2px);
}

.sapp-node.is-exam .sapp-node__orb {
	background:
		radial-gradient(circle at 32% 26%, rgb(255 255 255 / 55%) 0%, #fecaca 42%, color-mix(in srgb, #f87171 72%, #fff) 100%);
	box-shadow:
		0 6px 14px rgb(0 0 0 / 18%),
		0 0 18px rgb(248 113 113 / 32%),
		inset -2px -4px 8px rgb(0 0 0 / 12%);
}

.sapp-scene .sapp-node__subject {
	color: var(--scene-ink);
}

.sapp-scene .sapp-node__time {
	color: var(--scene-muted);
}

.sapp-node__subject {
	margin: 0;
	font-size: 0.58rem;
	font-weight: 800;
	color: var(--sapp-ink);
	text-align: center;
	line-height: 1.2;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.sapp-node__time {
	margin: 0;
	font-size: 0.52rem;
	font-weight: 600;
	color: var(--sapp-muted);
	white-space: nowrap;
}

.sapp-node__badge {
	position: absolute;
	top: -2px;
	inset-inline-end: 0;
	font-size: 0.48rem;
	font-weight: 800;
	padding: 1px 4px;
	border-radius: 999px;
	background: rgb(248 113 113 / 22%);
	color: #fecaca;
	border: 1px solid rgb(248 113 113 / 35%);
	z-index: 2;
}

.sapp-node__core .sapp-node__badge {
	inset-inline-end: 4px;
	top: -8px;
}

.sapp-node__badge--group {
	background: rgb(251 191 36 / 18%);
	color: #fde68a;
	border-color: rgb(251 191 36 / 35%);
}

/* עיגול מבחן — לחיץ */
.sapp-node__exam-dot {
	position: absolute;
	top: -4px;
	inset-inline-end: 6%;
	z-index: 5;
	display: grid;
	place-items: center;
	width: 22px;
	height: 22px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid rgb(254 202 202 / 65%);
	background: radial-gradient(circle at 32% 28%, #fecaca, #ef4444 72%);
	color: #fff;
	font-size: 0.62rem;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 0 12px rgb(248 113 113 / 55%);
	animation: sapp-exam-pulse 2.2s ease-in-out infinite;
}

@keyframes sapp-exam-pulse {
	0%, 100% { box-shadow: 0 0 8px rgb(248 113 113 / 35%); }
	50% { box-shadow: 0 0 18px rgb(248 113 113 / 75%); }
}

/* שכבות לחיצות */
.sapp-node__core[data-ctx],
.sapp-node__planet[data-ctx] {
	cursor: pointer;
}

.sapp-node__core[data-ctx]:hover .sapp-node__orb {
	box-shadow:
		0 8px 18px rgb(0 0 0 / 22%),
		0 0 26px var(--orb-glow, rgb(129 140 248 / 48%)),
		0 0 0 2px rgb(199 210 254 / 35%),
		inset -2px -4px 8px rgb(0 0 0 / 12%);
}

.sapp-node__planet[data-ctx]:hover .sapp-node__teacher-photo {
	box-shadow:
		0 6px 14px rgb(0 0 0 / 22%),
		0 0 14px rgb(129 140 248 / 38%),
		inset 0 0 0 2px rgb(255 255 255 / 25%);
}

.sapp-node__planet[data-ctx]:hover .sapp-node__asset {
	box-shadow:
		0 6px 14px rgb(0 0 0 / 22%),
		0 0 14px rgb(147 197 253 / 42%),
		inset 0 1px 0 rgb(255 255 255 / 32%);
}

/* גיליון הקשרים — overlay */
.sapp-context {
	margin: 0;
	border-radius: 20px 20px 0 0;
	background: linear-gradient(180deg, rgb(30 47 88 / 98%), rgb(21 32 64 / 99%));
	border: 1px solid rgb(129 140 248 / 35%);
	border-bottom: 0;
	box-shadow: 0 -18px 40px rgb(0 0 0 / 42%);
	overflow: hidden;
	animation: sapp-context-in 0.28s ease;
}

.sapp-context--sheet {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 211;
	max-height: min(78dvh, 560px);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	pointer-events: auto;
}

@keyframes sapp-context-in {
	from { opacity: 0; transform: translateY(18px); }
	to { opacity: 1; transform: translateY(0); }
}

.sapp-context__head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border-bottom: 1px solid rgb(129 140 248 / 20%);
}

.sapp-context__icon {
	font-size: 1.1rem;
	line-height: 1;
}

.sapp-context__titles {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.sapp-context__title {
	font-size: 0.85rem;
	font-weight: 800;
	color: var(--scene-ink, #f4f7ff);
}

.sapp-context__subtitle {
	font-size: 0.64rem;
	font-weight: 700;
	color: var(--scene-muted, #b8c8ea);
}

.sapp-context__close {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	border: 0;
	border-radius: 50%;
	background: rgb(148 163 184 / 15%);
	color: #cbd5e1;
	font-size: 0.7rem;
	cursor: pointer;
}

.sapp-context__body {
	display: grid;
	gap: 6px;
	padding: 10px 12px 12px;
}

.sapp-context__row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 3px 10px;
	padding: 7px 10px;
	border-radius: 10px;
	background: rgb(36 52 92 / 45%);
	border: 1px solid rgb(129 140 248 / 16%);
}

.sapp-context__row.is-current {
	border-color: rgb(56 189 248 / 50%);
	box-shadow: 0 0 0 1px rgb(56 189 248 / 25%);
}

.sapp-context__row-time {
	font-size: 0.66rem;
	font-weight: 800;
	color: #93c5fd;
}

.sapp-context__row-main {
	font-size: 0.76rem;
	font-weight: 800;
	color: var(--scene-ink, #f4f7ff);
}

.sapp-context__row-sub {
	width: 100%;
	font-size: 0.64rem;
	font-weight: 600;
	color: var(--scene-muted, #b8c8ea);
}

.sapp-context__exam-tag {
	font-style: normal;
	font-size: 0.56rem;
	font-weight: 800;
	padding: 1px 6px;
	border-radius: 999px;
	background: rgb(248 113 113 / 25%);
	color: #fecaca;
}

.sapp-context__fact {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 7px 10px;
	border-radius: 10px;
	background: rgb(36 52 92 / 45%);
	border: 1px solid rgb(129 140 248 / 16%);
	font-size: 0.76rem;
	font-weight: 700;
	color: var(--scene-ink, #f4f7ff);
}

.sapp-context__fact span:first-child {
	width: 18px;
	text-align: center;
	flex: 0 0 auto;
}

.sapp-context__empty {
	margin: 0;
	padding: 8px;
	font-size: 0.72rem;
	color: var(--scene-muted, #b8c8ea);
	text-align: center;
}

@keyframes sapp-orb-float {
	0%, 100% { transform: rotateX(8deg) translateZ(6px) translateY(0); }
	50% { transform: rotateX(8deg) translateZ(8px) translateY(-2px); }
}

/* עמודות רחבות — כדורים מעט גדולים יותר, עדיין בלי גלילה */
@media (min-width: 520px) {
	.sapp-node__orb {
		max-width: 52px;
	}
}

/* ---------- Misc ---------- */

.sapp-empty {
	text-align: center;
	color: var(--sapp-muted);
	padding: 44px 20px;
	font-size: 0.95rem;
}

.sapp-empty strong {
	display: block;
	font-size: 2.2rem;
	margin-bottom: 8px;
}

.sapp-loading {
	text-align: center;
	color: var(--sapp-muted);
	padding: 40px;
}

.sapp-loading::after {
	content: '';
	display: block;
	width: 28px;
	height: 28px;
	margin: 14px auto 0;
	border-radius: 50%;
	border: 3px solid #2b3a6b;
	border-top-color: var(--sapp-accent);
	animation: sapp-spin 0.8s linear infinite;
}

@keyframes sapp-spin {
	to { transform: rotate(360deg); }
}

.sapp-section-title {
	margin: 4px 0 12px;
	font-size: 1rem;
	font-weight: 900;
	color: var(--sapp-ink);
}

@media (min-width: 640px) {
	.sapp__root {
		max-width: 640px;
		margin: 0 auto;
		padding-top: max(12px, env(safe-area-inset-top));
	}

	.sapp-profile-panel,
	.sapp-context--sheet {
		inset-inline: 0;
		width: min(640px, 100%);
		margin-inline: auto;
	}
}

/* ---------- Teacher chat ---------- */

.sapp-chat {
	display: flex;
	flex-direction: column;
	min-height: min(72dvh, 560px);
	border-radius: 18px;
	border: 1px solid rgb(255 255 255 / 8%);
	background: linear-gradient(180deg, #0c0d14 0%, #0a0b12 100%);
	overflow: hidden;
}

.sapp-chat__thread {
	flex: 1 1 auto;
	min-height: 200px;
	max-height: 52dvh;
	overflow-y: auto;
	padding: 14px 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	-webkit-overflow-scrolling: touch;
}

.sapp-chat__bubble {
	max-width: 88%;
	padding: 8px 12px;
	border-radius: 14px;
	font-size: 0.82rem;
	line-height: 1.35;
	word-break: break-word;
}

.sapp-chat__bubble--in {
	align-self: flex-start;
	background: rgb(30 41 82 / 88%);
	border: 1px solid rgb(129 140 248 / 22%);
	color: #e2e8f0;
	border-bottom-right-radius: 4px;
}

.sapp-chat__bubble--out {
	align-self: flex-end;
	background: linear-gradient(135deg, rgb(34 197 94 / 88%), rgb(22 163 74 / 92%));
	color: #f0fdf4;
	border-bottom-left-radius: 4px;
}

.sapp-chat__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 10px 8px;
}

.sapp-chat__chip {
	padding: 5px 10px;
	border-radius: 999px;
	border: 1px solid rgb(129 140 248 / 28%);
	background: rgb(30 41 82 / 55%);
	color: #c7d2fe;
	font-family: inherit;
	font-size: 0.68rem;
	font-weight: 700;
	cursor: pointer;
}

.sapp-chat__composer {
	display: flex;
	gap: 8px;
	padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
	border-top: 1px solid rgb(255 255 255 / 8%);
	background: rgb(12 13 20 / 92%);
}

.sapp-chat__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 12px;
	border-radius: 999px;
	border: 1px solid rgb(129 140 248 / 28%);
	background: rgb(20 32 62 / 88%);
	color: #eef2ff;
	font-family: inherit;
	font-size: 0.84rem;
}

.sapp-chat__send {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 0;
	background: linear-gradient(135deg, #6366f1, #818cf8);
	color: #fff;
	font-size: 1rem;
	cursor: pointer;
}
