:root {
  --bg:           #f5f9fc;
  --panel:        rgba(255, 255, 255, 0.9);
  --panel-strong: rgba(255, 255, 255, 0.95);
  --line:         rgba(0, 0, 0, 0.08);
  --text:         #0b1a24;
  --muted:        #5b7c91;
  --accent:       #00bcd4;
  --accent-2:     #ffb300;
  --danger:       #ff5252;
  --shadow:       0 18px 40px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

html, body {
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Trebuchet MS","Segoe UI",sans-serif;
  display: flex;
  justify-content: center;

  background:
    radial-gradient(ellipse at 20% 0%, rgba(0,180,160,0.08), transparent 40%),
    radial-gradient(ellipse at 85% 15%, rgba(0,150,200,0.06), transparent 35%),
    linear-gradient(180deg, #ffffff 0%, #eef6fb 100%);
}

button, a, select { font: inherit; }

/* 📱 CONTAINER */

.game-page {
  width: min(440px, calc(100% - 16px));
  margin: 0 auto;
  padding: 12px 0 20px;
}

/* HEADER */

.site-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  line-height: 1;
}

/* HEADER ACTIONS */

.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

/* botão */

.header-button {
  min-height: 40px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
}

.header-button.icon-only {
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0,188,212,0.18), rgba(0,150,136,0.14));
  border-color: rgba(0,188,212,0.35);
}

/* MINI STATS (topo) */
.mini-periodic-panel {
  width: min(100%, 900px);
  margin: 18px auto 0;
  padding: 14px;
  border: 1px solid rgba(32, 70, 94, 0.22);
  border-radius: 8px;
  background: #f8fcff;
  box-shadow: 0 10px 28px rgba(10, 31, 46, 0.08);
}

.mini-periodic-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mini-periodic-head h2 {
  margin: 0;
  font-size: 16px;
  color: #17364a;
}

.mini-periodic-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: #5e7b8e;
}

.mini-periodic-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: #486577;
}

.mini-periodic-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mini-periodic-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.legend-radioactive {
  background: #facc15;
}

.legend-found {
  background: #38bdf8;
}

.mini-periodic-grid {
  display: grid;
  grid-template-columns: repeat(18, minmax(24px, 1fr));
  grid-template-rows: repeat(9, 34px);
  gap: 3px;
}

.mini-element {
  position: relative;
  min-width: 0;
  border-radius: 5px;
  border: 1px solid rgba(86, 117, 136, 0.22);
  background: #e8f2f8;
  color: #6b8290;
  opacity: 0.42;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
}

.mini-element .mini-number {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 8px;
  font-weight: 700;
  opacity: 0.72;
}

.mini-element strong {
  font-size: 12px;
}

.mini-element.target {
  opacity: 1;
  border-color: rgba(202, 138, 4, 0.58);
  background: #fef3c7;
  color: #7c4a03;
}

.mini-element.discovered {
  opacity: 1;
  border-color: rgba(14, 116, 144, 0.62);
  background: #cffafe;
  color: #155e75;
  box-shadow: inset 0 0 0 1px rgba(103, 232, 249, 0.45);
}

.mini-element.target.discovered {
  border-color: rgba(234, 179, 8, 0.95);
  background: linear-gradient(135deg, #fde68a, #a5f3fc);
  color: #17364a;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.25);
}

@media (max-width: 720px) {
  .mini-periodic-panel {
    padding: 10px;
  }

  .mini-periodic-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .mini-periodic-grid {
    grid-template-columns: repeat(18, minmax(16px, 1fr));
    grid-template-rows: repeat(9, 28px);
    gap: 2px;
  }

  .mini-element {
    border-radius: 4px;
  }

  .mini-element .mini-number {
    display: none;
  }

  .mini-element strong {
    font-size: 9px;
  }
}

.mini-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.04);
  min-width: 60px;
}

.mini-stats span {
  font-size: 0.60rem;
  color: var(--muted);
}

.mini-stats strong {
  font-size: 0.9rem;
  font-weight: 800;
}

/* LAYOUT */

.game-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* CARDS */

.board-shell,
.panel {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.board-shell {
  padding: 10px;
}

/* HUD (PONTOS CENTRALIZADO) */

.hud-row {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.hud-pill {
  padding: 10px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(
    135deg,
    rgba(0,188,212,0.12),
    rgba(0,150,136,0.08)
  );

  min-width: 140px;
  text-align: center;
}

.hud-pill span {
  font-size: 0.65rem;
  color: var(--muted);
}

.hud-pill strong {
  font-size: 1.2rem;
  font-weight: 800;
}

/* JOGO */

.game-root {
  width: 100%;
  aspect-ratio: 440 / 784;
  max-height: calc(100dvh - 180px);
  margin: 0 auto;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.1);
  background: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(0,0,0,0.03),
    0 0 30px rgba(0,0,0,0.08);
}

.game-root canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* SIDEBAR */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel {
  padding: 12px;
  background: var(--panel-strong);
}

.panel-kicker {
  margin: 0 0 6px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--accent);
}

.panel-copy {
  color: var(--muted);
  margin: 0;
  font-size: 0.82rem;
}

/* NEXT */

.next-preview {
  display: grid;
  place-items: center;
  width: 1em;
  min-height: 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0,188,212,0.10), rgba(0,150,136,0.08));
  border: 1px solid rgba(0,188,212,0.20);
  font-size: 1.8rem;
  font-weight: 900;
}

/* brilho contínuo verde */
.chain-item.special-target {
  position: relative;
}

/* glow atrás do átomo */
.chain-item.special-target::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 14px;
  z-index: 0;

  background: radial-gradient(
    circle,
    rgba(0,255,120,0.35) 0%,
    rgba(0,255,120,0.15) 40%,
    transparent 70%
  );

  animation: brilhoRadioativo 1.6s infinite ease-in-out;
}

/* garante que o conteúdo fique acima */
.chain-item.special-target * {
  position: relative;
  z-index: 1;
}

/* animação pulsante */
@keyframes brilhoRadioativo {
  0% {
    transform: scale(0.9);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(0.9);
    opacity: 0.6;
  }
}


/* CHAIN */

.chain-list {
    display: flex;
    flex-direction: row;
    gap: 4px;
    flex-wrap: wrap;
}

.chain-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
}

.chain-item.reached {
  background: rgba(0,188,212,0.08);
}

.chain-item.active {
  background: rgba(0,188,212,0.18);
}

/* base */
.chain-item {
  display: flex;
  align-items: center;
  justify-content: center;

  padding: 6px;
  border-radius: 12px;
  transition: all 0.25s ease;
}

/* 🔓 já descoberto */
.chain-item.reached {
  background: linear-gradient(
    135deg,
    rgba(0,188,212,0.18),
    rgba(0,150,136,0.12)
  );

  border: 1px solid rgba(0,188,212,0.35);
}

/* 🎯 atual (ativo) */
.chain-item.active {
  background: linear-gradient(
    135deg,
    rgba(0,255,180,0.35),
    rgba(0,200,140,0.25)
  );

  border: 1px solid rgba(0,255,180,0.6);

  transform: scale(1.05);
}

/* 🔒 ainda não descoberto */
.chain-item.locked {
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.08);
}
.chain-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
}

.chain-atom-art {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}


.chain-count {
  margin-left: auto;
  font-size: 0.7rem;
}



/* CONTROLS */

.controls-list {
  padding-left: 14px;
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}