:root {
  --bg: #c9baad;
  --paper: rgba(255, 248, 235, 0.86);
  --paper2: rgba(255, 248, 235, 0.78);
  --ink: #2b1d12;
  --ink-soft: rgba(43, 29, 18, 0.72);
  --shadow: 0 14px 35px rgba(0, 0, 0, .18);
  --radius: 18px;
  --max: 1100px;
  --line: rgba(43, 29, 18, .14);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  background-image: url("https://www.transparenttextures.com/patterns/elastoplast.png");
}

/* ===== LAYOUT ===== */
.wrap {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 28px);
}

.shell {
  width: min(var(--max), 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(14px, 2.5vw, 24px);
  align-items: start;
}

/* ===== HERO COLLAGE ===== */
.hero {
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.hero img {
  width: 100%;
  height: auto;
  display: block;
}

/* ===== PANEL (paper label) ===== */
.panel {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 2.2vw, 22px);
  border: 1px solid rgba(43, 29, 18, .12);
  backdrop-filter: blur(6px);
  position: static;
  top: 18px;
  z-index: 5;
}

.kicker {
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .78rem;
  color: var(--ink-soft);
  margin: 0 0 10px;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  line-height: 1.1;
}

.desc {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.45;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.field {
  flex: 1 1 220px;
  display: flex;
  gap: 10px;
  align-items: center;
}

input[type="password"] {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(43, 29, 18, .22);
  background: rgba(255, 255, 255, .65);
  outline: none;
  font-size: 0.98rem;
}

input[type="password"]:focus {
  border-color: rgba(43, 29, 18, .45);
  box-shadow: 0 0 0 3px rgba(43, 29, 18, .12);
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 44px;

  font-family: inherit;
  font-size: 0.60rem;
  line-height: 1;

  cursor: pointer;
  font-weight: 650;
  letter-spacing: .02em;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .14);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  user-select: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.btn:active {
  transform: translateY(0px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .13);
}

.btn-primary {
  background: linear-gradient(180deg, #3c2414, #24150b);
  color: #fff;
}

.btn-ghost {
  background: rgba(255, 255, 255, .55);
  color: var(--ink);
  border: 1px solid rgba(43, 29, 18, .18);
  box-shadow: none;
}

.hint {
  margin: 10px 0 0;
  font-size: .85rem;
  color: rgba(43, 29, 18, .62);
  line-height: 1.35;
}

/* ===== FILTER MENU ===== */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  border: 1px solid rgba(43, 29, 18, .18);
  background: rgba(255, 255, 255, .55);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  box-shadow: none;
}

.chip:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.chip:active { transform: translateY(0px); }

.chip[aria-pressed="true"] {
  background: linear-gradient(180deg, #3c2414, #24150b);
  color: #fff;
  border-color: rgba(0, 0, 0, .08);
}

/* =========================================================
   ✅ GRID (CORRIGIDO DE VERDADE)
   - começa escondido
   - SÓ vira grid quando ganha .is-visible
   ========================================================= */
.grid {
  display: none; /* start hidden */
}

.grid.is-visible {
  display: grid;
  grid-column: 1 / -1;

  /* centralizado + colunas consistentes (sem buraco) */
  grid-template-columns: repeat(auto-fit, 340px);
  justify-content: center;

  gap: 12px;
  margin-top: 10px;
}

.secret {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(43, 29, 18, .25);
  background: rgba(255, 255, 255, .55);
  color: rgba(43, 29, 18, .70);
  font-size: .88rem;
}

.unlocked .secret { display: block; }

/* ===== CARDS ===== */
.card {
  background: var(--paper2);
  border: 1px solid rgba(43, 29, 18, .12);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 12px 25px rgba(0, 0, 0, .12);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 210px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.card h3 {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: .02em;
}

.meta {
  margin: 0;
  font-size: .85rem;
  color: var(--ink-soft);
}

/* preview box */
.preview {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .55);
  padding: 12px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview img {
  width: 100%;
  height: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 14px;
}

/* different preview demos */
.demo-img {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.demo-img img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(43, 29, 18, .14);
  flex: 0 0 auto;
}

/* OVERRIDE: preview grande pros cards de Images */
.card[data-cat="images"] .preview {
  min-height: 200px;
  padding: 12px;
}

.card[data-cat="images"] .preview .demo-img {
  width: 100%;
  height: 100%;
}

.card[data-cat="images"] .preview .demo-img img {
  width: 100%;
  height: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 14px;
}

.demo-img .label {
  font-weight: 750;
  color: rgba(43, 29, 18, .80);
  font-size: .95rem;
}

.demo-frame {
  width: 100%;
  text-align: center;
  padding: 12px;
  border-radius: 14px;
  border: 2px dashed rgba(43, 29, 18, .28);
  outline: 8px solid rgba(43, 29, 18, .08);
  outline-offset: 4px;
  font-weight: 750;
  color: rgba(43, 29, 18, .78);
}

.demo-scroll {
  width: 100%;
  height: 78px;
  overflow: auto;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(43, 29, 18, .12);
  background: rgba(255, 255, 255, .58);
  line-height: 1.35;
  font-size: .92rem;
  color: rgba(43, 29, 18, .78);
}

.demo-scroll::-webkit-scrollbar { width: 10px; }

.demo-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(43, 29, 18, .35);
  border: 2px solid rgba(255, 255, 255, .55);
}

.demo-title {
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  letter-spacing: .06em;
  font-weight: 900;
  text-transform: uppercase;
  color: rgba(43, 29, 18, .85);
}

.demo-paper {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(43, 29, 18, .14);
  padding: 12px;
  background: rgba(255, 248, 235, .85);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, .08);
  color: rgba(43, 29, 18, .80);
  font-weight: 650;
  text-align: center;
}

.demo-a {
  font-weight: 800;
  color: rgba(43, 29, 18, .88);
  text-decoration: none;
  border-bottom: 1px dashed rgba(43, 29, 18, .55);
  padding-bottom: 2px;
}

/* ✅ code hidden by default */
.codebox { display: none; }
.card.is-open .codebox { display: block; }

pre {
  margin: 0;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(43, 29, 18, .14);
  background: rgba(255, 255, 255, .55);
  overflow: auto;
  font-size: .86rem;
  line-height: 1.35;
  max-height: 140px;

  position: relative;
  padding-top: 2em;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

pre::before {
  content: attr(data-lang);
  position: absolute;
  top: 6px;
  left: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem;
  letter-spacing: .12em;
  color: rgba(43, 29, 18, .55);
  background: rgba(255, 248, 235, .55);
  padding: 2px 6px;
  border-radius: 6px;
}

.card-actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px dashed rgba(43, 29, 18, .18);
}

.card-actions a {
  font-weight: 800;
  color: #2b1d12;
  text-decoration: none;
  border-bottom: 1px dashed rgba(43, 29, 18, .55);
  padding-bottom: 2px;
}

.card-actions a:hover { border-bottom-style: solid; }

.mini {
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(43, 29, 18, .18);
  background: rgba(255, 255, 255, .55);
  box-shadow: none;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .panel { position: static; }

  .grid.is-visible {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }
}

@media (max-width: 560px) {
  .grid.is-visible { grid-template-columns: 1fr; }

  .btn { width: 100%; }
  .row { width: 100%; }
  .field { width: 100%; }
}

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

.clue {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ===== EASTER EGG MODAL ===== */
.egg-modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, .35);
  padding: 18px;
  z-index: 9999;
}

.egg-modal.is-open { display: grid; }

.egg-window {
  width: min(720px, 100%);
  border-radius: 18px;
  background: rgba(255, 248, 235, .92);
  border: 1px solid rgba(43, 29, 18, .18);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .28);
  overflow: hidden;
}

