:root {
  --bg: #14111f;
  --bg-2: #1e1a2e;
  --card: #262139;
  --line: #3a3354;
  --text: #f4f1fb;
  --muted: #a9a2c2;
  --accent: #ffcc4d;
  --accent-ink: #2a1f00;
  --truth: #2fbf71;
  --truth-bg: #123826;
  --lie: #a970ff;
  --lie-bg: #2c1b4d;
  --danger: #ff6b6b;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at top, #241d3d 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: 'Heebo', system-ui, sans-serif;
  font-size: 19px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 2.4rem; font-weight: 900; }
h2 { font-size: 1.6rem; font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 700; color: var(--muted); }
p { margin: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

/* כפתורים גדולים לאגודל */
button, .btn {
  font: inherit;
  font-weight: 700;
  font-size: 1.15rem;
  min-height: 60px;
  padding: 12px 20px;
  border-radius: 16px;
  border: 2px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  width: 100%;
  transition: transform .08s ease, filter .15s ease;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
button.ghost { background: transparent; color: var(--muted); min-height: 48px; font-weight: 500; font-size: 1rem; }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
button.pick { background: var(--bg-2); color: var(--text); border-color: var(--line); text-align: start; }
button.pick.selected { border-color: var(--accent); background: #3a3120; }

label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--muted); font-size: 1rem; }
input, select {
  font: inherit;
  font-size: 1.2rem;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input.code { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-weight: 800; direction: ltr; }

.seg { display: flex; gap: 6px; background: var(--bg-2); padding: 5px; border-radius: 14px; border: 1px solid var(--line); }
.seg button { min-height: 46px; font-size: 1rem; background: transparent; color: var(--muted); border-radius: 10px; padding: 6px 4px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle input { width: 28px; min-height: 28px; height: 28px; accent-color: var(--accent); }

/* פתיחה */
.logo { font-size: 3.4rem; text-align: center; margin-top: 24px; }
.title { text-align: center; }
.title .q { color: var(--accent); }
.howto { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.howto li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.howto li::before {
  content: counter(s);
  flex: 0 0 30px; height: 30px; border-radius: 50%;
  background: var(--bg-2); border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 800; color: var(--accent);
}

/* לובי */
.room-code { font-size: 3.2rem; font-weight: 900; letter-spacing: .25em; direction: ltr; text-align: center; color: var(--accent); }
.qr { background: #fff; border-radius: 14px; padding: 10px; width: 170px; height: 170px; margin: 0 auto; }
.qr img { width: 100%; height: 100%; display: block; }
.players { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.players li {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-2); border-radius: 12px; padding: 10px 14px; font-weight: 600;
}
.players li .tag { margin-inline-start: auto; font-size: .85rem; color: var(--muted); font-weight: 500; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--truth); flex: 0 0 10px; }
.dot.off { background: var(--danger); }

.status {
  font-size: 1.5rem; font-weight: 800; text-align: center;
  padding: 22px 12px; border-radius: var(--radius);
  background: var(--bg-2); border: 1px dashed var(--line);
}
.status .pulse { display: inline-block; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* סיבוב */
.topbar { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .95rem; }
.word {
  font-size: clamp(2.8rem, 14vw, 4.6rem);
  font-weight: 900;
  text-align: center;
  line-height: 1.25;
  padding: 10px 0;
  word-break: break-word;
}
.badge {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 1.5rem; font-weight: 900; padding: 14px; border-radius: var(--radius);
}
.badge.truth { background: var(--truth-bg); color: var(--truth); border: 2px solid var(--truth); }
.badge.lie { background: var(--lie-bg); color: var(--lie); border: 2px solid var(--lie); }
.badge.guesser { background: #3a3120; color: var(--accent); border: 2px solid var(--accent); }
.definition { font-size: 1.55rem; font-weight: 700; line-height: 1.45; text-align: center; padding: 22px 16px; }

.order { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: o; }
.order li { counter-increment: o; display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--bg-2); }
.order li::before { content: counter(o); font-weight: 900; color: var(--muted); width: 1.4em; text-align: center; }
.order li.me { outline: 2px solid var(--accent); font-weight: 800; }

.countdown { font-variant-numeric: tabular-nums; font-weight: 900; font-size: 1.3rem; color: var(--accent); }
.timer-bar { height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.timer-bar > i { display: block; height: 100%; background: var(--accent); transition: width .25s linear; }

.sticky-bottom { position: sticky; bottom: 0; padding: 10px 0 4px; background: var(--bg); box-shadow: 0 -14px 14px -4px var(--bg); }

/* חשיפה */
.reveal-intro {
  position: fixed; inset: 0; z-index: 5;
  display: grid; place-items: center;
  background: var(--bg);
  font-size: 2.4rem; font-weight: 900;
  pointer-events: none;
  animation: intro 1.4s ease forwards;
}
@keyframes intro {
  0% { opacity: 0; transform: scale(.85); }
  25% { opacity: 1; transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}
.reveal-body.animate { opacity: 0; animation: rise .45s ease 1.35s forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.verdict { font-size: 1.8rem; font-weight: 900; text-align: center; }
.truth-card { border: 2px solid var(--truth); background: var(--truth-bg); }
.truth-card .who { color: var(--truth); font-weight: 800; }
.lie-item { border-inline-start: 4px solid var(--lie); padding: 10px 14px; background: var(--bg-2); border-radius: 10px; }
.lie-item .who { color: var(--lie); font-weight: 800; font-size: .95rem; }
.lie-item.picked { outline: 2px solid var(--danger); }

.scores { width: 100%; border-collapse: collapse; font-size: 1.05rem; }
.scores td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.scores td.num { text-align: left; font-weight: 800; font-variant-numeric: tabular-nums; width: 3.5em; }
.scores .delta { color: var(--truth); font-weight: 800; }

/* סיום */
.podium { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end; gap: 8px; text-align: center; margin-top: 12px; }
.podium .step { background: var(--card); border: 1px solid var(--line); border-radius: 14px 14px 0 0; padding: 10px 4px; }
.podium .name { font-weight: 800; word-break: break-word; }
.podium .medal { font-size: 2rem; }
.podium .p1 { height: 170px; background: #3a3120; border-color: var(--accent); }
.podium .p2 { height: 130px; }
.podium .p3 { height: 100px; }

.notice { background: #3a3120; color: var(--accent); border-radius: 12px; padding: 10px 14px; font-weight: 600; text-align: center; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px);
  background: var(--danger); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 700;
  opacity: 0; transition: all .25s ease; pointer-events: none; max-width: 90vw; text-align: center; z-index: 10;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition: none !important; }
}

/* התקנה כאפליקציה */
.install-help { font-size: 1rem; }
.install-help ol { margin: 0; padding-inline-start: 1.3em; display: grid; gap: 6px; }
.share-icon { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border: 1px solid var(--line); border-radius: 6px; font-size: .9em; }
