:root {
  /* colours of the school logo (שליחות ומצוינות) – the whole look of the app comes from here */
  --plum: #47318c;        /* main purple: headings, main buttons, the logo */
  --plum-dark: #33226b;
  --c-navy: #2e4a9a;      /* royal blue */
  --c-red: #e8483e;       /* coral red */
  --c-yellow: #ffd21f;    /* sunny yellow */
  --c-sky: #5bc3e3;       /* sky blue */
  --blush: #f1edfa;       /* page background: soft lavender */
  --cream: #f7f4fd;
  --card: #ffffff;
  --sage: #8fa3dd;        /* secondary accent (was sage green in the original app) – now blue tones */
  --sage-deep: #2e4a9a;
  --sage-soft: #e3f4fa;
  --rose: #e8483e;
  --rose-soft: #fde9e7;
  --gold: #b9a8e6;        /* thin accent lines (soft purple) */
  --line: #e4dcf5;
  --text: #2f2366;
  --muted: #7d6fb0;
  --radius: 22px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: 'Assistant', 'Arial Hebrew', Arial, sans-serif;
  font-size: 18px; line-height: 1.55; color: var(--text);
  background: var(--blush);
}
h1, h2, h3 { font-family: 'Karantina', 'Assistant', sans-serif; color: var(--plum); font-weight: 700; line-height: 1.05; margin: 0; letter-spacing: .5px; }
h1 { font-size: 3.4rem; }
h2 { font-size: 2.3rem; }
h3 { font-size: 1.7rem; }
p { margin: 0 0 .6em; }
a { color: var(--plum); }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* watercolour flowers: a bouquet in the top-left corner (scrolls away with the page) */
.flower-corner { position: absolute; top: -6px; left: -8px; width: 150px; transform: scaleX(-1); z-index: 0; pointer-events: none; }
/* a small garland at the end of each screen's content (scrolls with the page, never over it) */
.flower-garland { display: block; margin: 18px auto 0; width: min(62%, 300px); pointer-events: none; }

/* header: school logo, the חברותניא title, the organisation line and small hearts */
.schoollogo { display: block; width: 34%; max-width: 170px; margin: 0 auto; }
.brandhead { text-align: center; margin: -36px 0 14px; position: relative; z-index: 1; }
.brandhead .schoollogo { width: 26%; max-width: 120px; }
.brandhead.big .schoollogo { width: 34%; max-width: 160px; }
.brandhead .brand { display: block; font-family: 'Karantina', sans-serif; font-size: 3rem; line-height: 1.05; color: var(--plum); font-weight: 700; text-decoration: none; white-space: nowrap; margin-top: 6px; }
.brandhead.big .brand { font-size: min(6rem, 26vw); line-height: .95; margin-top: 10px; }
.orgtag { display: inline-block; margin: 8px 0 0; padding: 5px 14px; border-radius: 10px; background: var(--plum); color: #fff; font-weight: 700; font-size: 1rem; }
.hearts { display: flex; gap: 6px; justify-content: center; margin: 10px 0 2px; font-size: 44px; }
.hearts .heart { width: 11px; height: 10px; vertical-align: 0; margin: 0; }

.page { max-width: 520px; margin: 0 auto; padding: 14px 16px calc(70px + env(safe-area-inset-bottom) + var(--badge, 0px)); }
body.admin .page { max-width: 940px; padding-bottom: 60px; }

.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; padding: 4px 4px 10px; position: relative; z-index: 2; }
.topbar .brand { font-family: 'Karantina', sans-serif; font-size: 3rem; line-height: 1.1; color: var(--plum); font-weight: 700; text-decoration: none; text-align: center; white-space: nowrap; }
.topbar .linkbtn { justify-self: end; background: rgba(255, 255, 255, .9); border-radius: 999px; padding: 4px 12px; text-decoration: none; font-weight: 600; }
.bh { font-size: .95rem; font-weight: 600; color: var(--plum); padding: 6px 2px; justify-self: start; }
.bh.corner { position: absolute; top: 10px; right: 16px; }
.logo { white-space: nowrap; }
/* heart = the letter י: its top sits on the top line of the letters (0.6em above the baseline in Karantina),
   and the gap on each side equals the normal gap between letters */
