/* Geats Hub: estilos
   Conceito: o hub como o elenco de uma equipe sentai. Cada frente de conteúdo tem a cor de um
   ranger (Geek = vermelho, Política = azul, Instagram = rosa) e o apoio é a moeda dourada.
   Contorno grosso e sombra dura, como arte impressa de revista de tokusatsu. */

:root {
  /* a equipe */
  --red: #e5263a;
  --on-red: #ffffff;
  --blue: #2358e6;
  --on-blue: #ffffff;
  --pink: #f04a9b;
  --on-pink: #1a1230;
  --gold: #ffc41f;
  --on-gold: #1a1230;
  --green: #14a965;
  --on-green: #05200f;

  /* superfícies e texto (tema claro) */
  --paper: #eef1fa;
  --card: #ffffff;
  --ink: #15172b;
  --ink-soft: #4d5173;
  --line: #15172b;
  --shadow: #15172b;
  --hair: #d3d8ec;
  --dot: rgba(21, 23, 43, 0.13);
  --skeleton: #dde2f3;
  --skeleton-2: #eceffb;
  --scrim: rgba(8, 10, 24, 0.55);
  --focus: #2358e6;

  --font-display: "Dela Gothic One", "Arial Black", "DejaVu Sans", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --stroke: 2px;
  --r: 8px;
  --appbar-h: 60px;
  --tabbar-h: 72px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1124;
    --card: #181c3a;
    --ink: #f0f1ff;
    --ink-soft: #a9aed8;
    --line: #e9ebff;
    --shadow: #4a52b0;
    --hair: #2a3060;
    --dot: rgba(240, 241, 255, 0.08);
    --skeleton: #232850;
    --skeleton-2: #2e3566;
    --scrim: rgba(3, 4, 12, 0.7);
    --focus: #ffc41f;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #0e1124;
  --card: #181c3a;
  --ink: #f0f1ff;
  --ink-soft: #a9aed8;
  --line: #e9ebff;
  --shadow: #4a52b0;
  --hair: #2a3060;
  --dot: rgba(240, 241, 255, 0.08);
  --skeleton: #232850;
  --skeleton-2: #2e3566;
  --scrim: rgba(3, 4, 12, 0.7);
  --focus: #ffc41f;
  color-scheme: dark;
}

/* cor de cada frente (usada pela aba, pelo painel e pelo fundo do app) */
[data-color="red"] { --c: var(--red); --on-c: var(--on-red); }
[data-color="blue"] { --c: var(--blue); --on-c: var(--on-blue); }
[data-color="pink"] { --c: var(--pink); --on-c: var(--on-pink); }
[data-color="gold"] { --c: var(--gold); --on-c: var(--on-gold); }
[data-color="green"] { --c: var(--green); --on-c: var(--on-green); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--paper);
  overscroll-behavior-y: contain;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

body {
  --c: var(--red);
  --on-c: var(--on-red);
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.4 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- barra do topo ---------- */
.appbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--appbar-h);
  padding: 11px 16px 8px;
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.4px);
  background-size: 8px 8px;
  border-bottom: var(--stroke) solid var(--line);
}
.appbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--c);
  transition: background-color 0.3s ease;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mark { width: 30px; height: 30px; flex: none; color: var(--ink); }
.mark .r { stroke: var(--red); }
.mark .b { stroke: var(--blue); }
.mark .y { stroke: var(--gold); }
.mark .g { stroke: var(--green); }
.mark .p { stroke: var(--pink); }
.wordmark { font: 400 21px/1 var(--font-display); letter-spacing: 0.03em; text-transform: uppercase; font-synthesis: none; }
.appbar-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); font: 600 12px/1.2 var(--font-body); }

.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: var(--stroke) solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--shadow);
}
.icon-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--shadow); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.spin svg { animation: spin 0.8s linear infinite; }

