:root {
  --bg: #f4eee2;
  --card: #fffaf1;
  --ink: #2a2520;
  --ink2: #6b6156;
  --muted: #9a8f82;
  --line: #e4dac8;
  --accent: #b0622d;      /* חום-אדמה מהסלעים */
  --accent-soft: #ecd3b8;
  --sky: #1f3f6e;         /* כחול השמיים */
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #e9e1d2;
  color: var(--ink);
  font-family: "Segoe UI", "Heebo", "Rubik", "Arial Hebrew", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
#app {
  max-width: 460px; min-height: 100%; margin: 0 auto; background: var(--bg);
  display: flex; flex-direction: column; position: relative;
  box-shadow: 0 0 40px rgba(60, 40, 20, .12);
}
#view { flex: 1; padding-bottom: 84px; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.pad { padding: 16px; }
.muted { color: var(--ink2); font-size: 14px; }
.small { font-size: 13px; color: var(--muted); }

#update { display: block; width: 100%; border: 0; background: var(--sky); color: #fff; padding: 10px; font-size: 14px; font-weight: 600; }
#update[hidden] { display: none; }
.install { border-color: var(--accent); }
.install ol { margin: 8px 0 0; padding-inline-start: 20px; font-size: 15px; }
.install li { margin-top: 4px; }

/* ניווט תחתון */
#nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 460px; display: flex;
  background: rgba(255, 250, 241, .96); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 5;
}
#nav button {
  flex: 1; background: none; border: 0; padding: 9px 0 10px; font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
#nav .ico { font-size: 20px; line-height: 1.1; }
#nav button.on { color: var(--accent); font-weight: 600; }

/* מסך פתיחה */
.hero {
  position: relative; min-height: 300px; color: #fff; display: flex; flex-direction: column;
  justify-content: flex-end; padding: 22px 20px 18px;
  background: var(--sky) center 60% / cover no-repeat;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20, 35, 65, .25) 0%, rgba(20, 30, 50, .05) 35%, rgba(40, 25, 10, .72) 100%);
}
.hero > * { position: relative; }
.hero .quote {
  font-size: 21px; line-height: 1.45; font-weight: 500; background: none; border: 0; color: #fff;
  text-align: right; padding: 0; text-shadow: 0 1px 10px rgba(0, 0, 0, .45);
}
.hero .qmeta { margin-top: 8px; font-size: 13px; opacity: .88; }
.hero .streak { margin-top: 14px; font-size: 14px; display: flex; gap: 14px; flex-wrap: wrap; }
.hero .streak b { font-size: 17px; font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 14px 0; }
.card h2 { font-size: 17px; }
.card h3 { font-size: 15px; }