.heart { width: .25em; height: .2273em; vertical-align: .3727em; margin: 0 .02em; }
.waicon { width: 26px; height: 26px; flex: none; }
.btn.invite { display: flex; width: 100%; margin: 0 0 16px; }
/* home-screen guide */
.install summary { cursor: pointer; font-weight: 700; color: var(--plum); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 28px; }
.install summary::-webkit-details-marker { display: none; }
.install summary::after { content: '+'; font-size: 1.6rem; line-height: 1; color: var(--plum); }
.install[open] summary::after { content: '\2212'; }
.install h4 { margin: 16px 0 4px; color: var(--sage-deep); font-size: 1.05rem; }
.install ol { margin: 0; padding: 0 22px 0 0; }
.install li { margin: 6px 0; }
.shareicon { width: 1.15em; height: 1.15em; vertical-align: -.22em; color: var(--plum); }
.adminlink { text-align: center; margin: 26px 0 0; font-size: .78rem; }
.adminlink a { color: var(--muted); opacity: .55; text-decoration: none; }
#printArea { display: none; }
@media print {
  @page { margin: 8mm; }
  body { background: #fff; }
  body::before, body > *:not(#printArea) { display: none !important; }
  #printArea { display: block; }
  #printArea img { display: block; width: 100%; height: auto; page-break-after: always; break-after: page; }
  #printArea img:last-child { page-break-after: auto; break-after: auto; }
}
.linkbtn { background: none; border: 0; color: var(--plum); font: inherit; font-size: .95rem; text-decoration: underline; cursor: pointer; padding: 8px; }

/* cards */
.card {
  position: relative; background: var(--card); border-radius: var(--radius);
  padding: 20px 20px 22px; margin: 0 0 16px;
  box-shadow: 0 6px 22px rgba(71, 49, 140, .08);
}
/* a thin colour stripe at the top of a card, in one of the logo colours */
.card.sage::after, .card.rose::after, .card.red::after { content: ''; position: absolute; top: 0; left: 18px; right: 18px; height: 5px; border-radius: 0 0 5px 5px; background: var(--c-sky); }
.card.rose::after { background: var(--c-yellow); }
.card.red::after { background: var(--c-red); }
.prize { margin: 10px 0 0; color: var(--text); }
.prize b { color: var(--c-red); font-size: 1.1rem; }
.arch { /* arch frame like the invitation, with a thin gold line inside */
  border-radius: 220px 220px var(--radius) var(--radius);
  padding: 62px 26px 30px; text-align: center;
}
.arch::before {
  content: ''; position: absolute; inset: 8px; pointer-events: none;
  border: 1px solid var(--plum); border-radius: 212px 212px 16px 16px; opacity: .55;
}
.arch > * { position: relative; }
.label { display: inline-block; font-weight: 700; color: var(--c-navy); letter-spacing: .5px; font-size: .95rem; }
.goldline { height: 1px; background: linear-gradient(90deg, transparent, var(--plum), transparent); opacity: .5; margin: 14px auto; width: 70%; border: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 24px; border-radius: 999px; border: 0;
  background: var(--plum); color: #fff; font: inherit; font-weight: 700; font-size: 1.08rem;
  cursor: pointer; text-decoration: none; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--plum-dark); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 62px; font-size: 1.25rem; }
.btn.ghost { background: transparent; color: var(--plum); border: 1.5px solid var(--plum); }
.btn.ghost:hover { background: rgba(71, 49, 140, .06); }
.btn.sagebtn { background: var(--plum); }
.btn.wa { background: #2f8f5b; }
.btn.sm { min-height: 40px; padding: 6px 16px; font-size: .95rem; }
.btn.danger { background: transparent; color: #a23b3b; border: 1.5px solid #c98d8d; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

/* forms */
label.field { display: block; text-align: right; font-weight: 600; margin-bottom: 12px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], textarea, select {
  width: 100%; min-height: 52px; margin-top: 4px; padding: 10px 16px;
  border: 1.5px solid #d6cdf0; border-radius: 16px; background: #fff;
  font: inherit; color: var(--text);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus, .btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--c-sky); outline-offset: 2px; }
input[type=tel] { direction: ltr; text-align: right; }

.tabs { display: flex; background: var(--blush); border-radius: 999px; padding: 4px; margin: 16px 0; }
.tabs button { flex: 1; min-height: 44px; border: 0; background: transparent; border-radius: 999px; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--plum); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.chip { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--sage); background: #fff; font: inherit; color: var(--sage-deep); font-weight: 600; cursor: pointer; }
.chip.on { background: var(--sage-deep); border-color: var(--sage-deep); color: #fff; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--blush); color: var(--plum); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.tag.sage { background: var(--sage-soft); color: var(--sage-deep); }
.tag.gold { background: #fff4c2; color: #6b5200; }

/* welcome */
.welcome { max-width: 460px; margin: 0 auto; padding: 22px 18px 40px; position: relative; z-index: 1; }
.welcome .arch { padding-top: 150px; padding-bottom: 56px; margin-top: 150px; }
.welcome .portrait { position: absolute; top: -128px; left: 50%; transform: translateX(-50%); width: 215px; filter: drop-shadow(0 8px 14px rgba(20, 10, 60, .22)); }
.welcome h1 { font-size: min(5.4rem, 24vw); }  /* shrinks on very small phones so the word stays inside the arch */
.welcome .sub { font-size: 1.05rem; margin: 8px 0 0; color: var(--muted); }
.arch-garland { position: absolute; left: 50%; bottom: -34px; transform: translateX(-50%); width: 78%; pointer-events: none; }
.welcome .adminlink { margin-top: 46px; }

/* home */
.hello { font-size: 1.3rem; font-weight: 600; margin: 0 0 6px; text-align: center; }
.status-ok { display: flex; gap: 12px; align-items: flex-start; text-align: right; }
.check { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--sage-deep); color: #fff; display: grid; place-items: center; font-size: 1.3rem; font-weight: 700; }
.bignum { font-family: 'Karantina', sans-serif; font-size: 4.2rem; line-height: 1; color: var(--plum); font-weight: 700; }
.progress { display: flex; gap: 6px; margin: 12px 0 6px; }
.progress span { flex: 1; height: 14px; border-radius: 999px; background: var(--line); }
.progress span.done { background: var(--sage-deep); }
.progress span.now { box-shadow: 0 0 0 2px var(--c-yellow); }
.members { list-style: none; padding: 0; margin: 10px 0; }
.members li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.members li:last-child { border-bottom: 0; }
.list { list-style: none; padding: 0; margin: 0; }
.list li a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 600; }

/* bottom navigation */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: center; background: rgba(255, 255, 255, .97); border-top: 3px solid var(--line); padding-bottom: calc(env(safe-area-inset-bottom) + var(--badge, 0px)); backdrop-filter: blur(6px); }
.nav a { flex: 1; max-width: 170px; text-align: center; padding: 14px 6px; text-decoration: none; color: var(--muted); font-weight: 700; }
.nav a.on { color: var(--plum); box-shadow: inset 0 -4px 0 var(--c-yellow); }

/* quiz */
.q { text-align: right; }
.q h3 { font-family: 'Assistant', sans-serif; font-size: 1.15rem; line-height: 1.4; margin-bottom: 10px; letter-spacing: 0; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; margin-bottom: 8px; border: 1.5px solid #d6cdf0; border-radius: 16px; background: #fff; cursor: pointer; }
.opt input { width: 22px; height: 22px; accent-color: var(--plum); flex: none; }
.opt.right { border-color: var(--sage-deep); background: var(--sage-soft); }
.opt.wrong { border-color: #c98d8d; background: #f8e4e1; }

.pdf-page { display: block; width: 100%; height: auto; margin: 0 0 10px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); background: #fff; }

#toast { position: fixed; bottom: calc(112px + env(safe-area-inset-bottom)); left: 50%; transform: translate(-50%, 20px); max-width: 88%; padding: 12px 20px; border-radius: 16px; background: var(--sage-deep); color: #fff; font-weight: 600; text-align: center; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: #9a3a3a; }

/* admin */
.atabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 12px; }
.atabs button { flex: none; min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 1.5px solid var(--plum); background: var(--card); color: var(--plum); font: inherit; font-weight: 700; cursor: pointer; }
.atabs button.on { background: var(--plum); color: #fff; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: right; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--sage-deep); font-size: .88rem; white-space: nowrap; }
td.c, th.c { text-align: center; }
.cellbtn { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid #d6cdf0; background: #fff; cursor: pointer; font: inherit; color: var(--sage-deep); font-weight: 700; }
.cellbtn.done { background: var(--sage-deep); border-color: var(--sage-deep); color: #fff; }
.groupbox { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.groupbox.pending { border-color: var(--c-yellow); background: #fffbe6; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; margin: 3px; border-radius: 999px; background: var(--rose-soft); font-size: .92rem; }
.pill button { border: 0; background: rgba(71, 49, 140, .12); color: var(--plum); width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-weight: 700; line-height: 1; }
.picklist { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 6px 12px; }
.picklist label { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.picklist input { width: 20px; height: 20px; accent-color: var(--plum); }
.qedit { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; background: #fff; }
.qedit .optrow { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.qedit .optrow input[type=radio] { width: 22px; height: 22px; accent-color: var(--sage-deep); flex: none; }
.qedit .optrow input[type=text] { margin-top: 0; min-height: 44px; }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(47, 35, 102, .55); overflow: auto; padding: 20px 12px; }
.modal .inner { max-width: 480px; margin: 0 auto; background: var(--blush); border-radius: 26px; padding: 16px; }
.banner { padding: 12px 16px; border-radius: 16px; background: #fff4c2; color: #5c4600; font-weight: 600; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: #fff; border-radius: 16px; padding: 14px; text-align: center; }
.stat b { display: block; font-family: 'Karantina', sans-serif; font-size: 2.6rem; color: var(--plum); line-height: 1; }

@media (min-width: 700px) { .flower-corner { width: 210px; } }

/* admin tables stay readable on a phone: they scroll sideways instead of squeezing */
body.admin .tablewrap table { min-width: 540px; }
body.admin td .muted.small { white-space: nowrap; }

/* in-app reading version of a lesson (same look as the lesson PDF) */
.readcard { padding: 22px 18px 14px; }
.reading { font-family: 'Frank Ruhl Libre', 'Times New Roman', serif; font-size: 1.16rem; line-height: 1.6; color: var(--text); }
.reading p { margin: 0 0 .85em; }
.reading h3 { display: flex; align-items: center; gap: 10px; font-size: 1.9rem; margin: 1.1em 0 .45em; color: var(--plum); }
.reading h3:first-child { margin-top: 0; }
.reading h3 .num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: 'Assistant', sans-serif; font-size: 1rem; color: #fff; background: var(--plum); }
.reading h3.sage { color: var(--sage-deep); } .reading h3.sage .num { background: var(--sage-deep); }
.reading h3.rose { color: #c0362d; } .reading h3.rose .num { background: var(--rose); }
.reading h3.gold { color: #8a6d00; } .reading h3.gold .num { background: #d9ab00; }
.reading blockquote { margin: .4em 0 1em; padding: 14px 16px; background: var(--cream); border-right: 5px solid var(--c-yellow); border-radius: 12px; font-weight: 700; color: var(--plum); line-height: 1.55; }
.reading blockquote small { display: block; margin-top: 6px; font-family: 'Assistant', sans-serif; font-weight: 400; font-size: .85rem; color: var(--muted); }
.reading .key { margin: .6em 0 1.2em; padding: 14px 16px; background: var(--plum); color: #fff; border-radius: 14px; font-weight: 700; line-height: 1.6; }
.reading .story { margin: .6em 0 1.1em; padding: 14px 16px 4px; border-radius: 16px; }
.reading .story.rose { background: var(--rose-soft); } .reading .story.sage { background: var(--sage-soft); }
.reading .slabel { display: flex; align-items: center; gap: 8px; font-family: 'Karantina', sans-serif; font-weight: 700; font-size: 1.6rem; line-height: 1; color: var(--plum); margin-bottom: 10px; }
.reading .story.sage .slabel { color: var(--sage-deep); }
.reading .slabel span { font-family: 'Assistant', sans-serif; font-size: .78rem; background: var(--plum); color: #fff; border-radius: 999px; padding: 3px 10px; }
.reading .story.sage .slabel span { background: var(--sage-deep); }
.reading .source { margin: 1.4em 0 0; padding-top: 10px; border-top: 1px solid var(--blush); font-family: 'Assistant', sans-serif; font-size: .9rem; line-height: 1.5; color: var(--muted); }
.reading .source a { color: var(--plum); font-weight: 700; }
#lessonTabs .tabs { margin: 14px 0 0; }

/* small quiz button at the top of the lesson */
.quiztop{margin-top:10px;display:flex;justify-content:flex-start}