/* ---------- abas (barra de baixo no celular) ---------- */
.tabbar {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: var(--stroke) solid var(--line);
}
.tab {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 4px;
  border: var(--stroke) solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font: 800 12px/1.1 var(--font-body);
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-selected="true"] {
  background: var(--c);
  color: var(--on-c);
  border-color: var(--line);
  box-shadow: 3px 3px 0 var(--shadow);
  transform: translate(-1px, -1px);
}
.tab .dot {
  position: absolute;
  top: 3px;
  right: 24%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--card);
  animation: pulse 1.6s ease-in-out infinite;
}

/* ---------- conteúdo ---------- */
.main {
  flex: 1;
  width: 100%;
  max-width: 920px;
  margin-inline: auto;
  padding: 18px 16px calc(var(--tabbar-h) + 104px + env(safe-area-inset-bottom, 0px));
}
.panel { display: grid; gap: 22px; animation: panel-in 0.22s ease-out; }

.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.phead-text { min-width: 0; }
.ptitle { margin: 0; font: 400 30px/1 var(--font-display); font-synthesis: none; overflow-wrap: anywhere; }
.psub { margin: 8px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.35; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
  border: var(--stroke) solid var(--line);
  border-radius: 10px;
  background: var(--c);
  color: var(--on-c);
  font: 800 14px/1 var(--font-body);
  box-shadow: 3px 3px 0 var(--shadow);
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-plain { background: var(--card); color: var(--ink); }
.btn-wide { width: 100%; }

/* vídeos */
.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: var(--stroke) solid var(--line);
  border-radius: 6px;
  background: var(--skeleton);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.sticker {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 5px 8px 4px;
  border: var(--stroke) solid var(--line);
  border-radius: 6px;
  background: var(--green);
  color: var(--on-green);
  font: 400 12px/1 var(--font-display);
  font-synthesis: none;
  text-transform: uppercase;
  transform: rotate(-4deg);
}
.dur {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(10, 12, 28, 0.88);
  color: #ffffff;
  font: 700 12px/1.3 var(--font-body);
  font-variant-numeric: tabular-nums;
}
.kind { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; color: #ffffff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7)); }

.hero { display: grid; gap: 14px; }
.hero .thumb { border-radius: var(--r); box-shadow: 6px 6px 0 var(--c); }
.hero-title { margin: 0; font: 800 21px/1.22 var(--font-body); text-wrap: balance; overflow-wrap: anywhere; }

.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; color: var(--ink-soft); font: 600 13px/1.2 var(--font-body); }
.meta .m { display: inline-flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.meta svg { width: 14px; height: 14px; flex: none; }

.sec-title { margin: 0 0 12px; font: 400 19px/1 var(--font-display); font-synthesis: none; }

.shelf {
  display: flex;
  gap: 12px;
  margin-inline: -16px;
  padding: 2px 16px 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.shelf::-webkit-scrollbar { display: none; }
.short { display: grid; flex: none; gap: 8px; width: 116px; align-content: start; scroll-snap-align: start; }
.short .thumb { aspect-ratio: 9 / 16; }
.short-title { margin: 0; font: 700 13px/1.25 var(--font-body); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.list { display: grid; gap: 16px; }
.row { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 12px; align-items: start; }
.row-title { margin: 0; font: 700 15px/1.3 var(--font-body); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.row .meta { margin-top: 6px; }

/* instagram */
.ig-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tile { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border: var(--stroke) solid var(--line); border-radius: 6px; background: var(--skeleton); }
.tile img { width: 100%; height: 100%; object-fit: cover; }

/* estados */
.state {
  display: grid;
  gap: 12px;
  padding: 22px 18px;
  border: var(--stroke) solid var(--line);
  border-radius: var(--r);
  background-color: var(--card);
  background-image: radial-gradient(var(--dot) 1.1px, transparent 1.4px);
  background-size: 8px 8px;
  box-shadow: 6px 6px 0 var(--c);
}
.state h3 { margin: 0; font: 400 21px/1.15 var(--font-display); font-synthesis: none; }
.state p { margin: 0; color: var(--ink-soft); }
.state .btn { justify-self: start; }

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: var(--stroke) solid var(--line);
  border-radius: var(--r);
  background: var(--gold);
  color: var(--on-gold);
  font: 700 14px/1.3 var(--font-body);
}
.notice button {
  flex: none;
  padding: 7px 10px;
  border: var(--stroke) solid var(--on-gold);
  border-radius: 8px;
  background: transparent;
  color: var(--on-gold);
  font: 800 13px/1 var(--font-body);
}

.sk { background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-2) 50%, var(--skeleton) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 6px; }
.sk-hero { aspect-ratio: 16 / 9; border-radius: var(--r); }
.sk-line { height: 16px; }
.sk-row { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 12px; }
.sk-thumb { aspect-ratio: 16 / 9; }

/* botão fixo do Livepix */
.fab {
  position: fixed;
  z-index: 25;
  right: 16px;
  bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom, 0px));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  padding: 8px 18px 8px 10px;
  border: var(--stroke) solid var(--line);
  border-radius: 999px;
  background: var(--gold);
  color: var(--on-gold);
  font: 800 15px/1 var(--font-body);
  box-shadow: 4px 4px 0 var(--shadow);
}
.fab:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--shadow); }
.fab svg { width: 30px; height: 30px; flex: none; }

