:root {
  --bg: #efeae2;
  --ink: #1c1914;
  --muted: #4e473f;
  --paper: #fffdf9;
  --line: #e3d9cc;
  --cream: #f7f1e6;
  --torch: #ef8f1e;
  --torch-ink: #1a120c;
  --bar: #14181f;
  --shadow: 0 16px 40px rgba(28, 22, 14, 0.08);
  --radius: 22px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 18px; background: var(--bg); overflow-anchor: none; }
@media (max-width: 700px) { html { font-size: 16px; } }
@media (min-width: 1500px) { html { font-size: 20px; } }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

[dir="rtl"] { unicode-bidi: isolate; }
::selection { background: #f6c98a; color: #1a120c; }

img { max-width: 100%; height: auto; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }

.skip {
  position: absolute;
  left: 12px;
  top: 8px;
  transform: translateY(-150%);
  background: #fff;
  color: #1a120c;
  padding: 8px 12px;
  z-index: 80;
  border-radius: 8px;
}
.skip:focus { transform: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--torch);
  outline-offset: 3px;
}

.wrap, .bar-inner {
  width: min(1240px, calc(100% - 32px));
  margin-inline: auto;
}
@media (max-width: 700px) {
  .wrap, .bar-inner { width: min(1240px, calc(100% - 20px)); }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bar);
  color: var(--cream);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

.bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  padding-bottom: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-height: 48px;
}
.logo { width: 48px; height: 48px; flex: none; display: block; }
.wordmark {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}
.brand-he {
  display: block;
  margin-top: 3px;
  font-size: 1.02rem;
  color: #eadccb;
  font-weight: 600;
}

.search { flex: 1 1 240px; min-width: 0; }
.search input {
  width: 100%;
  min-height: 48px;
  font-size: max(16px, 1em);
  padding: 0 16px 0 44px;
  border-radius: 999px;
  border: 1px solid transparent;
  background-color: #2a3140;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23c8c0b4' stroke-width='2.4'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 16px 50%;
  color: var(--cream);
  color-scheme: dark;
}
.search input::placeholder { color: #b7b1a6; }
.search input:focus-visible { outline: none; border-color: var(--torch); box-shadow: 0 0 0 3px rgba(239, 143, 30, 0.35); }

.byline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
  margin: 18px 0 4px;
  font-size: 1.12rem;
}
.byline .dot { color: var(--muted); }
.byline .he { font-size: 1.22rem; }

.tip {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.4;
}
.tip-tight { margin: 4px 0 0; font-size: 0.95rem; }

