/* Ecrãs do Hackathon: contagem (index.php) e temporizadores (timer.php). */
@font-face { font-family: 'Gloock'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/gloock-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/source-serif-4-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Source Serif 4'; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/source-serif-4-latin-400-italic.woff2) format('woff2'); }

:root {
  color-scheme: dark;
  --bg: #0e2619;
  --cream: #f4efe0;
  --leaf: #8fbf6f;
  --gold: #c9a24a;
  --mist: #a7bdaa;
  --dna-a: #6fa6c9;
  --dna-b: #8fbf6f;
  --alert: #f0715a;
  --alert-bg: #b83a25;
  --line: rgba(201, 162, 74, 0.45);
  --card: rgba(244, 239, 224, 0.05);
  --font-display: 'Gloock', 'Times New Roman', Georgia, serif;
  --font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  box-sizing: border-box;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse 70% 50% at 85% 0%, rgba(143, 191, 111, 0.16), transparent 60%), var(--bg);
  color: var(--cream);
  font-family: var(--font-body);
  padding-block: clamp(28px, 5vh, 56px) clamp(18px, 3vh, 30px);
  padding-left: max(36px, env(safe-area-inset-left, 0px));
  padding-right: max(36px, env(safe-area-inset-right, 0px));
}
.frame {
  position: fixed;
  inset: 10px;
  border: 1px solid rgba(201, 162, 74, 0.55);
  pointer-events: none;
}
.frame::after { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(201, 162, 74, 0.22); }
body.red .frame, body[data-state="ended"] .frame { border-color: var(--alert); }
.stage { position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0; }
.stage.center { justify-content: center; }

.logo { position: absolute; top: 0; right: 0; margin: 0; line-height: 0; z-index: 2; }
.logo img { display: block; width: clamp(120px, 13vw, 200px); height: auto; }

.eyebrow {
  display: flex; align-items: center; gap: 0.9rem; margin: 0 0 0.9rem;
  font-size: clamp(0.75rem, 1.2vw, 1rem); letter-spacing: 0.22em; text-transform: uppercase; color: var(--mist);
}
.eyebrow::before { content: ""; flex: none; width: 2.5rem; height: 1px; background: var(--gold); }
h1 {
  margin: 0; font-family: var(--font-display); font-weight: 400; line-height: 1; letter-spacing: -0.01em;
  font-size: clamp(2.2rem, min(5.4vw, 9vh), 5.2rem);
}
h1 span { display: block; }
h1 .g { color: var(--leaf); }
.when, .sub { margin: 0.7rem 0 0; font-size: clamp(1rem, min(2.2vw, 3.6vh), 1.8rem); font-style: italic; color: var(--gold); }

/* Hélice de ADN (index) */
.helix {
  display: none; position: absolute; left: 0; top: 0; width: 110px; height: 100%;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
}
.helix .sa, .helix .sb { fill: none; stroke-width: 3; stroke-linecap: round; }
.helix .sa { stroke: var(--dna-a); }
.helix .sb { stroke: var(--dna-b); }
.helix .rung { stroke: var(--mist); stroke-width: 2; }
.content { min-width: 0; }

/* Contagem do evento */
.count { container-type: inline-size; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: clamp(20px, 4vh, 44px); }
.unit { min-width: 0; padding: 0 2cqw; border-left: 1px solid var(--line); }
.unit:first-child { border-left: 0; padding-left: 0; }
.num { display: block; font-family: var(--font-display); font-size: 3rem; font-size: clamp(2rem, min(9cqw, 15vh), 8rem); line-height: 1; font-variant-numeric: tabular-nums; }
.unit:last-child .num { color: var(--leaf); }
body.live .num { color: var(--gold); }
.lab { display: block; margin-top: 0.6em; font-size: 0.8rem; font-size: clamp(0.7rem, 1.4cqw, 1rem); letter-spacing: 0.2em; text-transform: uppercase; color: var(--mist); }