.egg-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px dashed rgba(43, 29, 18, .22);
}

.egg-title {
  font-weight: 900;
  letter-spacing: .12em;
  font-size: .82rem;
}

.egg-x {
  border: 1px solid rgba(43, 29, 18, .18);
  background: rgba(255, 255, 255, .55);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 900;
}

.egg-body { padding: 14px; }

.egg-line {
  margin: 0 0 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: rgba(43, 29, 18, .78);
}

.egg-hint summary {
  cursor: pointer;
  font-weight: 900;
  margin-top: 10px;
}

.egg-hint p {
  margin: 8px 0 0;
  color: rgba(43, 29, 18, .70);
}

.egg-input {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.egg-label {
  grid-column: 1 / -1;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .75rem;
  color: rgba(43, 29, 18, .65);
}

#eggAnswer {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(43, 29, 18, .22);
  background: rgba(255, 255, 255, .65);
  outline: none;
  font-size: 0.98rem;
}

#eggAnswer:focus {
  border-color: rgba(43, 29, 18, .45);
  box-shadow: 0 0 0 3px rgba(43, 29, 18, .12);
}

.egg-status {
  margin: 12px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: rgba(43, 29, 18, .78);
}

.trophy-imgwrap {
  width: 86px;
  height: 86px;
  display: grid;
  place-items: center;
}

.trophy-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.credit{
  text-align:center;
  font-family: ui-monospace, "Courier New", Courier, monospace;
  font-size:.8rem;
  margin:0;
  padding:0;
}

.credit a{
  position: relative;
  display: inline-block;
  color: rgba(43,29,18,.55);
  text-decoration: none;
  transition: color .18s ease;
}

