:root {
  --c-bg: #14231C;
  --c-surface: #1E3329;
  --c-surface2: #27412F;
  --c-line: #3D5A48;
  --c-text: #F2EBDD;
  --c-muted: #B9B09E;
  --c-primary: #C9A227;
  --c-on-primary: #14231C;
  --c-accent: #E2E8F0;
  --c-on-accent: #14231C;
  --c-danger: #F87171;
  --c-success: #4ADE80;
  --c-felt: #1A2E24;
  --c-neutral: #33493C;
  --c-neutral-text: #F2EBDD;
  --c-f0: #4FD1C5;
  --c-f1: #E59866;
  --c-f2: #B39DF5;
  --c-f3: #E6CC5C;
  --c-ink: #10201A;
  --font-head: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, "Noto Sans Hebrew", sans-serif;
  --font-body: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, "Noto Sans Hebrew", sans-serif;
  --tap: 44px; --gap: 8px; --radius: 14px;
  --t-fast: 150ms; --t-ui: 220ms; --t-slow: 300ms;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-reduced-motion: reduce) { :root { --t-fast: 0ms; --t-ui: 0ms; --t-slow: 0ms; } }
html.nomo { --t-fast: 0ms; --t-ui: 0ms; --t-slow: 0ms; }
@font-face { font-family: "Heebo"; src: url(fonts/heebo-he.woff2) format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "Heebo"; src: url(fonts/heebo-la.woff2) format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--c-bg); color: var(--c-text); font: 16px/1.5 var(--font-body); -webkit-tap-highlight-color: transparent; overflow: hidden; }
.num, bdi.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible, canvas:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; }
canvas:focus { outline: none; }
canvas:focus-visible { outline: 3px solid var(--c-primary); outline-offset: -3px; }
.app { height: 100dvh; display: flex; flex-direction: column; padding-top: var(--safe-t); }
.top { display: flex; align-items: center; gap: var(--gap); padding: 6px 12px; min-height: 56px; background: linear-gradient(180deg, #213a2e, var(--c-surface)); border-block-end: 1px solid var(--c-line); box-shadow: 0 2px 6px #0006; position: relative; z-index: 2; }
.brand { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand h1 { margin: 0; font: 800 22px/1.2 var(--font-head); letter-spacing: 0; }
.mark { width: 26px; height: 26px; border-radius: 7px; background: conic-gradient(var(--c-f0) 0 25%, var(--c-f1) 0 50%, var(--c-f2) 0 75%, var(--c-f3) 0); box-shadow: inset 0 0 0 3px #0004, 0 1px 2px #0008; }
.ib { width: var(--tap); height: var(--tap); min-width: var(--tap); border-radius: 12px; border: 1px solid var(--c-line); background: var(--c-surface2); display: grid; place-items: center; box-shadow: inset 0 1px 0 #ffffff14, 0 2px 4px #0006; transition: transform var(--t-fast); }
.ib svg { width: 22px; height: 22px; fill: var(--c-text); stroke: var(--c-text); }
.ib:active { transform: translateY(1px) scale(.96); background: var(--c-line); }
.ib[aria-pressed="false"] .wave { opacity: 0; }
.hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px 12px 10px; background: var(--c-surface); border-block-end: 1px solid var(--c-line); }
.stat { background: var(--c-felt); border: 1px solid var(--c-line); border-radius: 10px; padding: 3px 8px; display: flex; flex-direction: column; align-items: center; box-shadow: inset 0 1px 3px #0007; }
.stat .lbl { font-size: 12px; color: var(--c-muted); line-height: 1.3; }
.stat .num { font-size: 18px; font-weight: 800; line-height: 1.25; }
.stat.clock.low .num { color: var(--c-danger); }
.shares { grid-column: 1 / -1; height: 10px; border-radius: 6px; overflow: hidden; display: flex; direction: ltr; background: var(--c-neutral); box-shadow: inset 0 1px 2px #0008; }
.shares i { display: block; height: 100%; transition: width var(--t-slow); }
.shares i.goal { position: relative; }
.layout { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mapwrap { flex: 1; min-height: 0; position: relative; background: radial-gradient(120% 90% at 50% 40%, #22392d 0%, var(--c-felt) 60%, #12201a 100%); }
#map { display: block; width: 100%; height: 100%; touch-action: none; }
.dock { padding: 8px 12px calc(10px + var(--safe-b)); background: linear-gradient(0deg, #182b22, var(--c-surface)); border-block-start: 1px solid var(--c-line); box-shadow: 0 -2px 8px #0006; }
.hint { margin: 0 0 4px; font-size: 14px; line-height: 1.4; color: var(--c-text); min-height: 1.4em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--c-muted); }
.readout strong { color: var(--c-text); font-weight: 700; }
.seg { display: flex; align-items: center; gap: var(--gap); margin-block-start: 8px; }
.seglbl { font-size: 14px; color: var(--c-muted); white-space: nowrap; }
.seg button { flex: 1; min-height: 48px; border-radius: 12px; border: 1px solid var(--c-line); background: var(--c-surface2); font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; box-shadow: inset 0 1px 0 #ffffff14, 0 2px 0 #0b1611; transition: transform var(--t-fast), background var(--t-fast); }
.seg button:active { transform: translateY(2px); box-shadow: none; }
.seg button[aria-pressed="true"] { background: var(--c-primary); color: var(--c-on-primary); border-color: #e9c95a; }
.legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--c-text); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend svg { width: 18px; height: 18px; }
.tip { font-size: 13px; color: var(--c-muted); line-height: 1.5; margin: 8px 0 0; }
.desk { display: none; }
.sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); background: #0b1510e6; opacity: 1; transition: opacity var(--t-ui); }
.sheet[hidden] { display: none; }
.card { width: 100%; max-width: 440px; max-height: 100%; overflow: auto; background: linear-gradient(180deg, #24402f, var(--c-surface)); border: 1px solid #4b6b56; border-radius: 20px; padding: 22px 20px; box-shadow: 0 18px 40px #000a, inset 0 1px 0 #ffffff1a; display: flex; flex-direction: column; gap: 10px; animation: pop var(--t-ui) ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }
.card h2 { margin: 0; font: 800 28px/1.2 var(--font-head); text-align: center; }
.card .sub { margin: 0; text-align: center; color: var(--c-muted); line-height: 1.6; }
.crest { display: flex; justify-content: center; }
.crest canvas { width: 240px; height: 120px; }
.btn { min-height: 48px; border-radius: 14px; border: 1px solid var(--c-line); background: var(--c-surface2); padding: 8px 14px; font-weight: 700; font-size: 17px; box-shadow: inset 0 1px 0 #ffffff14, 0 3px 0 #0b1611; transition: transform var(--t-fast); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 #ffffff14; }
.btn.main { background: var(--c-primary); color: var(--c-on-primary); border-color: #e9c95a; box-shadow: inset 0 1px 0 #fff5, 0 3px 0 #7d6417; }
.btn.danger { background: transparent; color: var(--c-danger); border-color: #8a3b3b; }
.btn.sm { min-width: 96px; }
.btn[aria-pressed="false"] { color: var(--c-muted); }
.row { display: flex; gap: var(--gap); }
.row .btn { flex: 1; }
.best { margin: 0; text-align: center; font-size: 14px; color: var(--c-muted); min-height: 1.4em; }
.tog { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 17px; }
.upd { min-height: 0; }
.upd button { min-height: 48px; }
.ver { margin: 0; text-align: center; font-size: 13px; color: var(--c-muted); }
.how { margin: 0; padding-inline-start: 22px; line-height: 1.6; }
.how li { margin-block-end: 6px; }
.badge { align-self: center; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 36px; background: var(--c-felt); border: 3px solid var(--c-primary); box-shadow: 0 4px 10px #0008; }
.badge.lost { border-color: var(--c-danger); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0; }
.stats div { background: var(--c-felt); border: 1px solid var(--c-line); border-radius: 12px; padding: 8px; text-align: center; }
.stats dt { font-size: 13px; color: var(--c-muted); }
.stats dd { margin: 0; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 360px) { .stat .num { font-size: 16px; } .brand h1 { font-size: 20px; } .seglbl { display: none; } }
@media (max-height: 700px) and (max-width: 899px) { .legend { display: none; } .hud { padding-block: 6px; } }
@media (min-width: 900px) {
  .top { padding-inline: 20px; }
  .hud { grid-template-columns: repeat(4, 160px) 1fr; align-items: center; padding: 10px 20px; }
  .shares { grid-column: auto; height: 12px; }
  .layout { flex-direction: row; max-width: 1280px; width: 100%; margin: 0 auto; }
  .dock { width: 340px; flex: none; order: -1; border-block-start: 0; border-inline-end: 1px solid var(--c-line); padding: 20px; box-shadow: none; background: var(--c-surface); overflow: auto; }
  .hint { white-space: normal; min-height: 3em; font-size: 15px; }
  .readout { flex-direction: column; gap: 2px; background: var(--c-felt); border: 1px solid var(--c-line); border-radius: 12px; padding: 10px 12px; }
  .seg { flex-wrap: wrap; }
  .seglbl { width: 100%; }
  .legend { flex-direction: column; gap: 6px; margin-top: 14px; font-size: 14px; }
  .desk { display: block; }
}

/* 0.2.2: sheet cards scroll instead of squashing their buttons on short screens */
.card > * { flex-shrink: 0; }
.ver.credit { font-size: 11px; opacity: .8; direction: ltr; }
/* 0.2.2: phone held sideways: map gets the full height, header + HUD + commands in a side column */
@media (orientation: landscape) and (max-height: 560px) and (max-width: 1100px) {
  .app { display: grid; grid-template-columns: minmax(260px, 34%) 1fr; grid-template-rows: auto auto 1fr; grid-template-areas: "top map" "hud map" "dock map"; padding-inline: env(safe-area-inset-right, 0px) env(safe-area-inset-left, 0px); }
  .layout { display: contents; }
  .top { grid-area: top; min-height: 0; padding: 4px 8px; }
  .brand h1 { font-size: 18px; }
  .mark { width: 20px; height: 20px; }
  .ib { --tap: 44px; }
  .hud { grid-area: hud; gap: 4px; padding: 4px 8px 6px; }
  .stat { padding: 1px 4px; }
  .stat .lbl { font-size: 11px; }
  .stat .num { font-size: 15px; }
  .shares { height: 8px; }
  .mapwrap { grid-area: map; min-height: 0; min-width: 0; }
  .dock { grid-area: dock; min-height: 0; overflow: auto; padding: 6px 8px calc(6px + var(--safe-b)); border-block-start: 0; border-inline-end: 1px solid var(--c-line); box-shadow: none; background: var(--c-surface); }
  .hint { white-space: normal; font-size: 13px; min-height: 2.8em; margin: 0 0 4px; }
  .readout { flex-direction: column; gap: 0; font-size: 13px; }
  .seg { margin-block-start: 6px; gap: 6px; }
  .seglbl { display: none; }
  .seg button { min-height: 44px; font-size: 16px; }
  .legend { display: flex; font-size: 12px; gap: 2px 10px; margin-top: 6px; }
  .sheet { padding: 8px 12px; }
  .card { padding: 14px 16px; gap: 8px; max-width: 560px; }
  .card h2 { font-size: 22px; }
  .card.hero { display: grid; grid-template-columns: 1fr 1fr; align-items: center; column-gap: 16px; }
  .card.hero .crest, .card.hero h2, .card.hero .sub { grid-column: 1; }
  .card.hero .btn, .card.hero .row, .card.hero .best { grid-column: 2; }
  .card.hero .crest { grid-row: 1 / span 2; }
  .card.hero .crest canvas { width: 180px; height: 90px; }
  .how { line-height: 1.45; font-size: 15px; }
  .btn { min-height: 44px; }
}

/* 0.2.3: language toggle (עב / EN) */
.tog .lang { display: flex; gap: 6px; direction: ltr; }
.tog .lang .btn { min-width: 56px; }
.tog .lang .btn[aria-pressed="true"] { background: var(--c-primary); color: var(--c-on-primary); border-color: #e9c95a; }
