/* Layout: one calm column. A big rounded colour block carries each screen's main action; soft white cards with pale inner blocks sit below. The enamel house-number plate is the game's signature object. */
:root {
  --bg: #eef0ec;
  --card: #ffffff;
  --well: #f2f4f0;
  --well-2: #e7eae4;
  --ink: #17202c;
  --muted: #565e69;
  --hero: #dfc994;
  --hero-deep: #c9b17a;
  --hero-ink: #2b2414;
  --hero-soft: rgb(60 45 10 / .1);
  --enamel: #173d7a;
  --enamel-deep: #0f2a57;
  --enamel-ink: #f6efdd;
  --accent: #1f4f9c;
  --rust: #a5411a;
  --screw: #b9b2a3;
  --gloss: rgb(255 255 255 / .22);
  --line: #e1e5de;
  --font-display: "Secular One", "Arial Hebrew", system-ui, sans-serif;
  --font-body: "Assistant", "Arial Hebrew", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1114; --card: #181b20; --well: #20242b; --well-2: #272c34; --ink: #ecedf0; --muted: #959ba6;
    --hero: #40382a; --hero-deep: #2e281d; --hero-ink: #f3e9d2; --hero-soft: rgb(255 255 255 / .1);
    --enamel: #1a3f7c; --enamel-deep: #10295a; --accent: #6f9be0; --rust: #ee8a5a; --screw: #8a8f99;
    --gloss: rgb(255 255 255 / .16); --line: #2a2f37; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1114; --card: #181b20; --well: #20242b; --well-2: #272c34; --ink: #ecedf0; --muted: #959ba6;
  --hero: #40382a; --hero-deep: #2e281d; --hero-ink: #f3e9d2; --hero-soft: rgb(255 255 255 / .1);
  --enamel: #1a3f7c; --enamel-deep: #10295a; --accent: #6f9be0; --rust: #ee8a5a; --screw: #8a8f99;
  --gloss: rgb(255 255 255 / .16); --line: #2a2f37; color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px 48px;
}
main { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
h1, h2 { font-family: var(--font-display); font-weight: 400; margin: 0; text-wrap: balance; }
h2 { font-size: 1.1rem; }
.label { font-size: .82rem; color: var(--muted); }
.note { font-size: .9rem; color: var(--rust); margin: 0; padding-inline: 6px; }
.note:empty { display: none; }

.hero {
  background: var(--hero); color: var(--hero-ink); border-radius: 30px; padding: 16px 18px 22px;
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
}
.hero-label { font-size: .9rem; opacity: .8; margin-top: 6px; }
.plate {
  position: relative; width: 168px; height: 124px; border-radius: 18px;
  background: linear-gradient(180deg, var(--gloss), transparent 45%), var(--enamel); color: var(--enamel-ink);
  display: grid; place-items: center; font-family: var(--font-display); font-size: 4rem; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 6px var(--enamel), inset 0 0 0 8px var(--enamel-ink), 0 5px 0 var(--enamel-deep), 0 14px 28px rgb(0 0 0 / .25);
}
.plate::before, .plate::after {
  content: ""; position: absolute; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--enamel-ink), var(--screw) 60%); box-shadow: 0 1px 1px rgb(0 0 0 / .4);
}
.plate::before { inset-inline-start: 15px; }
.plate::after { inset-inline-end: 15px; }
.hero-sub { margin: 0; font-size: .85rem; opacity: .7; }

.btn {
  font: 700 1.02rem var(--font-body); border: 0; border-radius: 999px; padding: 12px 22px; cursor: pointer;
  background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s, opacity .1s;
}
.btn:active { transform: scale(.97); }
.btn.light { background: var(--enamel); color: var(--enamel-ink); min-width: 210px; margin-top: 6px; font-size: 1.1rem; padding: 14px 28px; }
.btn.ghost { background: var(--well); color: var(--ink); }
.btn.ghost:hover { background: var(--well-2); }
.bar .btn.ghost { background: var(--card); }
.btn.small { font-size: .88rem; padding: 8px 14px; }
.btn:focus-visible, input:focus-visible, .chip:focus-visible, .cell:focus-visible { outline: 3px solid var(--rust); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: default; }