/* לוח ימים */
.calhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.calhead button { background: none; border: 0; font-size: 22px; padding: 2px 12px; color: var(--ink2); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal .wd { font-size: 12px; color: var(--muted); padding-bottom: 4px; }
.cal .d {
  aspect-ratio: 1; border-radius: 50%; border: 0; background: none; font-size: 14px;
  color: var(--muted); display: flex; align-items: center; justify-content: center; padding: 0;
}
.cal .d.l1 { background: #f0dcc6; color: var(--ink); }
.cal .d.l2 { background: #dba577; color: var(--ink); font-weight: 600; }
.cal .d.l3 { background: #a85a26; color: #fff; font-weight: 600; }
.cal .d.sel { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.legend i.l1 { background: #f0dcc6; } .legend i.l2 { background: #dba577; } .legend i.l3 { background: #a85a26; }
.legend { align-items: center; gap: 6px !important; }
.legend i { margin: 0 !important; }
.textbtn { background: none; border: 0; color: var(--sky); font-size: 14px !important; padding: 4px 0 !important; text-decoration: underline; }
.calfoot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
#nav button.main .ico { background: var(--accent); color: #fff; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: -18px; box-shadow: 0 2px 8px rgba(80, 40, 10, .3); }
#nav button.main { color: var(--accent); }
.chip.tog { background: #efe6d6; color: var(--ink2); padding: 7px 14px; font-size: 14px; }
.chip.tog.on { background: var(--accent); color: #fff; font-weight: 600; }
.ta { display: block; width: 100%; margin-top: 8px; padding: 10px 12px; font: inherit; line-height: 1.5; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 12px; resize: none; overflow: hidden; }
.ta:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.timebox { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.timebox .row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.timebox label { font-weight: 600; font-size: 15px; }
.timebox b { font-size: 20px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.timebox input[type=range] { width: 100%; margin: 12px 0 0; height: 32px; accent-color: var(--accent); }
.wpart { margin-top: 16px; }
.wpart label { font-weight: 600; font-size: 15px; }
.scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 8px; }
.scale button { aspect-ratio: 1; border-radius: 50%; border: 0; padding: 0; font-size: 14px; background: #efe6d6; color: var(--ink2); }
.scale button.on { background: var(--sky); color: #fff; font-weight: 600; }
.scalehint { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.reflect h2 { font-size: 16px; }
.reflect .intent { margin: 8px 0 0; font-size: 15px; color: var(--ink2); border-inline-start: 3px solid var(--accent-soft); padding-inline-start: 10px; }
.peek { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.peek .dt { font-size: 13px; color: var(--accent); font-weight: 600; }
.peek p { margin: 8px 0 0; }
.hero .hdate { position: absolute; top: calc(14px + env(safe-area-inset-top)); inset-inline-start: 20px; font-size: 14px; opacity: .92; text-shadow: 0 1px 8px rgba(0, 0, 0, .5); letter-spacing: .02em; }
.hero .qlabel { font-size: 13px; opacity: .9; margin-bottom: 6px; letter-spacing: .02em; }
.hero .quote.long { font-size: 17px; line-height: 1.5; }
.cal .d.n { box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink2); }
.cal .d.today { outline: 2px solid var(--sky); outline-offset: 1px; }
.cal .d:disabled { cursor: default; }
.legend { display: flex; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--ink2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-inline-end: 5px; vertical-align: -1px; }

/* יום */
.top { display: flex; align-items: center; gap: 6px; padding: 14px 10px 4px; }
.top button { background: none; border: 0; font-size: 22px; padding: 4px 10px; color: var(--ink2); }
.top h1 { font-size: 19px; flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--accent-soft); border-radius: 999px; padding: 3px 11px; font-size: 13px; border: 0; }
.chip.ghost { background: none; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink2); }
.chip.late { background: none; box-shadow: inset 0 0 0 1px var(--accent); }
.part { margin-top: 14px; }
.part .lbl { font-size: 12px; color: var(--accent); font-weight: 600; letter-spacing: .02em; }
.part p { margin: 2px 0 0; white-space: pre-wrap; }
.plain { white-space: pre-wrap; margin: 8px 0 0; }
.meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; gap: 8px; }
.linkbtn { background: none; border: 0; color: var(--sky); font-size: 13px; padding: 8px 0 0; text-decoration: underline; }

/* חיפוש */
.searchbox { width: 100%; padding: 12px 14px; font: inherit; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.res { display: block; width: 100%; text-align: right; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.res .dt { font-size: 12px; color: var(--accent); font-weight: 600; }
.res p { margin: 2px 0 0; font-size: 15px; }
mark { background: #f6d99a; color: inherit; border-radius: 3px; padding: 0 1px; }

/* מבט */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 14px 0; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px; text-align: center; }
.tile b { display: block; font-size: 26px; font-weight: 600; line-height: 1.2; }
.tile span { font-size: 12px; color: var(--ink2); }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 110px; margin-top: 12px; }
.bars .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; background: none; border: 0; padding: 0; min-width: 0; }
.bars .bar { background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }
.bars .col.sel .bar { opacity: 1; background: #8a4517; }
.axis { display: flex; gap: 2px; margin-top: 4px; border-top: 1px solid var(--line); padding-top: 3px; }
.axis span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); min-width: 0; overflow: hidden; }
.info { font-size: 13px; color: var(--ink2); margin-top: 8px; min-height: 20px; }
.hbar { display: grid; grid-template-columns: 112px 1fr 34px; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; }
.hbar .track { height: 10px; background: #efe6d6; border-radius: 4px 0 0 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--sky); border-radius: 4px 0 0 4px; opacity: .85; }
.hbar .v { font-size: 13px; color: var(--ink2); text-align: left; }
.theme { display: block; width: 100%; text-align: right; background: none; border: 0; border-top: 1px solid var(--line); padding: 12px 0 8px; }
.theme:first-of-type { border-top: 0; }
.theme .row { display: flex; justify-content: space-between; align-items: baseline; }
.theme .mini { height: 34px; margin-top: 6px; }
.theme .mini .bar { background: var(--sky); border-radius: 3px 3px 0 0; }
.word { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 14px; margin: 0 0 6px 6px; }
.word small { color: var(--ink2); }
.word button { border: 0; background: rgba(0, 0, 0, .08); border-radius: 50%; width: 20px; height: 20px; line-height: 1; padding: 0; font-size: 13px; }
.rowform { display: flex; gap: 8px; margin-top: 10px; }
.rowform input { flex: 1; min-width: 0; padding: 9px 12px; font: inherit; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* כפתורים */
.btn { display: block; width: 100%; padding: 12px; border-radius: 12px; border: 0; background: var(--accent); color: #fff; font-weight: 600; margin-top: 10px; }
.btn.sec { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }
.btn.danger { background: none; color: #a23b2a; box-shadow: inset 0 0 0 1px #e3c3bb; font-weight: 500; }
.btn.inline { width: auto; margin: 0; padding: 9px 16px; }
.note { background: #f8ecd4; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }
.list button { display: block; width: 100%; text-align: right; background: none; border: 0; border-top: 1px solid var(--line); padding: 9px 0; font-size: 14px; }
.list button:first-child { border-top: 0; }