/* Cartão do dia */
.daily {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(20px, 3vw, 48px); align-items: center;
  margin-top: clamp(20px, 4vh, 44px); padding: clamp(16px, 2.6vh, 30px) clamp(18px, 2.4vw, 40px);
  background: var(--card); border: 1px solid rgba(201, 162, 74, 0.4); border-radius: 2px;
}
.daily.fresh { animation: enter 0.6s ease backwards; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }
.date { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; padding-right: clamp(20px, 3vw, 48px); border-right: 1px solid var(--line); }
.date .lead { font-size: clamp(0.7rem, 1vw, 0.92rem); letter-spacing: 0.2em; text-transform: uppercase; color: var(--mist); }
.date .day { font-family: var(--font-display); font-size: clamp(3rem, min(7vw, 12vh), 6.5rem); line-height: 0.95; color: var(--gold); font-variant-numeric: tabular-nums; }
.date .month { font-size: clamp(0.85rem, 1.3vw, 1.2rem); letter-spacing: 0.2em; text-transform: uppercase; }
.clue { min-width: 0; }
.tag { display: inline-block; font-size: clamp(0.72rem, 1vw, 0.92rem); letter-spacing: 0.2em; text-transform: uppercase; padding-bottom: 0.3em; border-bottom: 1px solid currentColor; }
.tag.pista, .tag.teaser { color: var(--gold); }
.tag.curiosidade { color: var(--leaf); }
.tag.desafio { color: var(--dna-a); }
.clue h2 { margin: 0.55em 0 0.35em; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, min(2.5vw, 4.4vh), 2.8rem); line-height: 1.08; text-wrap: balance; }
.clue p { margin: 0; max-width: 62ch; font-size: clamp(1.05rem, min(1.6vw, 2.9vh), 1.8rem); line-height: 1.4; }
.clue p.big { margin-top: 0.5em; max-width: 30em; font-family: var(--font-display); font-size: clamp(1.4rem, min(2.8vw, 5vh), 3rem); line-height: 1.15; text-wrap: balance; }

/* Temporizador */
.timer { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: clamp(14px, 3vh, 30px); min-width: 0; }
.status { margin: 0; text-align: center; font-size: clamp(1rem, min(2.1vw, 3.6vh), 1.9rem); font-style: italic; color: var(--mist); }
.clock { display: flex; justify-content: center; font-family: var(--font-display); font-size: clamp(3rem, min(18.5vw, 36vh), 18rem); line-height: 1; color: var(--cream); }
.clock .d { display: inline-block; width: 0.66em; text-align: center; }
.clock .c { display: inline-block; width: 0.34em; text-align: center; }
body[data-state="idle"] .clock, body[data-state="waiting"] .clock { opacity: 0.4; }
body[data-state="paused"] .clock { opacity: 0.55; }
body.gold .clock { color: var(--gold); }
body.red .clock { color: var(--alert); animation: pulse 1s ease-in-out infinite; }
body[data-state="paused"] .clock, body[data-state="ended"] .clock { animation: none; }
body[data-state="ended"] .clock { color: var(--alert); }
@keyframes pulse { 50% { opacity: 0.6; } }
.scale { position: relative; margin-top: clamp(4px, 1.5vh, 16px); padding-bottom: 34px; }
.track { position: relative; height: 8px; background: rgba(244, 239, 224, 0.14); }
.fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--gold); }
body.red .fill { background: var(--alert); }
.tick { position: absolute; top: -6px; width: 2px; height: 20px; background: var(--mist); transform: translateX(-1px); }
.tick.on { background: var(--cream); }
.tl { position: absolute; top: 24px; transform: translateX(-50%); font-size: clamp(0.7rem, 1vw, 0.95rem); letter-spacing: 0.08em; white-space: nowrap; color: var(--mist); }
.tl.on { color: var(--cream); }
.tl.big { color: var(--alert); }
.legend { margin: 0; text-align: center; font-size: clamp(0.78rem, 1.05vw, 0.95rem); letter-spacing: 0.04em; color: var(--mist); }
.notfound { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.notfound h1 { font-size: clamp(2rem, 5vw, 4rem); }

/* Rodapé */
.foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-top: clamp(14px, 2.4vh, 26px); padding-top: 14px; border-top: 1px solid var(--line); }
.snd { font: inherit; font-size: clamp(0.72rem, 1vw, 0.92rem); letter-spacing: 0.16em; text-transform: uppercase; background: none; cursor: pointer; color: var(--gold); border: 1px solid var(--gold); padding: 0.5em 1.1em; border-radius: 2px; }
.snd.on { color: var(--leaf); border-color: var(--leaf); }
.snd.nag { animation: nag 1s ease-in-out 4; }
.snd:focus-visible { outline: 2px solid var(--cream); outline-offset: 3px; }
@keyframes nag { 50% { background: rgba(240, 113, 90, 0.35); } }
.conn { font-size: clamp(0.7rem, 1vw, 0.9rem); letter-spacing: 0.14em; text-transform: uppercase; color: var(--mist); }
.conn.bad { color: var(--alert); }