.card { background: var(--card); border-radius: 26px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-inline: 4px; }
.count { color: var(--muted); font-size: .88rem; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px; }
.stat { background: var(--well); border-radius: 18px; padding: 12px 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; text-align: center; }
.stat b { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { font-size: .76rem; color: var(--muted); }

.leaders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.leader { display: grid; grid-template-columns: 30px 44px 1fr auto; align-items: center; gap: 10px; background: var(--well); border-radius: 18px; padding: 8px 12px; }
.leader.me { background: var(--well-2); box-shadow: inset 0 0 0 2px var(--accent); }
.rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--muted); font-family: var(--font-display); font-size: .95rem; font-variant-numeric: tabular-nums; }
.leader:first-child .rank { background: var(--hero); color: var(--hero-ink); }
.thumb { width: 44px; height: 44px; border-radius: 14px; object-fit: cover; background: var(--well-2); display: grid; place-items: center; color: var(--muted); font-family: var(--font-display); }
.who { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.who b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); font-size: .78rem; }
.who .bar { display: block; height: 6px; border-radius: 3px; background: var(--card); overflow: hidden; }
.who .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.score { font-family: var(--font-display); font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.score span { font-size: .78rem; color: var(--muted); font-family: var(--font-body); }
.nick { display: flex; flex-direction: column; gap: 6px; padding-inline: 4px; }
.nick input { flex: 1; min-width: 0; }

.board { display: grid; }
.cell {
  aspect-ratio: 1; max-width: 100%; border: 0; padding: 0; position: relative; overflow: hidden;
  background: var(--well); color: var(--muted); font-family: var(--font-display); font-weight: 400;
  display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.cell.found { cursor: pointer; background: var(--enamel); color: var(--enamel-ink); }
.cell.found img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cell.found .n { position: absolute; line-height: 1.5; background: var(--card); color: var(--ink); }
.cell.next { background: var(--card); box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.cell.unverified::after { content: ""; position: absolute; border-radius: 50%; background: var(--rust); box-shadow: 0 0 0 2px var(--card); }

.rules ol { margin: 0; padding: 0; list-style: none; counter-reset: r; display: flex; flex-direction: column; gap: 6px; }
.rules li { counter-increment: r; background: var(--well); border-radius: 16px; padding: 10px 14px; display: flex; gap: 10px; align-items: baseline; }
.rules li::before { content: counter(r); font-family: var(--font-display); color: var(--accent); min-width: 1ch; }

.sheet-wrap { position: fixed; inset: 0; background: rgb(10 14 24 / .45); display: grid; align-items: end; justify-items: center; z-index: 20; }
.sheet {
  background: var(--card); width: 100%; max-width: 520px; border-radius: 28px 28px 0 0; max-height: 92%; overflow-y: auto;
  padding: 20px max(18px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 14px;
}
.sheet img { width: 100%; max-height: 46vh; object-fit: contain; border-radius: 20px; background: var(--well); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field input, .nick input { font: 1rem var(--font-body); padding: 12px 16px; border-radius: 16px; border: 0; background: var(--well); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 600 .9rem var(--font-body); border: 0; background: var(--well); color: var(--ink); border-radius: 999px; padding: 7px 14px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row .btn { flex: 1; }
.nick .row .btn { flex: 0 0 auto; }
.err { color: var(--rust); font-size: .9rem; margin: 0; }
.err:empty { display: none; }
.meta { color: var(--muted); font-size: .92rem; margin: 0; }
.check { margin: 0; padding: 9px 14px; border-radius: 14px; font-weight: 600; font-size: .95rem; background: var(--well); color: var(--muted); }
.check[data-state="ok"] { background: var(--enamel); color: var(--enamel-ink); }
.check[data-state="ok"]::before { content: "✓ "; }
.check[data-state="miss"], .check[data-state="screen"] { background: transparent; color: var(--rust); box-shadow: inset 0 0 0 2px var(--rust); }
.share img { width: 100%; border-radius: 18px; }
@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .plate { width: 148px; height: 110px; font-size: 3.5rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .cell.fresh { animation: pop .6s cubic-bezier(.16, 1, .3, 1); }
  @keyframes pop { from { transform: scale(.6); } }
  .plate.flip { animation: flip .7s cubic-bezier(.3, 0, .2, 1) .5s both; }
  @keyframes flip { 50% { transform: rotateX(90deg); } }
  .check[data-state="wait"]::before { animation: pulse 1s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: .25; } }
}

/* v8: home page, game modes, number tiles */
:root { --c-moment: #b8481c; --c-steps: #1c7350; --c-daily: #7a4fb0; }
[data-view] { display: flex; flex-direction: column; gap: 14px; }
.bar { display: flex; align-items: center; gap: 12px; }
.bar h2 { font-size: 1.3rem; }
.lede { margin: 0; color: var(--muted); padding-inline: 4px; }

.home-hero {
  position: relative; overflow: hidden; background: var(--hero); color: var(--hero-ink); border-radius: 30px;
  padding: 30px 22px 22px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; min-height: 300px; justify-content: flex-end;
}
.wordmark { font-size: clamp(3rem, 15vw, 4.6rem); line-height: .92; position: relative; }
.home-hero p { margin: 0; max-width: 24ch; opacity: .88; position: relative; }
.home-hero .btn { position: relative; margin-top: 4px; }
.mini {
  position: absolute; display: grid; place-items: center; font-family: var(--font-display); color: var(--enamel-ink);
  background: linear-gradient(180deg, var(--gloss), transparent 45%), var(--enamel); border-radius: 10px;
  box-shadow: inset 0 0 0 3px var(--enamel), inset 0 0 0 4px var(--enamel-ink), 0 3px 0 var(--enamel-deep);
}
.mini.a { width: 74px; height: 56px; font-size: 1.7rem; top: 22px; inset-inline-end: 22px; transform: rotate(7deg); }
.mini.b { width: 56px; height: 44px; font-size: 1.25rem; top: 98px; inset-inline-end: 20px; transform: rotate(-9deg); }
.mini.c { width: 48px; height: 38px; font-size: 1.05rem; top: 30px; inset-inline-end: 118px; transform: rotate(-4deg); }

.games { display: flex; flex-direction: column; gap: 8px; }
.game {
  display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; text-align: start; width: 100%;
  background: var(--card); border: 0; border-radius: 22px; padding: 10px; cursor: pointer; color: var(--ink); font: inherit;
}
.game:focus-visible { outline: 3px solid var(--rust); outline-offset: 2px; }
.game:active { transform: scale(.985); }
.glyph { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-family: var(--font-display); font-size: 1.2rem; color: #fff; direction: ltr; }
.g-hunt { background: var(--enamel); color: var(--enamel-ink); box-shadow: inset 0 0 0 3px var(--enamel), inset 0 0 0 4px var(--enamel-ink); }
.g-moment { background: var(--c-moment); }
.g-steps { background: var(--c-steps); }
.g-daily { background: var(--c-daily); }
.game b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.1rem; }
.game small { color: var(--muted); font-size: .88rem; }

/* board: five large number tiles per row */
.board { grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cell { border-radius: 14px; font-size: 1.1rem; }
.cell.found .n { font-size: .78rem; padding: 0 6px; border-radius: 8px; inset-inline-start: 5px; bottom: 5px; }
.cell.unverified::after { top: 6px; inset-inline-end: 6px; width: 9px; height: 9px; }

.checks { display: flex; flex-direction: column; gap: 6px; }
.tile-prev { display: flex; gap: 12px; align-items: center; }
.sheet .tile-prev img { width: 92px; height: 92px; max-height: none; border-radius: 16px; object-fit: cover; flex: none; }
.tile-prev p { margin: 0; color: var(--muted); font-size: .9rem; }

/* the wall behind the plate: sun-bleached plaster */
.hero, .home-hero { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .15 0 0 0 0 .05 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E"); perspective: 700px; }
.mode-hero .btn.light { background: #fff; }
.link { background: none; border: 0; color: var(--muted); font: 600 .95rem var(--font-body); padding: 8px; cursor: pointer; align-self: center; text-decoration: underline; text-underline-offset: 3px; }
.link:focus-visible { outline: 3px solid var(--rust); outline-offset: 2px; }
.locked { opacity: .5; pointer-events: none; }
.check[data-state="wait"]::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-inline-end: 8px; }
.tile-prev { align-items: flex-start; }
.tile-prev .checks { flex: 1; min-width: 0; }
::selection { background: var(--enamel); color: var(--enamel-ink); }
input { caret-color: var(--accent); }
::placeholder { color: var(--muted); opacity: 1; }

/* shared feeds */
.feed { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.shot { position: relative; border-radius: 18px; overflow: hidden; background: var(--well); aspect-ratio: 3 / 4; max-width: 100%; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot span { position: absolute; inset-inline-start: 8px; bottom: 8px; background: var(--card); color: var(--ink); border-radius: 999px; padding: 2px 10px; font-size: .82rem; font-weight: 700; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot.flag span::after { content: " ·  לא אומת"; color: var(--rust); font-weight: 400; }
.empty { margin: 0; background: var(--well); border-radius: 18px; padding: 16px; color: var(--muted); text-align: center; }
.prompt { font-family: var(--font-display); font-size: 1.7rem; line-height: 1.15; margin: 0; }
.mode-hero { border-radius: 30px; padding: 22px; color: #fff; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.mode-hero p { margin: 0; opacity: .9; }
.mode-hero .btn.light { margin-top: 2px; min-width: 0; }
.m-moment { background: var(--c-moment); } .m-moment .btn.light { color: var(--c-moment); }
.m-steps { background: var(--c-steps); } .m-steps .btn.light { color: var(--c-steps); }
.m-daily { background: var(--c-daily); } .m-daily .btn.light { color: var(--c-daily); }
.inline { display: flex; gap: 8px; }
.leader.nothumb { grid-template-columns: 30px 1fr auto; }
.inline .btn.ghost { background: var(--card); }
.inline input { flex: 1; min-width: 0; font: 1rem var(--font-body); padding: 12px 16px; border-radius: 16px; border: 0; background: var(--card); color: var(--ink); }
@media (max-width: 420px) { .cell { border-radius: 11px; } }

/* standalone site */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; padding-top: max(16px, env(safe-area-inset-top, 0px)); padding-bottom: max(48px, env(safe-area-inset-bottom, 0px)); }
[hidden] { display: none !important; }
img { max-width: 100%; }

/* joining */
.join { display: flex; flex-direction: column; gap: 12px; }
.join .field input { font-size: 1.1rem; }
.invite { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-inline: 4px; }
.invite code { font: 600 1rem var(--font-body); letter-spacing: .08em; direction: ltr; }

/* in-app camera */
.cam { position: fixed; inset: 0; z-index: 30; background: #000; display: flex; flex-direction: column; }
.cam video { flex: 1; min-height: 0; width: 100%; object-fit: cover; }
.cam-top { position: absolute; inset: 0 0 auto; padding: max(14px, env(safe-area-inset-top, 0px)) 16px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: #fff; background: linear-gradient(#000a, transparent); }
.cam-top b { font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; }
.cam-top button { background: rgb(255 255 255 / .18); color: #fff; border: 0; border-radius: 999px; padding: 8px 16px; font: 600 .95rem var(--font-body); }
.cam-bottom { padding: 18px 16px max(22px, env(safe-area-inset-bottom, 0px)); display: grid; place-items: center; gap: 8px; background: #000; color: #fff; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: var(--enamel); cursor: pointer; }
.shutter:active { transform: scale(.94); }
.shutter:focus-visible, .cam-top button:focus-visible { outline: 3px solid var(--hero); outline-offset: 3px; }
.cam-bottom small { opacity: .8; }
.sheet .shot-prev { max-height: 38vh; }
