/* ============================================================
   TippyTap — shared styles
   Landing-style launcher: rounded frame, bold blue hero with a
   clean top nav, and playful white game cards (numbered badge,
   title, age chip, big icon on a tinted panel). Flat + modern.
   Fonts: Nunito (UI) + Baloo 2 (display).
   ============================================================ */

:root {
  /* brand / UI */
  --primary:      #2F86FF;   /* hero blue */
  --primary-700:  #1C6DF0;
  --cta:          #FB8C1A;   /* warm orange CTA */
  --cta-700:      #EF7A06;
  --ink:          #1F2937;   /* body text */
  --muted:        #6B7280;
  --bg:           #DCE4EE;   /* page backdrop behind the frame */
  --surface:      #FFFFFF;
  --line:         #E5E7EB;

  /* age-band accents */
  --band-little:  #12B886;
  --band-middle:  #228BE6;
  --band-big:     #7950F2;

  --radius:       22px;
  --radius-lg:    30px;
  --radius-pill:  999px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 2px 6px rgba(15,23,42,.08);
  --shadow-md: 0 10px 24px rgba(15,23,42,.12);
  --shadow-lg: 0 18px 40px rgba(15,23,42,.18);
  --shadow-frame: 0 30px 70px rgba(11,42,92,.22);

  --font-ui:      'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible { outline: 3px solid var(--cta); outline-offset: 3px; border-radius: 10px; }

/* ============================================================
   FRAME
   ============================================================ */
.tt-frame {
  max-width: 1120px;
  margin: 18px auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-frame);
  overflow: hidden;
}

/* ============================================================
   HERO
   ============================================================ */
.tt-hero {
  position: relative;
  padding: 22px clamp(20px, 4vw, 44px) 96px;
  background:
    radial-gradient(120% 90% at 85% -10%, #5AA2FF 0%, transparent 55%),
    linear-gradient(180deg, var(--primary) 0%, var(--primary-700) 100%);
  color: #fff;
  overflow: hidden;
}

/* top nav */
.tt-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.tt-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: .01em;
}
.tt-brand .tt-mark {
  width: 34px; height: 34px;
  border-radius: 11px;
  background: #fff;
  color: var(--primary-700);
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.15rem;
  box-shadow: var(--shadow-sm);
}
.tt-surprise {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: .98rem;
  color: #fff;
  cursor: pointer;
  background: rgba(255,255,255,.18);
  border: 1.5px solid rgba(255,255,255,.45);
  padding: 0 20px;
  height: 46px;
  border-radius: var(--radius-pill);
  transition: background .18s ease, transform .18s ease;
}
.tt-surprise:hover { background: rgba(255,255,255,.28); }
.tt-surprise:active { transform: scale(.96); }

/* hero content */
.tt-hero-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: clamp(18px, 4vw, 40px);
}
.tt-hero-copy { flex: 1 1 360px; min-width: 0; }
.tt-h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 6.5vw, 4rem);
  line-height: 1.02;
  letter-spacing: -.01em;
}
.tt-sub {
  margin-top: 16px;
  max-width: 34ch;
  font-size: clamp(1rem, 2.4vw, 1.2rem);
  font-weight: 600;
  color: rgba(255,255,255,.9);
}
.tt-cta {
  margin-top: 26px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  cursor: pointer;
  background: var(--cta);
  border: none;
  padding: 0 30px;
  height: 56px;
  border-radius: var(--radius-pill);
  box-shadow: 0 10px 22px rgba(239,122,6,.42);
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.tt-cta:hover { background: var(--cta-700); }
.tt-cta:active { transform: translateY(2px); box-shadow: 0 6px 14px rgba(239,122,6,.4); }

/* hero art (logo + floating emoji bubbles) */
.tt-hero-art {
  position: relative;
  flex: 1 1 300px;
  min-height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tt-hero-art > img {
  width: min(340px, 86%);
  height: auto;
  border-radius: 24px;
  filter: drop-shadow(0 20px 34px rgba(2,30,70,.4));
}
.tt-bubble {
  position: absolute;
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  background: rgba(255,255,255,.2);
  border: 1.5px solid rgba(255,255,255,.4);
  box-shadow: 0 10px 20px rgba(2,30,70,.22);
  animation: tt-float 4s ease-in-out infinite;
}
.tt-bubble.b1 { top: 4%;   left: 2%;  animation-delay: 0s; }
.tt-bubble.b2 { top: 12%;  right: 4%; animation-delay: .6s; }
.tt-bubble.b3 { bottom: 8%; left: 6%; animation-delay: 1.2s; }
.tt-bubble.b4 { bottom: 2%; right: 10%; animation-delay: 1.8s; }
@keyframes tt-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* ============================================================
   MAIN / CARDS
   ============================================================ */
.tt-main {
  position: relative;
  margin-top: -64px;           /* lift cards up over the hero */
  padding: 0 clamp(16px, 4vw, 40px) 44px;
}

.tt-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
  padding-top: 8px;
}
.tt-h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.4rem, 3.4vw, 1.9rem);
  color: var(--ink);
  /* sits in the white zone; the cards above overlap the blue */
  margin-left: 4px;
}

