/* כרטיסיות — bright, big-tap-target flashcards. Light by default, dark by system preference. */
:root {
  --bg: #f4f7f6; --card: #ffffff; --ink: #1d2b2a; --muted: #6a7a78; --line: #dbe4e2;
  --accent: #0e9f8f; --accent-ink: #ffffff; --accent-soft: #d8f1ed;
  --yes: #2e9e5b; --yes-soft: #dff5e6; --no: #d9534f; --no-soft: #fbe3e2;
  --back: #fff8dc; --shadow: 0 6px 24px rgba(20, 60, 55, .12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121a1a; --card: #1c2726; --ink: #eef3f2; --muted: #9fb0ad; --line: #2c3a38;
    --accent: #2fc4b2; --accent-ink: #072320; --accent-soft: #163a36;
    --yes: #4ccf7f; --yes-soft: #163f2a; --no: #ff7b76; --no-soft: #4a2321;
    --back: #2a2a1c; --shadow: 0 6px 24px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Hebrew", Arial, sans-serif;
  min-height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: var(--card); border-radius: 14px; padding: 12px 18px; min-height: 48px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
button:active { transform: translateY(1px); }
button.primary, a.primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
button.ghost { background: transparent; box-shadow: none; color: var(--muted); font-weight: 600; min-height: 40px; padding: 6px 10px; }
button.big { width: 100%; font-size: 20px; min-height: 60px; border-radius: 18px; }
button.small, a.small { min-height: 40px; padding: 8px 16px; font-size: 16px; }
a { color: var(--accent); text-decoration: none; }
a.primary { display: inline-flex; align-items: center; justify-content: center; border-radius: 14px; padding: 8px 18px; min-height: 44px; }
[hidden] { display: none !important; }

#top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; max-width: 720px; margin: 0 auto; }
.brand { font-size: 24px; font-weight: 800; color: var(--ink); letter-spacing: .3px; }
#view { max-width: 720px; margin: 0 auto; padding: 0 16px 40px; }

/* home */
.deck { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.deck .name { font-size: 22px; font-weight: 800; margin: 0 0 2px; word-break: break-word; }
.deck .meta { color: var(--muted); font-size: 15px; margin-bottom: 12px; }
.deck .btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.deck .btns .sp { flex: 1; }
.deck .confirm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; color: var(--no); font-weight: 700; }
.deck button.danger { background: var(--no-soft); color: var(--no); }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-size: 17px; }
.readyh { margin: 34px 0 2px; font-size: 18px; color: var(--muted); font-weight: 700; }
.readydeck { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 1px dashed var(--line); border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; }
.readydeck .name { font-weight: 700; font-size: 18px; }
.readydeck .meta { color: var(--muted); font-size: 14px; }
.home .big { margin-top: 6px; }

/* editor */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 14px; }
.bar .back { font-weight: 700; font-size: 17px; }
.bar .dname { font-weight: 800; flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
input.name { width: 100%; font-size: 22px; font-weight: 800; border: 0; border-bottom: 2px solid var(--line); background: transparent; padding: 8px 4px; margin-bottom: 14px; outline: none; }
input.name:focus { border-color: var(--accent); }
.rows { display: flex; flex-direction: column; gap: 10px; }
.row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.row input { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-height: 48px; outline: none; }
.row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row .x { background: transparent; box-shadow: none; color: var(--muted); font-size: 22px; padding: 0 8px; min-width: 40px; }
.row .x:hover { color: var(--no); }
.rowhead { display: grid; grid-template-columns: 1fr 1fr 40px; gap: 8px; color: var(--muted); font-size: 14px; padding: 0 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.hint { color: var(--muted); font-size: 15px; margin: 0 0 8px; }
textarea { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; outline: none; resize: vertical; }
textarea:focus { border-color: var(--accent); }
#pastebox { background: var(--accent-soft); border-radius: 16px; padding: 14px; margin-top: 8px; }

/* study */
.study .count { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 0 0 18px; }
.progress i { display: block; height: 100%; width: 0; background: var(--yes); border-radius: 99px; transition: width .3s; }
.card { perspective: 1200px; height: min(52vh, 420px); min-height: 240px; cursor: pointer; outline: none; }
.card .inner { position: relative; width: 100%; height: 100%; transition: transform .45s cubic-bezier(.2,.7,.2,1); transform-style: preserve-3d; }
.card.notrans .inner { transition: none; }
.card.flipped .inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--card); border-radius: 24px; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; padding: 28px 22px; text-align: center; overflow: hidden; }
.face.front { border-top: 6px solid var(--accent); }
.face.back { transform: rotateY(180deg); background: var(--back); border-top: 6px solid var(--yes); }
.face .txt { max-height: 100%; overflow: auto; width: 100%; font-weight: 700; line-height: 1.3; word-break: break-word; white-space: pre-wrap; }
.txt.sz0 { font-size: 46px; } .txt.sz1 { font-size: 34px; } .txt.sz2 { font-size: 26px; } .txt.sz3 { font-size: 20px; font-weight: 600; }
.face .hint { position: absolute; bottom: 14px; left: 0; right: 0; font-size: 14px; color: var(--muted); }
.face .spk { position: absolute; top: 12px; inset-inline-end: 12px; background: transparent; box-shadow: none; font-size: 20px; min-height: 40px; padding: 4px 8px; opacity: .7; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; visibility: hidden; }
.answers.show { visibility: visible; }
.answers button { min-height: 64px; font-size: 21px; font-weight: 800; border-radius: 18px; }
.answers .no { background: var(--no-soft); color: var(--no); }
.answers .yes { background: var(--yes-soft); color: var(--yes); }
.opts { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-top: 22px; color: var(--muted); font-size: 15px; }
.opts label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.opts input { width: 20px; height: 20px; accent-color: var(--accent); }
.result { background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 30px 22px; text-align: center; }
.result .emoji { font-size: 64px; line-height: 1; margin-bottom: 10px; }
.result h2 { margin: 0 0 6px; font-size: 28px; }
.result p { color: var(--muted); margin: 0 0 20px; }
.result .actions { justify-content: center; margin: 0; }
.notice { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 20px; text-align: center; margin-top: 20px; }
.notice p { margin: 0 0 16px; font-size: 19px; }

#toast { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 16px; max-width: 90vw; text-align: center; box-shadow: var(--shadow); z-index: 10; }

@media (max-width: 480px) {
  body { font-size: 17px; }
  .row { grid-template-columns: 1fr 1fr 36px; gap: 6px; }
  .row input { padding: 10px; }
  .txt.sz0 { font-size: 38px; } .txt.sz1 { font-size: 28px; } .txt.sz2 { font-size: 22px; }
}
