/* Cufărul Cuibului — stil. Culorile sunt la începutul regulii .cc-chest */
.cc-chest {
  /* Paleta CuibulCuJocuri */
  --cc-gold: #F2B321;     /* galben: titlu, butoane, capetele liniilor */
  --cc-plum: #4A2754;     /* mov: fundalul cardului, textul de pe butonul galben */
  --cc-mauve: #71477C;    /* mov deschis: linii, contur card, etichetă, buline */
  --cc-shade: #4B2E52;    /* mov umbră */
  --cc-text: #FFFFFF;
  --cc-muted: #E6DAEA;
  --cc-font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  margin: 40px 0;
  padding: 0;
  background: transparent;
  color: var(--cc-text);
  font-family: var(--cc-font);
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cc-chest *, .cc-chest *::before, .cc-chest *::after { box-sizing: border-box; }
.cc-chest p, .cc-chest h2, .cc-chest h3 { margin: 0; padding: 0; border: 0; }

/* --- liniile de sus și de jos: mov spre margini, galben spre mijloc (simetric) --- */
.cc-chest .cc-rule { width: 100%; display: flex; align-items: center; }
.cc-chest .cc-line { flex: 1 1 auto; height: 2px; border-radius: 1px; background: var(--cc-mauve); }
.cc-chest .cc-line--l { background: linear-gradient(to right, var(--cc-mauve) 0%, var(--cc-mauve) 35%, var(--cc-gold) 100%); }
.cc-chest .cc-line--r { background: linear-gradient(to left, var(--cc-mauve) 0%, var(--cc-mauve) 35%, var(--cc-gold) 100%); }
.cc-chest .cc-gem { flex: none; width: 7px; height: 7px; margin: 0 12px; border-radius: 1px; background: var(--cc-gold); transform: rotate(45deg); }
.cc-chest .cc-foot { margin-top: 28px; }
.cc-chest .cc-gg { flex: none; padding: 0 14px; font-size: 15px; font-weight: 700; line-height: 1.2; color: var(--cc-gold); }

/* --- titlu și subtitlu --- */
.cc-chest .cc-title {
  margin-top: 24px;
  font-family: var(--cc-font); font-size: 32px; font-weight: 700; font-style: normal;
  line-height: 1.1; letter-spacing: -0.02em; text-transform: none; text-shadow: none;
  color: var(--cc-gold);
}
.cc-chest .cc-sub { margin-top: 8px; font-size: 15px; line-height: 1.5; color: var(--cc-text); }

/* --- scena: buline, cufăr, buton --- */
.cc-chest .cc-scene {
  position: relative; width: min(500px, 100%);
  display: flex; flex-direction: column; align-items: center;
}
.cc-chest .cc-dots {
  position: absolute; z-index: 0; left: 6%; right: 6%; top: 12px; bottom: 0;
  border-radius: 50%; pointer-events: none;
  background-image: radial-gradient(circle, var(--cc-mauve) 2.3px, transparent 2.9px);
  background-size: 13px 13px;
  -webkit-mask: radial-gradient(closest-side, #000 40%, transparent 100%);
          mask: radial-gradient(closest-side, #000 40%, transparent 100%);
}
.cc-chest.cc-chest .cc-chestbtn {
  -webkit-appearance: none !important; appearance: none !important;
  position: relative; z-index: 1; display: block;
  width: 100% !important; height: auto !important; aspect-ratio: 2 / 1;
  margin: 12px 0 0 !important; padding: 0 !important;
  border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important;
  cursor: pointer; transition: transform .15s ease;
}
.cc-chest[data-state="idle"] .cc-chestbtn:hover { transform: translateY(-3px); }
.cc-chest:not([data-state="idle"]) .cc-chestbtn { cursor: default; }
.cc-chest .cc-chestbtn:focus-visible { outline: 2px solid var(--cc-gold); outline-offset: 4px; border-radius: 8px !important; }
.cc-chest .cc-glow {
  position: absolute; left: 23%; top: 5%; width: 54%; aspect-ratio: 1;
  border-radius: 50%; pointer-events: none; opacity: 0; transform: scale(.6);
  background: radial-gradient(closest-side, rgba(242, 179, 33, .5), rgba(242, 179, 33, 0));
}
.cc-chest .cc-svg { position: relative; display: block; width: 100%; height: auto; overflow: visible; }
.cc-chest .cc-svg .ln { fill: none; stroke: #000000; stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; }
.cc-chest .cc-svg .ln3 { stroke-width: 3; }
.cc-chest .cc-svg .ray { stroke: var(--cc-gold); stroke-width: 4; stroke-linecap: round; opacity: .35; }
.cc-chest .cc-rays { opacity: 0; transform-box: view-box; transform-origin: 300px 176px; }
.cc-chest .cc-sparks rect { fill: var(--cc-gold); opacity: .7; animation: cc-twinkle 2.6s ease-in-out infinite; }
.cc-chest .cc-sparks rect:nth-child(2n) { animation-delay: .8s; }
.cc-chest .cc-sparks rect:nth-child(3n) { animation-delay: 1.6s; }
.cc-chest .cc-ground { fill: #000000; opacity: .35; transform-box: fill-box; transform-origin: 50% 50%; animation: cc-ground 2.6s ease-in-out infinite; }
.cc-chest .cc-body { transform-box: fill-box; transform-origin: 50% 100%; animation: cc-float 2.6s ease-in-out infinite; }
.cc-chest .cc-lid { transform-box: fill-box; transform-origin: 50% 100%; }
.cc-chest .cc-lock { transform-box: fill-box; transform-origin: 50% 0; }
.cc-chest .cc-inside { opacity: 0; }
.cc-chest .cc-particles { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.cc-chest .cc-particle {
  position: absolute; left: 50%; top: 40%;
  width: var(--s); height: var(--s); background: var(--c); border-radius: 1px;
  animation: cc-fly 1.1s cubic-bezier(.12, .7, .3, 1) var(--d) forwards;
}
.cc-chest .cc-ic { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* --- butoane (cu !important, ca tema să nu le poată suprascrie) --- */
.cc-chest.cc-chest .cc-btn.cc-btn {
  -webkit-appearance: none !important; appearance: none !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 10px !important;
  width: auto !important; height: auto !important; min-height: 42px !important;
  margin: 0 !important; padding: 0 16px !important;
  font-family: var(--cc-font) !important; font-style: normal !important; font-weight: 700 !important;
  font-size: 14px !important; line-height: 1 !important; letter-spacing: 0 !important;
  text-align: center !important; text-transform: none !important; text-decoration: none !important; text-shadow: none !important;
  border: 0 !important; border-radius: 4px !important; box-shadow: none !important;
  opacity: 1 !important; filter: none !important; pointer-events: auto !important; cursor: pointer !important;
  transition: transform .12s ease !important;
}
.cc-chest.cc-chest .cc-btn.cc-btn--primary,
.cc-chest.cc-chest .cc-btn.cc-btn--primary:visited,
.cc-chest.cc-chest .cc-btn.cc-btn--primary:hover,
.cc-chest.cc-chest .cc-btn.cc-btn--primary:focus,
.cc-chest.cc-chest .cc-btn.cc-btn--primary:active {
  background: var(--cc-gold) !important; color: var(--cc-plum) !important;
}
.cc-chest.cc-chest .cc-btn.cc-btn--ghost,
.cc-chest.cc-chest .cc-btn.cc-btn--ghost:hover,
.cc-chest.cc-chest .cc-btn.cc-btn--ghost:focus,
.cc-chest.cc-chest .cc-btn.cc-btn--ghost:active {
  background: transparent !important; color: var(--cc-gold) !important; border: 1px solid var(--cc-gold) !important;
}
.cc-chest.cc-chest .cc-btn.cc-btn:hover { transform: translateY(-1px); }
.cc-chest.cc-chest .cc-btn.cc-btn:active { transform: translateY(1px); }
.cc-chest.cc-chest .cc-btn.cc-btn:focus-visible { outline: 2px solid #FFFFFF !important; outline-offset: 3px !important; }
.cc-chest.cc-chest .cc-btn.cc-open {
  position: relative; z-index: 1;
  margin-top: 8px !important; padding: 0 24px !important; font-size: 15px !important;
}

/* --- cardul cu recomandarea --- */
.cc-chest .cc-card {
  display: none;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 24px; align-items: center;
  width: 100%; margin: 22px 0 0; padding: 14px; text-align: left;
  background: var(--cc-plum); border: 1px solid var(--cc-mauve); border-radius: 4px;
}
.cc-chest .cc-card__media {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 2px; background: var(--cc-mauve);
}
.cc-chest .cc-card__media img {
  display: block; width: 100%; height: 100%; max-width: none; object-fit: cover;
  transition: transform .4s ease;
}
.cc-chest .cc-card__media:hover img { transform: scale(1.03); }
.cc-chest .cc-card__placeholder { position: absolute; inset: 0; display: none; place-items: center; color: var(--cc-gold); }
.cc-chest .cc-card__media.is-empty img { display: none; }
.cc-chest .cc-card__media.is-empty .cc-card__placeholder { display: grid; }
.cc-chest .cc-card__body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.cc-chest .cc-badge {
  display: inline-block; padding: 3px 7px; border-radius: 2px;
  background: var(--cc-mauve); color: #FFFFFF;
  font-size: 10px; font-weight: 700; line-height: 1.2; letter-spacing: .08em; text-transform: uppercase;
}
.cc-chest .cc-card__title {
  margin-top: 10px; color: var(--cc-text);
  font-family: var(--cc-font); font-size: 19px; font-weight: 700; line-height: 1.3; text-transform: none;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.cc-chest .cc-card__title:focus { outline: none; }
.cc-chest .cc-card__text {
  margin-top: 8px; color: var(--cc-muted); font-size: 14px; line-height: 1.55;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.cc-chest .cc-card__text:empty { display: none; }
.cc-chest .cc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
/* cele două butoane din card au aceeași lățime */
.cc-chest.cc-chest .cc-actions .cc-btn.cc-btn { width: 180px !important; }

.cc-chest .cc-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --- stări --- */
.cc-chest:not([data-state="idle"]) .cc-btn.cc-open { visibility: hidden !important; }
.cc-chest[data-state="result"] .cc-scene { display: none !important; }
.cc-chest[data-state="result"] .cc-card { display: grid !important; animation: cc-card-in .4s ease-out both; }

.cc-chest[data-state="opening"] .cc-body { animation: cc-shake .32s linear, cc-pop .5s .32s ease-out forwards; }
.cc-chest[data-state="opening"] .cc-ground { animation: none; }
.cc-chest[data-state="opening"] .cc-lid { animation: cc-lid .45s .32s cubic-bezier(.2, 1.5, .4, 1) forwards; }
.cc-chest[data-state="opening"] .cc-lock { animation: cc-lock .35s .28s ease-out forwards; }
.cc-chest[data-state="opening"] .cc-inside { animation: cc-on .15s .36s forwards; }
.cc-chest[data-state="opening"] .cc-rays { animation: cc-rays .5s .36s ease-out forwards; }
.cc-chest[data-state="opening"] .cc-glow { animation: cc-glow .6s .34s ease-out forwards; }
.cc-chest[data-state="opening"] .cc-dots,
.cc-chest[data-state="opening"] .cc-sparks { animation: cc-off .4s .3s ease-out forwards; }
.cc-chest.is-revealing .cc-scene { opacity: 0; transition: opacity .3s ease; }

@keyframes cc-float { 50% { transform: translateY(-6px); } }
@keyframes cc-ground { 50% { transform: scale(.88); opacity: .25; } }
@keyframes cc-twinkle { 50% { opacity: .25; } }
@keyframes cc-shake {
  0%, 100% { transform: none; }
  25% { transform: translateX(-2px) rotate(-1.5deg); }
  50% { transform: translateX(2px) rotate(1.5deg); }
  75% { transform: translateX(-1px) rotate(-1deg); }
}
@keyframes cc-pop { 40% { transform: translateY(-6px) scale(1.04); } 100% { transform: translateY(-2px) scale(1.02); } }
@keyframes cc-lid { to { transform: translateY(-36px) rotate(-7deg) scaleY(.82); } }
@keyframes cc-lock { 40% { transform: rotate(-10deg); } 100% { transform: translateY(5px) rotate(-4deg); } }
@keyframes cc-on { to { opacity: 1; } }
@keyframes cc-off { to { opacity: 0; } }
@keyframes cc-rays { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
@keyframes cc-glow { to { opacity: 1; transform: scale(1); } }
@keyframes cc-fly {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(45deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--r)) scale(.6); }
}
@keyframes cc-card-in { from { opacity: 0; transform: translateY(10px); } }

/* --- telefon --- */
@media (max-width: 580px) {
  .cc-chest .cc-title { margin-top: 20px; font-size: 26px; }
  .cc-chest .cc-sub { margin-top: 6px; font-size: 14px; }
  .cc-chest .cc-scene { width: min(350px, 100%); }
  .cc-chest.cc-chest .cc-chestbtn { margin-top: 10px !important; }
  .cc-chest .cc-dots { top: 10px; background-image: radial-gradient(circle, var(--cc-mauve) 2px, transparent 2.6px); background-size: 11px 11px; }
  .cc-chest.cc-chest .cc-btn.cc-open { min-height: 44px !important; }
  .cc-chest .cc-card { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 18px; padding: 12px; }
  .cc-chest .cc-card__title { font-size: 18px; }
  .cc-chest .cc-actions { width: 100%; flex-direction: column; align-items: center; gap: 8px; }
  .cc-chest.cc-chest .cc-actions .cc-btn.cc-btn { display: flex !important; width: 168px !important; min-height: 44px !important; }
  .cc-chest .cc-foot { margin-top: 24px; }
  .cc-chest .cc-gg { padding: 0 12px; font-size: 14px; }
}

/* --- fără animații pentru cine le-a oprit din sistem --- */
@media (prefers-reduced-motion: reduce) {
  .cc-chest .cc-body, .cc-chest .cc-ground, .cc-chest .cc-sparks rect { animation: none !important; }
  .cc-chest[data-state="opening"] .cc-lid,
  .cc-chest[data-state="opening"] .cc-lock,
  .cc-chest[data-state="opening"] .cc-inside,
  .cc-chest[data-state="opening"] .cc-rays,
  .cc-chest[data-state="opening"] .cc-glow,
  .cc-chest[data-state="opening"] .cc-dots,
  .cc-chest[data-state="opening"] .cc-sparks,
  .cc-chest[data-state="result"] .cc-card { animation-duration: .01ms !important; animation-delay: 0s !important; }
}

/* --- previzualizarea din editor: arată exact ca pe site, dar nu se apasă ---
   Fundalul e cel al site-ului, ca textul alb să se vadă și pe editorul alb. */
.cc-chest[data-cc-preview] { margin: 0; padding: 24px 20px 20px; background: #321e37; border-radius: 4px; pointer-events: none; }
.cc-chest[data-cc-preview] :focus, .cc-chest[data-cc-preview] :focus-visible { outline: none !important; }
