/*
 * Natal Infantil CIOP
 * Conceito: noite de Natal num pinheiral. Fundo verde-pinho profundo, enfeites de vidro
 * pendurados por fios, varal de luzes como barra de progresso, dourado só no que importa.
 * Visual único (escuro) de propósito: funciona igual em qualquer tema do sistema.
 */

:root {
  color-scheme: dark;

  /* cor */
  --pine-950: #071c17;
  --pine-900: #0b2a22;
  --pine-800: #113a2f;
  --pine-700: #1a4d3f;
  --snow: #f3f7f2;
  --snow-dim: #b9cbc2;
  --snow-faint: #7f998d;
  --gold: #f5c451;
  --gold-deep: #c8912a;
  --berry: #e2475a;
  --berry-deep: #9d1f33;
  --holly: #5fbf86;
  --frost: #8fc7e8;
  --line: rgba(243, 247, 242, 0.14);
  --glass: rgba(243, 247, 242, 0.06);

  /* tipo */
  --font-display: 'Fraunces', 'Georgia', 'Times New Roman', serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --step--1: 0.85rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.6rem;
  --step-3: clamp(2.1rem, 5.5vw, 3.4rem);
  --step-4: clamp(2.6rem, 8vw, 5rem);

  /* forma */
  --radius: 18px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --dock-h: 0px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--pine-950);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--snow);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(245, 196, 81, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(95, 191, 134, 0.10), transparent 60%),
    linear-gradient(180deg, var(--pine-900), var(--pine-950) 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.snow,
.burst {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.snow { z-index: 0; }
.burst { z-index: 60; }

.page {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  padding-block: max(12px, env(safe-area-inset-top, 0px)) 48px;
}

body[data-view='quiz'] .page {
  padding-bottom: calc(var(--dock-space, 260px) + env(safe-area-inset-bottom, 0px));
}

/* ---------- tipografia ---------- */

.eyebrow {
  margin: 0 0 8px;
  font-size: var(--step--1);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.display {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-weight: 800;
  font-variation-settings: 'SOFT' 100, 'opsz' 144;
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.display__accent {
  color: var(--gold);
  font-style: italic;
}

.title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 700;
  font-variation-settings: 'SOFT' 100;
  line-height: 1.05;
  text-wrap: balance;
}

.lead {
  max-width: 34em;
  margin: 18px 0 0;
  font-size: var(--step-1);
  color: var(--snow-dim);
}

.lead--small {
  font-size: var(--step-0);
  margin-top: 8px;
}

.fineprint {
  margin: 0;
  font-size: var(--step--1);
  color: var(--snow-faint);
}

.fineprint--center {
  text-align: center;
}

/* ---------- topo ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 10px 28px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand__mark {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
}

.brand__sub {
  font-size: var(--step--1);
  color: var(--snow-dim);
}

.topbar__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.topbar__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--snow);
  font: 700 var(--step-0) var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.topbar__link svg {
  width: 16px;
  height: 16px;
  fill: var(--gold);
}

.topbar__link:hover {
  border-color: var(--gold);
  background: var(--glass);
}

/* ---------- botões e campos ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  font: 800 var(--step-0) / 1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s;
}

.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: progress; }

.btn--primary {
  color: #2a1a00;
  background: linear-gradient(180deg, #ffd978, var(--gold) 55%, var(--gold-deep));
  box-shadow: 0 6px 22px -8px rgba(245, 196, 81, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn--primary:hover { box-shadow: 0 10px 28px -8px rgba(245, 196, 81, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.6); }

.btn--ghost {
  color: var(--snow);
  background: transparent;
  border: 1px solid var(--line);
}

.btn--ghost:hover { border-color: var(--snow-dim); background: var(--glass); }
.btn--block { width: 100%; }

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--snow);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.card {
  position: relative;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(26, 77, 63, 0.75), rgba(11, 42, 34, 0.85));
  backdrop-filter: blur(6px);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}

.card__title {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 700;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field__label {
  font-size: var(--step--1);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--snow-dim);
}

.field input {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 28, 23, 0.6);
  color: var(--snow);
  font: 600 var(--step-1) var(--font-body);
}

.field input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 196, 81, 0.25);
}

.form-error {
  min-height: 1.4em;
  margin: 0 0 10px;
  color: #ff9aa6;
  font-weight: 700;
}

/* ---------- 1. identificação ---------- */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: center;
  padding-block: 12px 24px;
}

.intro__copy { min-width: 0; }

.steps {
  display: grid;
  gap: 10px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding-left: 46px;
  color: var(--snow-dim);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--line);
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--gold);
}