.tt-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.tt-filter {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: .92rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  background: var(--surface);
  border: 1.5px solid var(--line);
  padding: 0 16px;
  height: 40px;
  border-radius: var(--radius-pill);
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.tt-filter:hover { color: var(--ink); border-color: #D1D5DB; }
.tt-filter.is-active { color: #fff; background: var(--primary); border-color: var(--primary); }
.tt-filter[data-band="little"].is-active { background: var(--band-little); border-color: var(--band-little); }
.tt-filter[data-band="middle"].is-active { background: var(--band-middle); border-color: var(--band-middle); }
.tt-filter[data-band="big"].is-active    { background: var(--band-big);    border-color: var(--band-big); }

.tt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

/* playful white game card */
.tt-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-md);
  transition: transform .18s ease, box-shadow .18s ease;
  cursor: pointer;
}
.tt-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.tt-card:active { transform: translateY(-2px); }

.tt-card-top { display: flex; align-items: center; gap: 11px; }
.tt-card-num {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--tile, var(--primary));
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: .95rem;
  display: grid; place-items: center;
}
.tt-card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  line-height: 1.1;
}

.tt-card-icon {
  position: relative;
  margin-top: 14px;
  height: 132px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  /* soft tint of the game's colour */
  background: color-mix(in srgb, var(--tile, #2F86FF) 12%, #fff);
}
.tt-card-emoji {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 8px 10px rgba(15,23,42,.18));
  transition: transform .18s ease;
}
.tt-card:hover .tt-card-emoji { transform: scale(1.08) rotate(-3deg); }
.tt-card-band {
  position: absolute;
  top: 10px; right: 10px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: .68rem;
  letter-spacing: .03em;
  color: #fff;
  background: var(--tile, var(--primary));
  padding: 4px 9px;
  border-radius: var(--radius-pill);
}
.tt-card.is-hidden { display: none; }

.tt-footer {
  margin-top: 36px;
  font-weight: 700;
  font-size: .9rem;
  color: var(--muted);
  text-align: center;
}

/* ============================================================
   IN-GAME SHELL  (injected by shell.js on every game page)
   ============================================================ */
.tt-home {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 50;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
  transition: transform .18s ease, background .18s ease;
}
.tt-home:hover { background: var(--primary-700); }
.tt-home:active { transform: scale(.94); }
.tt-home::before {
  content: "";
  position: absolute; inset: -4px;
  border-radius: 50%;
  background: conic-gradient(#fff calc(var(--hold, 0) * 360deg), transparent 0deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  opacity: .9;
  pointer-events: none;
}
.tt-home svg { position: relative; z-index: 1; width: 26px; height: 26px; pointer-events: none; }

.tt-home-hint {
  position: fixed;
  top: max(76px, calc(env(safe-area-inset-top) + 60px));
  right: max(16px, env(safe-area-inset-right));
  z-index: 50;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .8rem;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  opacity: 0; transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
.tt-home-hint.is-show { opacity: 1; transform: translateY(0); }

.tt-fill { position: fixed; inset: 0; }

/* ============================================================
   SHARED IN-GAME OVERLAYS / PANELS / BUTTONS
   Used by games for start & end screens — flat, matches launcher.
   ============================================================ */
.tt-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(28, 58, 110, 0.55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.tt-overlay.hidden, .tt-overlay.is-hidden { display: none; }

.tt-panel {
  width: 100%;
  max-width: min(90vw, 380px);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.tt-panel-title {
  font-family: var(--font-display);
  font-weight: 800; line-height: 1.05;
  font-size: clamp(1.7rem, 7vw, 2.3rem);
  color: var(--ink);
}
.tt-panel-msg {
  font-weight: 600;
  font-size: clamp(1rem, 4.5vw, 1.18rem);
  color: var(--muted);
}
.tt-panel-msg b { color: var(--ink); font-weight: 800; }

.tt-btn {
  margin-top: 8px;
  font-family: var(--font-ui);
  font-weight: 800; font-size: 1.1rem;
  color: #fff; cursor: pointer; border: none;
  background: var(--primary);
  height: 54px; padding: 0 34px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  transition: background .18s ease, transform .18s ease;
}
.tt-btn:hover { background: var(--primary-700); }
.tt-btn:active { transform: translateY(2px); }
.tt-btn--cta { background: var(--cta); box-shadow: 0 8px 18px rgba(239,122,6,.4); }
.tt-btn--cta:hover { background: var(--cta-700); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
  .tt-frame { margin: 10px; border-radius: 24px; }
  .tt-hero { padding-bottom: 84px; }
  .tt-hero-inner { flex-direction: column; align-items: flex-start; }
  .tt-hero-art { width: 100%; min-height: 180px; margin-top: 10px; }
  .tt-hero-art > img { width: min(240px, 64%); }
  .tt-bubble { width: 52px; height: 52px; font-size: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