.credit a::before{
  content:"";
  position:absolute;
  left:-6px;
  right:-6px;
  bottom:.05em;
  height:1.05em;
  border-radius:8px;
  background: rgba(43,29,18,.10);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s steps(10, end);
  z-index:-1;
}

.credit a::after{
  content:"";
  position:absolute;
  right:-10px;
  top:50%;
  width:8px;
  height:1.05em;
  transform: translateY(-50%);
  border-left: 2px solid rgba(43,29,18,.0);
  opacity:0;
}

.credit a:hover{ color: rgba(43,29,18,.82); }
.credit a:hover::before{ transform: scaleX(1); }
.credit a:hover::after{
  opacity:1;
  border-left-color: rgba(43,29,18,.55);
  animation: caretBlink .8s step-end infinite;
}

@keyframes caretBlink { 50%{ opacity:.15; } }

/* =========================
   FIX: esconder "Code → / Copy" solto fora dos cards
   ========================= */
.card-actions,
.credit {
  display: none;
}

.card > .card-actions {
  display: flex; /* volta ao normal dentro do card */
}

.card > .credit {
  display: block; /* volta ao normal dentro do card */
}

/* TEXT CARDS: preview sem moldura */
.card[data-cat="text"] .demo-frame {
  border: none;
  outline: none;
  background: transparent;
  padding: 0;
}

.music-player {
  margin-left: auto;
  margin-right: auto;
}

/* ===== RESOURCES (cards inside the main grid) ===== */
.card[data-cat="resources"] .preview {
  padding: 0;
  min-height: 330px;
  border: 0;
  background: transparent;
}

.resource-frame {
  width: 100%;
  border: 2px dotted rgba(43, 29, 18, .55);
  padding: 10px;
  border-radius: 14px;
  background-repeat: repeat;
}

.resource-frame iframe {
  width: 100%;
  height: 300px;
  border: none;
  display: block;
  border-radius: 10px;
}

.bg-0067 { background-image: url(/img/0067.gif); }
.bg-0068 { background-image: url(/img/0068.gif); }
.bg-0069 { background-image: url(/img/0069.gif); }
.bg-0070 { background-image: url(/img/0070.gif); }
.bg-0071 { background-image: url(/img/0071.gif); }
.bg-0072 { background-image: url(/img/0072.gif); }

/* link normal */
a {
  color: #894d04;
  text-decoration: none;
  font-weight: 600;
}

/* hover */
a:hover {
  color: #432102;
  text-decoration: underline;
}

/* visited */
a:visited {
  color: #a10b60;
}

/* active (quando clica) */
a:active {
  color: #2b0f45;
}

/* focus (acessibilidade / teclado) */
a:focus-visible {
  outline: 2px dotted #5a2b8c;
  outline-offset: 2px;
}

/* ===== Updates Popup ===== */
.updates-btn {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;

  padding: 10px 14px;
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.75);
  border: 2px solid rgba(43, 29, 18, 0.55);

  font-weight: 700;
  cursor: pointer;
}

.updates-btn:hover {
  background: rgba(255, 255, 255, 0.92);
}

.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(2px);
}

.popup {
  position: fixed;
  top: 72px;
  right: 18px;
  z-index: 9999;

  width: min(860px, calc(100vw - 36px));
  max-height: min(78vh, 720px);

  background: rgba(255, 255, 255, 0.88);
  border: 2px solid rgba(43, 29, 18, 0.55);
  border-radius: 18px;

  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.popup-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.65);
  border-bottom: 1px solid rgba(43, 29, 18, 0.25);
}

.popup-titlebar h2 {
  font-size: 1.05rem;
  margin: 0;
}

.popup-actions {
  display: flex;
  gap: 8px;
}

.mini-btn {
  border: 1px solid rgba(43, 29, 18, 0.45);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 700;
}

.mini-btn:hover {
  background: rgba(255, 255, 255, 0.95);
}

.popup-body {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 14px;

  padding: 12px;
  overflow: auto;
  max-height: calc(min(78vh, 720px) - 52px);
}

@media (max-width: 900px) {
  .popup-body {
    grid-template-columns: 1fr;
  }
}

/* Panels */
.updates-panel,
.chat-panel {
  border: 1px solid rgba(43, 29, 18, 0.25);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.55);
}

.updates-panel h3,
.chat-panel h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.updates-list {
  margin: 0;
  padding-left: 18px;
}

.updates-list li {
  margin-bottom: 8px;
}

.chat-frame {
  border: 2px dotted rgba(43, 29, 18, 0.45);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.65);
}

.small-note {
  margin-top: 10px;
  font-size: 0.85rem;
  opacity: 0.85;
}

.entrance {
  display: block;
  margin-top: clamp(40px, 8vh, 120px);
  margin-left: auto;
  margin-right: auto;
  width: 80%;
  max-width: 900px;
}

.top-badges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;

  margin-top: 16px;
}