body[data-view="play"] .byline,
body[data-view="play"] .tip-home,
body[data-view="play"] .chips { display: none; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  min-height: 74px;
  padding: 8px 0 14px;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 52px;
  padding: 6px 16px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.15;
}
.chip-he { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.chip[data-category="Grammar"] { box-shadow: inset 4px 0 0 #ef8f1e; }
.chip[data-category="Vocabulary"] { box-shadow: inset 4px 0 0 #0f7a62; }
.chip[data-category="Reading"] { box-shadow: inset 4px 0 0 #2f5fbf; }
.chip[data-category="Quiz"] { box-shadow: inset 4px 0 0 #b4415b; }
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}
.chip[aria-pressed="true"] .chip-he { color: #f0d7b4; }

.page { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }

.notice {
  background: #fff4df;
  border: 1px solid #efd3a2;
  border-radius: 14px;
  padding: 10px 14px;
  margin: 0 0 14px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  min-height: 420px;
  background: #17130f;
  color: var(--cream);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 22px 50px rgba(20, 14, 10, 0.18);
}
.hero-media {
  position: relative;
  display: block;
  min-height: 260px;
  background: #100e0c;
}
.hero-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-copy {
  padding: 32px 32px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}
.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 800;
  color: #ef8f1e;
}
.hero .kicker { color: #ffb45a; }
.kicker-he { letter-spacing: 0; text-transform: none; font-weight: 700; }
.hero h2, .detail-copy h2, .section-head h2, .card h3 {
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.hero h2 {
  margin: 0;
  font-size: clamp(2.3rem, 4vw, 3.5rem);
}
.hero .he, .he-lg {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  color: #f3e2c8;
}
.lede { margin: 0; font-size: 1.08rem; line-height: 1.45; }
.hero .lede { color: #f4ebdf; }

.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.badge, .level {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.86rem;
  font-weight: 700;
}
.card .badge, .detail-copy .badge { background: #f4e7d4; color: #1c1914; }
.card .level, .detail-copy .level { background: transparent; padding-inline: 0; color: var(--muted); font-weight: 600; }

.actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin-top: 6px; }
.open-game {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35em;
  width: 100%;
  box-sizing: border-box;
  min-height: 64px;
  padding: 12px 18px;
  border-radius: 16px;
  background: var(--torch);
  color: var(--torch-ink);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}
.open-game:hover { background: #f7a33a; }
.open-game:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.card .open-game:focus-visible,
.detail-copy .open-game:focus-visible { outline-color: var(--torch); }
.stage-open {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  max-width: calc(100% - 28px);
  min-width: min(100%, 280px);
  z-index: 2;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.card-actions { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid #cfc3b2;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.quiet:hover { background: rgba(28, 25, 20, 0.04); }
.hero .quiet { color: var(--cream); border-color: rgba(246, 241, 231, 0.45); }
.hero .quiet:hover { background: rgba(255, 255, 255, 0.06); }
.quiet:focus-visible { outline: 3px solid var(--torch); outline-offset: 2px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; }
.actions-row > * { flex: 1 1 120px; width: auto; }
.actions-row .ghost { min-height: 44px; font-size: 0.98rem; border-radius: 12px; }
.play, .ghost, .stage-play, .stage-bar .ghost, .exit-full {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 0 22px;
  border-radius: 16px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.25rem;
}
.play, .stage-play {
  background: var(--torch);
  color: var(--torch-ink);
}
.actions > .play,
.actions > .ghost { flex: 1 1 160px; }
.card .play { flex: 0 0 auto; align-self: stretch; }
.play:hover, .stage-play:hover { background: #f7a33a; }
.ghost {
  flex: 1 1 160px;
  background: transparent;
  color: var(--ink);
  border: 2px solid #cfc3b2;
}
.hero .ghost { color: var(--cream); border-color: rgba(246, 241, 231, 0.4); }
.hero .ghost:hover { background: rgba(255, 255, 255, 0.06); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 12px;
}
.section-head h2 { margin: 0; font-size: 1.7rem; }
.count { margin: 0; color: var(--muted); font-weight: 700; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.card-media { display: block; background: #14110e; aspect-ratio: 16 / 9; }
.card-media img, .ph { width: 100%; height: 100%; aspect-ratio: 16 / 9; display: block; object-fit: cover; }
.soon-art { width: 100%; aspect-ratio: 16 / 9; display: block; }
.card-body {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.card h3 { margin: 0; font-size: 1.5rem; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card .he { margin: 0; font-size: 1.2rem; }
.desc {
  margin: 0;
  color: #3f382f;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .play { margin-top: auto; width: 100%; box-sizing: border-box; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.tags li {
  font-size: 0.86rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3ece3;
  color: #3a332b;
}

.ph {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 40% 60%, rgba(239, 143, 30, 0.5), transparent 46%),
    linear-gradient(160deg, #3a2a1c, #14110e);
  color: #f6efe4;
  font-size: 3rem;
  font-weight: 800;
}
.card.soon {
  background: transparent;
  border: 2px dashed #cfc3b2;
  box-shadow: none;
}
.soon-art {
  position: relative;
  background:
    radial-gradient(circle at 30% 70%, rgba(239, 143, 30, 0.45), transparent 42%),
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255, 255, 255, 0.05) 22px 23px),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(255, 255, 255, 0.05) 22px 23px),
    linear-gradient(160deg, #2c241c, #12100e);
}
.soon-art::after {
  content: "+";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(246, 239, 228, 0.85);
  font-size: 4rem;
  font-weight: 500;
}
.empty-note { margin: 0 0 12px; font-size: 1.15rem; font-weight: 700; }

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr);
  gap: 26px;
  align-items: start;
  margin-top: 8px;
}
.detail-copy { display: flex; flex-direction: column; gap: 10px; }
.detail-copy h2 { margin: 0; font-size: clamp(2.1rem, 4vw, 3.15rem); }
.detail-copy .he-lg { color: var(--ink); }
.detail-copy .lede { font-size: 1.12rem; }
.back {
  align-self: flex-start;
  font-weight: 800;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.back:hover { text-decoration: underline; }

.stage-wrap { min-width: 0; }
.stage {
  position: relative;
  background: #100e0c;
  border-radius: 24px;
  overflow: hidden;
  min-height: 200px;
}
.stage img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.stage-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  min-width: 148px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  flex: none;
}
.stage-play:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px #fff, 0 0 0 8px #ef8f1e;
}
.stage.live {
  height: min(72svh, 820px);
  height: min(72dvh, 820px);
}
.stage.live iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
  overflow: hidden;
  overscroll-behavior: none;
}
.stage-msg { color: var(--cream); padding: 24px; }
.stage-bar { display: flex; justify-content: flex-end; padding-top: 10px; }
.stage-bar .ghost { min-height: 52px; flex: 0 1 auto; }

html:has(body[data-view="play"]),
body[data-view="play"] {
  overflow: hidden;
  overscroll-behavior: none;
  height: 100svh;
  height: 100dvh;
  height: var(--vvh, 100dvh);
}
body[data-view="play"] {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  touch-action: manipulation;
}
body[data-view="play"] .topbar { flex: none; }
body[data-view="play"] .wrap.page {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
body[data-view="play"] main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body[data-view="play"] .detail {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  margin-top: 8px;
  overflow: hidden;
  grid-template-rows: minmax(0, 1fr);
}
body[data-view="play"] .stage-wrap {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body[data-view="play"] .stage.live {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  max-height: none;
}
body[data-view="play"] .detail-copy {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
body[data-view="play"] .footer { display: none; }

.exit-full {
  display: none;
  position: absolute;
  z-index: 3;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 10px;
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.95rem;
  background: rgba(20, 16, 12, 0.82);
  color: #f7f1e6;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.stage.is-full .exit-full,
.stage:fullscreen .exit-full { display: inline-flex; }
.stage:fullscreen,
.stage.is-full {
  border-radius: 0;
  width: 100%;
  height: 100%;
  max-height: none;
}
.stage.is-full {
  position: fixed;
  inset: 0;
  z-index: 60;
}
body.locked {
  overflow: hidden;
  overscroll-behavior: none;
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}

.footer {
  margin-top: 34px;
  padding-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}
.loading { font-size: 1.15rem; }

@media (max-width: 860px) {
  .hero, .detail { grid-template-columns: 1fr; }
  .hero { min-height: 0; }
  .hero-media { aspect-ratio: 16 / 9; min-height: 0; }
  .hero-copy { padding: 20px 18px 22px; }
  .detail-copy { order: 2; }
  body[data-view="play"] .detail {
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 10px;
  }
  body[data-view="play"] .detail-copy { max-height: 32svh; }
}

@media (hover: hover) and (pointer: fine) {
  .card { transition: transform 0.18s ease, box-shadow 0.18s ease; }
  .card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(28, 22, 14, 0.12); }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:hover { transform: none; }
}


/* Official-hub Demo button (owner / Tester only). Compact on phones, readable on a projector. */
.hub-demo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 228, 160, 0.45);
  background: transparent;
  color: #ffe9a0;
  text-decoration: none;
  font: 700 1.05rem/1 "Segoe UI", Arial, "Noto Sans Hebrew", sans-serif;
  letter-spacing: 0.02em;
}
.hub-demo-btn:hover, .hub-demo-btn:focus-visible {
  background: rgba(239, 143, 30, 0.22);
  border-color: #ef8f1e;
  color: #fff6dc;
  outline: none;
}
.hub-demo-ico { flex: none; display: block; }
@media (max-width: 700px) {
  .hub-demo-btn { min-height: 44px; padding: 7px 12px; font-size: 1rem; }
}
@media (min-width: 1400px) {
  .hub-demo-btn { min-height: 48px; padding: 8px 18px; font-size: 1.15rem; }
}