/* aviso rápido */
.toast {
  position: fixed;
  z-index: 40;
  left: 16px;
  right: 16px;
  bottom: calc(var(--tabbar-h) + 78px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 520px;
  margin-inline: auto;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font: 700 14px/1.3 var(--font-body);
  box-shadow: 4px 4px 0 var(--c);
  animation: panel-in 0.2s ease-out;
}
.toast span { min-width: 0; overflow-wrap: anywhere; }
.toast button { flex: none; padding: 7px 10px; border: 2px solid currentColor; border-radius: 8px; background: transparent; font: 800 13px/1 var(--font-body); }

/* puxar para atualizar */
.ptr {
  position: fixed;
  z-index: 15;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + var(--appbar-h) + 6px);
  padding: 8px 14px;
  border: var(--stroke) solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font: 800 13px/1 var(--font-body);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(var(--pull, 0) * 1px - 56px));
}

/* folha de instruções (iPhone) */
.sheet { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; background: var(--scrim); }
.sheet-card {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  border: var(--stroke) solid var(--line);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: var(--card);
}
.sheet-card h2 { margin: 0; font: 400 22px/1.1 var(--font-display); font-synthesis: none; }
.steps { display: grid; gap: 10px; margin: 0; padding-left: 22px; }
.steps li { padding-left: 4px; }
.steps svg { display: inline-block; width: 18px; height: 18px; vertical-align: -4px; }

/* faixa da prévia (só aparece na versão de demonstração) */
.demo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  padding: 10px 16px;
  border-bottom: var(--stroke) solid var(--line);
  background: var(--gold);
  color: var(--on-gold);
  font: 700 13px/1.3 var(--font-body);
}
.demo strong { font-weight: 800; }
.demo label { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; }
.demo input { width: 18px; height: 18px; accent-color: var(--on-gold); }

noscript { display: block; padding: 24px 16px; text-align: center; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { transform: scale(1.25); } }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

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

/* telas largas: abas no topo, grade de vídeos */
@media (min-width: 820px) {
  :root { --tabbar-h: 0px; }
  .app { max-width: 920px; margin-inline: auto; border-inline: var(--stroke) solid var(--line); background: var(--paper); }
  .tabbar {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + var(--appbar-h));
    bottom: auto;
    z-index: 19;
    grid-template-columns: repeat(var(--n, 3), minmax(120px, 180px));
    justify-content: start;
    padding: 10px 16px;
    border-top: 0;
    border-bottom: var(--stroke) solid var(--line);
  }
  .tab { grid-auto-flow: column; justify-content: center; gap: 8px; min-height: 44px; font-size: 14px; }
  .main { padding-bottom: 120px; }
  .fab { right: max(24px, calc((100vw - 920px) / 2 + 24px)); bottom: 24px; }
  .toast { bottom: 96px; }
  .list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
  .row { grid-template-columns: minmax(0, 1fr); }
  .sk-row { grid-template-columns: minmax(0, 1fr); }
  .ig-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .hero { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; gap: 24px; }
  .hero-title { font-size: 26px; }
}