/* Avisos */
.flash { position: fixed; inset: 0; z-index: 40; pointer-events: none; opacity: 0; box-shadow: inset 0 0 0 14px var(--gold), inset 0 0 120px 20px rgba(201, 162, 74, 0.45); }
.flash.big { box-shadow: inset 0 0 0 18px var(--alert), inset 0 0 160px 30px rgba(240, 113, 90, 0.5); }
.flash.go { animation: fl 1s ease-in-out var(--n, 3); }
@keyframes fl { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
.banner {
  position: fixed; z-index: 50; left: 24px; right: 24px; top: 28px; padding: 0.5em 1em; text-align: center;
  font-family: var(--font-display); font-size: clamp(1.6rem, 4.2vw, 3.6rem); line-height: 1.1; color: var(--cream);
  background: var(--bg); border: 2px solid var(--gold); border-radius: 2px;
  opacity: 0; transform: translateY(-140%); transition: transform 0.4s ease, opacity 0.4s ease; pointer-events: none;
}
.banner.on { opacity: 1; transform: none; }
.banner.big { font-size: clamp(2.2rem, 6.5vw, 5.6rem); padding: 0.6em 1em; background: var(--alert-bg); border-color: var(--cream); }
.over {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 24px; text-align: center;
  background: #7a1f12; animation: ov 1.4s ease-in-out infinite alternate;
}
@keyframes ov { from { background: #4a1209; } to { background: #a5301e; } }
.over h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(3rem, 11vw, 10rem); line-height: 1; text-wrap: balance; }
.over p { margin: 0; font-size: clamp(1.1rem, 2.4vw, 2.2rem); }
.btn { font: inherit; font-size: clamp(0.8rem, 1.1vw, 1rem); letter-spacing: 0.16em; text-transform: uppercase; padding: 0.8em 1.3em; border-radius: 2px; cursor: pointer; color: var(--cream); background: transparent; border: 1px solid var(--gold); }


/* ---------- A Sala (fases da campanha) ---------- */
#ph-sala { min-width: 0; }
#ph-sala h1 .g { color: var(--cream); }
body.fase-perguntas #ph-sala h1 .g, body.fase-dados #ph-sala h1 .g { color: var(--gold); }
body.fase-porta #ph-sala h1 .g, body.fase-ingresso #ph-sala h1 .g { color: var(--leaf); }
.qcard {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(20px, 3vw, 48px); align-items: center;
  margin-top: clamp(18px, 3.5vh, 40px); padding: clamp(16px, 2.8vh, 34px) clamp(18px, 2.4vw, 40px);
  background: var(--card); border: 1px solid rgba(201, 162, 74, 0.4); border-radius: 2px;
}
.qcard.fresh { animation: enter 0.6s ease backwards; }
.qn { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; padding-right: clamp(20px, 3vw, 48px); border-right: 1px solid var(--line); }
.qn .lead { font-size: clamp(0.7rem, 1vw, 0.92rem); letter-spacing: 0.2em; text-transform: uppercase; color: var(--mist); }
.qn .day { font-family: var(--font-display); font-size: clamp(3rem, min(7vw, 12vh), 6.5rem); line-height: 0.95; color: var(--gold); font-variant-numeric: tabular-nums; }
.qtext { min-width: 0; }
.q-big { margin: 0; max-width: 24em; font-family: var(--font-display); font-size: clamp(1.7rem, min(3.6vw, 6.6vh), 4rem); line-height: 1.12; text-wrap: balance; }
.q-small { margin: 0 0 0.5em; max-width: 40em; font-style: italic; color: var(--mist); font-size: clamp(1rem, min(1.6vw, 2.9vh), 1.7rem); line-height: 1.3; text-wrap: balance; }
.val { margin: 0; font-family: var(--font-display); line-height: 1; color: var(--leaf); font-size: clamp(2.6rem, min(7.4vw, 14vh), 8rem); font-variant-numeric: tabular-nums; }
.val .unit-t { display: block; margin-top: 0.25em; font-family: var(--font-body); font-size: clamp(1rem, min(1.7vw, 3.1vh), 1.9rem); color: var(--cream); letter-spacing: 0.02em; }
.ctx { margin: 0.7em 0 0; max-width: 50em; font-size: clamp(1rem, min(1.5vw, 2.8vh), 1.65rem); line-height: 1.35; }
.src { margin: 0.7em 0 0; font-size: clamp(0.72rem, 1vw, 0.92rem); letter-spacing: 0.06em; color: var(--mist); }
.pips { display: flex; gap: clamp(5px, 0.7vw, 10px); margin-top: clamp(12px, 2vh, 22px); }
.pips i { flex: 1; max-width: 3.2rem; height: 6px; background: rgba(244, 239, 224, 0.14); }
.pips i.on { background: var(--gold); }
.pips i.cur { background: var(--cream); }
.qgrid, .dgrid { list-style: none; margin: clamp(14px, 2.4vh, 28px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 1.2vh, 14px) clamp(12px, 1.6vw, 24px); }
.qgrid li, .dgrid li { min-width: 0; padding-top: 0.55em; border-top: 1px solid var(--line); font-size: clamp(0.78rem, min(1.05vw, 1.9vh), 1.1rem); line-height: 1.3; color: var(--mist); }
.qgrid li b { display: block; font-family: var(--font-display); font-weight: 400; color: var(--gold); font-size: 1.15em; }
.qgrid li span, .dgrid li span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dgrid li b { display: block; font-family: var(--font-display); font-weight: 400; color: var(--leaf); font-size: clamp(1.1rem, min(1.8vw, 3.2vh), 2rem); line-height: 1.1; }
.dgrid li i { display: block; font-style: normal; color: var(--cream); font-size: 0.92em; }

/* Ingresso: relógio */
.sala-clock { margin-top: clamp(18px, 4vh, 44px); }
.sala-clock .clk { font-family: var(--font-display); line-height: 1; color: var(--cream); font-variant-numeric: tabular-nums; font-size: clamp(4rem, min(17vw, 34vh), 16rem); }
.sala-clock .clk.idle { opacity: 0.4; }
.sala-clock .clk.end { color: var(--alert); }
.sala-clock .status { text-align: left; margin-top: 0.4em; }

/* Porta: contagem + fechaduras */
.door-count { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: clamp(14px, 3vh, 34px); max-width: 60rem; container-type: inline-size; }
.door-count .unit:last-child .num { color: var(--leaf); }
.door-count .num { font-size: clamp(2.4rem, min(11cqw, 13vh), 7rem); }
.board { margin-top: clamp(14px, 2.6vh, 30px); --rh: clamp(1.7rem, calc(50vh / var(--rows)), 4.2rem); }
.b-head, .b-row { display: grid; grid-template-columns: minmax(8ch, 1.7fr) repeat(var(--cols), minmax(0, 1fr)); align-items: center; column-gap: 8px; }
.b-head { padding-bottom: 0.5em; border-bottom: 1px solid var(--line); font-size: clamp(0.66rem, 1vw, 0.9rem); letter-spacing: 0.14em; text-transform: uppercase; color: var(--mist); }
.b-head span { text-align: center; }
.b-head span:first-child { text-align: left; }
.b-head b { display: block; font-family: var(--font-display); font-weight: 400; letter-spacing: 0; color: var(--gold); font-size: 1.5em; }
.b-row { height: var(--rh); border-bottom: 1px solid rgba(201, 162, 74, 0.16); font-size: clamp(0.85rem, calc(var(--rh) * 0.42), 1.7rem); }
.b-team { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-row.done .b-team { color: var(--leaf); }
.lock { display: grid; place-items: center; height: 100%; }
.lock svg { height: 62%; max-height: 2.2rem; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lock.shut svg { stroke: rgba(167, 189, 170, 0.45); }
.lock.open svg { stroke: var(--leaf); fill: rgba(143, 191, 111, 0.22); }
.s-empty { margin-top: 1.5em; font-style: italic; color: var(--mist); }
.preview-tag { position: fixed; z-index: 70; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 0.3em 1em; font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase; color: #1a1405; background: var(--gold); border-radius: 2px; }
@media (max-width: 900px) { .qgrid, .dgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .qcard { grid-template-columns: minmax(0, 1fr); }
  .qn { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 0.6rem; padding: 0 0 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .b-team { white-space: normal; line-height: 1.1; font-size: 0.95rem; }
  .b-row { height: auto; min-height: var(--rh); }
  .b-head span:not(:first-child) { font-size: 0; letter-spacing: 0; } .b-head b { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) { .qcard.fresh { animation: none; } }

@media (min-width: 720px) {
  .helix { display: block; }
  .content { margin-left: 150px; }
}
@media (max-width: 720px) {
  .logo { position: static; align-self: flex-start; margin-bottom: 18px; }
  .daily { grid-template-columns: minmax(0, 1fr); }
  .date { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 0.6rem; padding: 0 0 12px; border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .count { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 20px; }
  .unit:nth-child(odd) { border-left: 0; padding-left: 0; }
  .num { font-size: clamp(2.2rem, 19cqw, 5rem); }
  .lab { font-size: 0.75rem; }
  .clock { font-size: 16.5vw; }
}
@media (prefers-reduced-motion: reduce) {
  .flash.go, body.red .clock, .snd.nag, .daily.fresh, .over { animation: none; }
  .banner { transition: none; }
}