.steps strong { color: var(--snow); }

.intro__form {
  padding-top: 64px;
  overflow: visible;
}

.intro__form .fineprint { margin-top: 14px; }

.hanging {
  position: absolute;
  top: -18px;
  right: 28px;
  display: flex;
  gap: 14px;
}

.hanging__item {
  position: relative;
  width: 34px;
  height: 34px;
  margin-top: var(--drop, 30px);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.85) 0 7%, transparent 26%), var(--tone);
  box-shadow: inset -6px -8px 14px rgba(0, 0, 0, 0.35);
  animation: sway 4s ease-in-out infinite;
  transform-origin: 50% calc(-1 * var(--drop, 30px));
}

.hanging__item::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1px;
  height: var(--drop, 30px);
  background: var(--snow-faint);
}

.hanging__item:nth-child(2) { --drop: 50px; animation-delay: -1.2s; }
.hanging__item:nth-child(3) { --drop: 22px; animation-delay: -2.4s; }

/* tons dos enfeites */
[data-tone='berry'] { --tone: radial-gradient(circle at 40% 35%, #ff7a88, var(--berry) 45%, var(--berry-deep)); --tone-solid: var(--berry); }
[data-tone='gold'] { --tone: radial-gradient(circle at 40% 35%, #ffe7a3, var(--gold) 45%, var(--gold-deep)); --tone-solid: var(--gold); }
[data-tone='pine'] { --tone: radial-gradient(circle at 40% 35%, #8fe0ad, var(--holly) 45%, #2a7a4d); --tone-solid: var(--holly); }
[data-tone='frost'] { --tone: radial-gradient(circle at 40% 35%, #d6eeff, var(--frost) 45%, #3f7fa8); --tone-solid: var(--frost); }

/* ---------- 2. questionário ---------- */

.quiz__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
}

.quiz__head > div { min-width: 0; }

.quiz__stats {
  display: flex;
  gap: 10px;
  margin: 0;
}

.quiz__stats > div {
  min-width: 112px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass);
}

.quiz__stats dt {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--snow-faint);
}

.quiz__stats dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.garland {
  position: relative;
  height: 64px;
  margin: 18px 0 8px;
}

.garland__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.garland__wire {
  fill: none;
  stroke: #3d5c50;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.bulb {
  position: absolute;
  width: 12px;
  height: 18px;
  margin: 1px 0 0 -6px;
  border-radius: 45% 45% 50% 50% / 35% 35% 65% 65%;
  background: #2a4239;
  border-top: 4px solid #6b7f77;
  transition: background 0.3s, box-shadow 0.3s;
}

.bulb.is-lit {
  background: var(--bulb);
  box-shadow: 0 0 10px 2px var(--bulb), 0 0 26px 6px color-mix(in srgb, var(--bulb) 45%, transparent);
  animation: twinkle 2.4s ease-in-out infinite;
  animation-delay: var(--twinkle-delay, 0s);
}

.bulb--berry { --bulb: var(--berry); }
.bulb--gold { --bulb: var(--gold); }
.bulb--pine { --bulb: var(--holly); }
.bulb--frost { --bulb: var(--frost); }

.board {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 26px 14px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.slot {
  display: flex;
  justify-content: center;
  min-width: 0;
}

/* enfeite */
.ornament {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 132px;
  padding: 26px 4px 4px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ornament::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 26px;
  background: linear-gradient(var(--snow-faint), rgba(185, 203, 194, 0.3));
}

.ornament__cap {
  position: absolute;
  top: 20px;
  left: 50%;
  z-index: 1;
  width: 22px;
  height: 11px;
  margin-left: -11px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(90deg, #8a6a2a, #e9c46a 45%, #8a6a2a);
}

.ornament__ball {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 96px);
  aspect-ratio: 1;
  max-width: 100%;
  border-radius: 50%;
  background: var(--tone);
  box-shadow:
    inset -10px -14px 22px rgba(0, 0, 0, 0.35),
    inset 6px 8px 14px rgba(255, 255, 255, 0.18),
    0 12px 24px -12px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(.3, 1.6, .5, 1), box-shadow 0.25s, filter 0.3s;
}

.ornament__ball::after {
  content: '';
  position: absolute;
  top: 14%;
  left: 20%;
  width: 26%;
  height: 16%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transform: rotate(-30deg);
  filter: blur(1px);
}

.ornament__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ornament__num {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  font-weight: 900;
  font-variation-settings: 'SOFT' 100;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.ornament__photo ~ .ornament__num {
  position: absolute;
  bottom: 6%;
  font-size: 1.05rem;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(7, 28, 23, 0.75);
}

.ornament__tag {
  max-width: 100%;
  padding: 5px 12px;
  border: 1.5px dashed var(--line);
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--snow-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.2s;
}

.ornament.is-filled .ornament__tag {
  border: 1.5px solid transparent;
  background: var(--snow);
  color: var(--pine-900);
  font-weight: 800;
}

.ornament:hover .ornament__ball,
.ornament:focus-visible .ornament__ball {
  transform: rotate(-6deg) scale(1.05);
}

.ornament:focus-visible { outline: none; }
.ornament:focus-visible .ornament__tag { outline: 3px solid var(--gold); outline-offset: 2px; }

.ornament.is-filled .ornament__ball {
  box-shadow:
    inset -10px -14px 22px rgba(0, 0, 0, 0.3),
    inset 6px 8px 14px rgba(255, 255, 255, 0.2),
    0 0 28px -4px var(--tone-solid);
}

.ornament.is-drop-target .ornament__ball {
  transform: scale(1.14);
  box-shadow: 0 0 0 4px var(--gold), 0 0 36px var(--gold);
}

.ornament.is-placed .ornament__ball { animation: placed 0.6s cubic-bezier(.3, 1.6, .5, 1); }

.board.is-armed .ornament__ball { animation: wobble 1.6s ease-in-out infinite; }
.board.is-armed .slot:nth-child(2n) .ornament__ball { animation-delay: -0.8s; }
.board.is-armed .ornament__tag { border-color: var(--gold); color: var(--gold); }
.board.is-armed .ornament.is-filled .ornament__tag { color: var(--pine-900); }

/* barra de nomes */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: none;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--line);
  background: rgba(7, 28, 23, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body[data-view='quiz'] .dock { display: block; }

.dock__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    'hint hint'
    'tray actions';
  gap: 10px 20px;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding-block: 12px 14px;
}

.dock__hint {
  grid-area: hint;
  margin: 0;
  font-size: var(--step--1);
  color: var(--snow-dim);
  transition: color 0.2s;
}

.dock__hint.is-armed {
  color: var(--gold);
  font-weight: 800;
}

.tray {
  grid-area: tray;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.dock__actions {
  grid-area: actions;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.dock__status {
  max-width: 220px;
  margin: 0;
  font-size: var(--step--1);
  color: #ffc8cf;
  text-align: right;
}

.dock__status:empty { display: none; }

[data-submit]:not(.is-ready) {
  filter: saturate(0.6);
}

[data-submit].is-ready {
  animation: glow 1.8s ease-in-out infinite;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--pine-800);
  color: var(--snow);
  font: 700 0.92rem var(--font-body);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, opacity 0.2s;
}

.chip:hover { border-color: var(--snow-dim); transform: translateY(-1px); }

.chip.is-used {
  background: transparent;
  color: var(--snow-dim);
}

.chip__count {
  font-size: 0.78rem;
  color: var(--holly);
}

.chip__count:empty { display: none; }

.chip.is-armed {
  border-color: var(--gold);
  background: var(--gold);
  color: #2a1a00;
  box-shadow: 0 0 18px -2px rgba(245, 196, 81, 0.8);
}

.chip.is-armed .chip__count { color: #2a1a00; }

.chip--ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  pointer-events: none;
  background: var(--gold);
  color: #2a1a00;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.5);
}

body.is-dragging,
body.is-dragging * { cursor: grabbing !important; }

/* folha de seleção / confirmação */
.sheet {
  width: min(560px, calc(100vw - 32px));
  max-height: min(80vh, 640px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--pine-800);
  color: var(--snow);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
}

.sheet[open] { animation: rise 0.28s cubic-bezier(.2, 1.2, .4, 1); }

.sheet::backdrop {
  background: rgba(3, 12, 10, 0.65);
  backdrop-filter: blur(3px);
}

.sheet--small { width: min(440px, calc(100vw - 32px)); }

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.sheet__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 700;
}

.sheet--small p { color: var(--snow-dim); }

.sheet__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.pick {
  min-height: 46px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--pine-900);
  color: var(--snow);
  font: 700 0.95rem var(--font-body);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.pick:hover { border-color: var(--gold); }

.pick.is-selected {
  background: var(--gold);
  border-color: var(--gold);
  color: #2a1a00;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 28px 0 12px;
}

.actions--end {
  justify-content: flex-end;
  margin: 18px 0 0;
}

.share__qr {
  display: grid;
  place-items: center;
  margin: 8px auto 16px;
  padding: 14px;
  width: fit-content;
  border-radius: 16px;
  background: #ffffff;
}

.share__qr img {
  display: block;
  width: min(240px, 60vw);
  height: auto;
  aspect-ratio: 1;
}

.share__link {
  display: flex;
  gap: 8px;
}

.share__link input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--pine-900);
  color: var(--snow);
  font: 600 0.95rem var(--font-body);
}

.share__feedback {
  min-height: 1.4em;
  margin: 8px 0;
  color: var(--holly);
  font-weight: 700;
}

/* ---------- 3. resultado ---------- */

.result__hero {
  display: grid;
  justify-items: center;
  text-align: center;
  padding-block: 8px 12px;
}

.score {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-variation-settings: 'SOFT' 100, 'opsz' 144;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.score__value {
  font-size: clamp(5rem, 18vw, 9rem);
  color: var(--gold);
  text-shadow: 0 0 40px rgba(245, 196, 81, 0.35);
}

.score__total {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  color: var(--snow-dim);
}

.score__label {
  margin: 4px 0 0;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--snow-dim);
}

.result__caption {
  margin: 14px 0 0;
  font-size: var(--step-1);
  font-weight: 700;
}

.result__meta {
  margin: 4px 0 0;
  color: var(--snow-faint);
}

.greeting {
  position: relative;
  margin: 36px auto 30px;
  padding: 26px 20px;
  max-width: 820px;
  border-block: 1px solid rgba(245, 196, 81, 0.35);
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 600;
  font-variation-settings: 'SOFT' 100;
  line-height: 1.1;
  text-align: center;
  text-wrap: balance;
}

.greeting em {
  display: block;
  font-size: 1.35em;
  font-weight: 900;
  color: var(--gold);
  animation: shimmer 4s ease-in-out infinite;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 8px;
  font-size: var(--step--1);
  font-weight: 700;
  color: var(--snow-dim);
}

.legend__item::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: -1px;
}

.legend__item--ok::before { background: var(--holly); }
.legend__item--miss::before { background: var(--berry); }

.board--result .ornament { cursor: default; }

.slot--reveal {
  animation: drop-in 0.6s cubic-bezier(.3, 1.4, .5, 1) backwards;
  animation-delay: var(--delay, 0ms);
}

.ornament__mark {
  position: absolute;
  right: 4%;
  bottom: 4%;
  display: none;
  width: 30%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--pine-900);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 60%;
}

.is-correct .ornament__mark,
.is-wrong .ornament__mark { display: block; }

.is-correct .ornament__mark {
  background-color: var(--holly);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.5l5 5L20 6.5' fill='none' stroke='%23071c17' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.is-wrong .ornament__mark {
  background-color: var(--berry);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' fill='none' stroke='%23fff' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.ornament.is-correct .ornament__ball {
  box-shadow: 0 0 0 3px var(--holly), 0 0 30px -2px var(--holly), inset -10px -14px 22px rgba(0, 0, 0, 0.3);
}

.ornament.is-correct .ornament__tag {
  border: 1.5px solid transparent;
  background: var(--holly);
  color: var(--pine-950);
}

.ornament.is-wrong .ornament__ball { filter: saturate(0.25) brightness(0.7); }

.ornament.is-wrong .ornament__tag {
  border-style: solid;
  background: transparent;
  color: #ffb3bd;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.ornament__answer {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--snow-dim);
}

/* ---------- 4. ranking ---------- */

.ranking__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.ranking__head > div { min-width: 0; }

.ranking__status {
  margin: 0 0 20px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--snow-dim);
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.podium:empty { display: none; }

.podium__card {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  padding: 22px 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 8px 8px;
  background: linear-gradient(180deg, var(--medal-glow), rgba(11, 42, 34, 0.9) 70%);
  text-align: center;
  animation: drop-in 0.6s cubic-bezier(.3, 1.4, .5, 1) backwards;
}

.podium__card--ouro { --medal: var(--gold); --medal-glow: rgba(245, 196, 81, 0.28); order: 2; padding-top: 34px; }
.podium__card--prata { --medal: #d9e2e8; --medal-glow: rgba(217, 226, 232, 0.16); order: 1; animation-delay: 0.15s; }
.podium__card--bronze { --medal: #e0965a; --medal-glow: rgba(224, 150, 90, 0.18); order: 3; animation-delay: 0.3s; }

.podium__place {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 900;
  color: var(--medal);
}

.podium__star {
  width: 30px;
  height: 30px;
  background: var(--medal);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.podium__name {
  max-width: 100%;
  font-weight: 800;
  font-size: var(--step-1);
  overflow-wrap: anywhere;
}

.podium__score { color: var(--snow-dim); }
.podium__score strong { color: var(--snow); font-size: var(--step-1); }

.podium__time {
  font-size: var(--step--1);
  color: var(--snow-faint);
  font-variant-numeric: tabular-nums;
}

.rank-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--glass);
  font-variant-numeric: tabular-nums;
}

.rank-row__pos { font-family: var(--font-display); font-weight: 800; color: var(--snow-dim); }
.rank-row__name { font-weight: 700; overflow-wrap: anywhere; }
.rank-row__score { font-weight: 800; }
.rank-row__time { color: var(--snow-faint); font-size: var(--step--1); min-width: 64px; text-align: right; }

.is-mine {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

/* ---------- animações ---------- */

@keyframes sway { 50% { transform: rotate(6deg); } }
@keyframes wobble { 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
@keyframes placed { 0% { transform: scale(0.8); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes twinkle { 50% { filter: brightness(1.35); } }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(245, 196, 81, 0.18), 0 10px 30px -6px rgba(245, 196, 81, 0.9); } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes drop-in { from { transform: translateY(-28px) scale(0.85); opacity: 0; } }
@keyframes shimmer { 50% { text-shadow: 0 0 24px rgba(245, 196, 81, 0.55); } }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- responsivo ---------- */

@media (max-width: 960px) {
  .intro { grid-template-columns: minmax(0, 1fr); }
  .board { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .brand__sub { display: none; }
  .topbar__link { padding: 8px 12px; }
  .share__link { flex-direction: column; }

  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 10px; }

  .dock__inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'hint' 'tray' 'actions';
    gap: 8px;
  }

  .tray {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: -4px;
    padding: 2px 4px 4px;
    mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 24px), transparent);
  }

  .tray::-webkit-scrollbar { display: none; }
  .chip { flex: none; }

  .dock__actions { align-items: stretch; }
  .dock__actions .btn { width: 100%; }
  .dock__status { max-width: none; text-align: left; }

  .quiz__stats { width: 100%; }
  .quiz__stats > div { flex: 1; }

  .sheet__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .podium { grid-template-columns: minmax(0, 1fr); }
  .podium__card { order: 0 !important; border-radius: var(--radius); }

  .rank-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .rank-row__time { display: none; }

  .card { padding: 22px; }
  .intro__form { padding-top: 56px; }
}
