/* =========================================================
   Home screen — notebook page
   Loaded after styles.css; overrides the old glass-card home.
   ========================================================= */
#screen-home {
  --h-ink:    #0d0d0d;
  --h-paper:  #1a1a1a;
  --h-text:   #f4efe3;
  --h-soft:   rgba(244, 239, 227, .68);
  --h-yellow: #ff9a2e;
  --h-mint:   #f4efe3;
  --h-pink:   #ff5a36;
  --h-sky:    #ff9a2e;
  --h-lilac:  #fde3b0;
}

body:has(#screen-home.active) { overflow: hidden; }

#screen-home.active {
  position: fixed;
  inset: 0;
  z-index: 3;                     /* below topbar (z-index 20) */
  display: block !important;
  overflow-y: auto;
  animation: none;
  color: var(--h-text);
  background-color: var(--h-ink);
  /* notebook dot grid */
  background-image:
    radial-gradient(ellipse 80% 60% at 30% 20%, rgba(244, 239, 227, .035), transparent 70%),
    radial-gradient(ellipse 70% 50% at 80% 85%, rgba(244, 239, 227, .025), transparent 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.h-stage {
  min-height: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding: 88px 24px 40px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-content: center;
  text-align: start;
}

/* ---------- Intro: wordmark + drawing ---------- */
.h-word {
  margin: 0;
  font-size: clamp(3.2rem, 11vw, 6.4rem);
  font-weight: 700;
  line-height: .95;
  letter-spacing: -.03em;
  color: var(--h-text);
}
.h-tagline {
  margin: 14px 0 0;
  max-width: 32ch;
  font-size: clamp(1.1rem, 2.6vw, 1.45rem);
  line-height: 1.35;
  color: var(--h-soft);
}

/* ---------- Action panel ---------- */
.h-panel {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 440px;
  padding: 22px;
  background: var(--h-paper);
  border: 2px solid rgba(244, 239, 227, .3);
  border-radius: 20px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, .35);
}

.h-field { display: grid; gap: 8px; margin: 0; }
.h-field > span {
  font-size: 1rem;
  font-weight: 700;
  color: var(--h-text);
}
#screen-home input[type="text"] {
  width: 100%;
  padding: 13px 16px;
  font-size: 1.1rem;
  color: var(--h-text);
  background: var(--h-ink);
  border: 2px solid rgba(244, 239, 227, .35);
  border-radius: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#screen-home input[type="text"]:focus {
  border-color: var(--h-yellow);
  box-shadow: 0 0 0 3px rgba(255, 154, 46, .25);
}

/* sticker buttons */
.h-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px;
  padding: 12px 20px;
  font-size: 1.1rem;
  font-weight: 700;
  border: 2px solid var(--h-ink);
  border-radius: 14px;
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.h-btn:focus-visible { outline: 3px solid var(--h-text); outline-offset: 3px; }
.h-btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--h-ink) !important; }

.h-btn-main { color: #2a1400; background: var(--h-yellow); box-shadow: 0 4px 0 #b45f0b; }
.h-btn-main:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #b45f0b; }
.h-btn-alt  { color: #1a1a1a; background: var(--h-mint);   box-shadow: 0 4px 0 #9c9482; }
.h-btn-alt:hover  { transform: translateY(-2px); box-shadow: 0 6px 0 #9c9482; }
.h-btn-quiet {
  color: var(--h-text);
  background: transparent;
  border-color: rgba(244, 239, 227, .45);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .35);
}
.h-btn-quiet:hover { background: rgba(244, 239, 227, .12); }

/* join */
.h-join { display: grid; gap: 8px; margin-top: 4px; padding-top: 16px; border-top: 2px dashed rgba(244, 239, 227, .3); }
.h-join-label { margin: 0; font-size: .95rem; color: var(--h-soft); }
#screen-home .join-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
#screen-home .join-row input {
  text-align: center;
  font-size: 1.25rem;
  letter-spacing: .3em;
  text-transform: uppercase;
}
html[dir="rtl"] #screen-home .join-row input { letter-spacing: .15em; }

/* rules */
.h-more { display: grid; gap: 6px; margin-top: 2px; }
.h-more .rules { border: 0; padding: 0; background: none; box-shadow: none; text-align: start; }
.h-more .rules summary { cursor: pointer; padding: 8px 0; font-weight: 700; color: var(--h-lilac); }
.h-more .rules ol, .h-more .rules ul { color: var(--h-soft); line-height: 1.6; }

/* ---------- Desktop: two columns ---------- */
@media (min-width: 900px) {
  .h-stage {
    grid-template-columns: 1.15fr minmax(380px, 440px);
    gap: 64px;
    align-items: center;
    padding-top: 96px;
  }
}

/* ---------- Home: the five chalk animals (replaces the fish drawing) ---------- */
.h-crowd {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  max-width: 560px;
  margin-top: 26px;
  padding-inline-start: 6px;
}
.h-pal {
  width: clamp(76px, 20vw, 118px);
  height: auto;
  margin-inline-end: -14px;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .35));
}
.h-pal.p1 { transform: rotate(-6deg); }
.h-pal.p2 { transform: rotate(4deg) translateY(10px); }
.h-pal.p3 { transform: rotate(-3deg); }
.h-pal.p4 { transform: rotate(5deg) translateY(8px); }
.h-pal.p5 { transform: rotate(-4deg); }

/* They pop in one after another, once. */
@media (prefers-reduced-motion: no-preference) {
  .h-pal { opacity: 0; animation: h-pop .45s cubic-bezier(.34, 1.56, .64, 1) forwards; }
  .h-pal.p1 { animation-delay: .15s; }
  .h-pal.p2 { animation-delay: .35s; }
  .h-pal.p3 { animation-delay: .55s; }
  .h-pal.p4 { animation-delay: .75s; }
  .h-pal.p5 { animation-delay: .95s; }
}
@keyframes h-pop {
  from { opacity: 0; scale: .6; }
  to   { opacity: 1; scale: 1; }
}

@media (min-width: 900px) {
  .h-crowd { max-width: 640px; }
  .h-pal { width: clamp(88px, 8vw, 112px); }
}

/* chalkboard finish for the home page */
.h-word { text-shadow: 0 0 1px rgba(244, 239, 227, .7), 3px 3px 0 rgba(0, 0, 0, .28); }
.h-panel { border-radius: 22px 26px 20px 27px / 26px 20px 27px 22px; border-color: rgba(244, 239, 227, .32); }

/* test-mode button: visibly separate from the real actions */
.h-practice { border-style: dashed; color: var(--h-lilac); min-height: 46px; font-size: 1rem; }

/* `display:flex` on .h-btn beats the browser's [hidden] rule, so hidden buttons
   (like the test-mode button) were still visible. Make [hidden] win again. */
.h-btn[hidden] { display: none !important; }

/* legal links under the rules */
.legal-links { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; padding-top: 6px; }
.legal-links a { color: var(--h-soft); font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; padding: 6px 2px; }
.legal-links a:hover { color: var(--h-text); }
.legal-links a:focus-visible { outline: 3px solid var(--h-text); outline-offset: 2px; border-radius: 4px; }
