/* Cara o Cruz — moneda 3D con flip CSS, dos caras (sol + cruz griega). */

.coc-page { color: #f5ecd2; }

.coc-header { text-align: center; margin-bottom: 1.4rem; }
.coc-header h1 {
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: #ffd88a;
  text-shadow: 0 0 16px rgba(255,216,138,0.55);
  margin: 0 0 .6rem;
}
.coc-intro {
  max-width: 60ch;
  margin: 0 auto;
  color: rgba(245,236,210,0.85);
  line-height: 1.55;
}

.coc-app {
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* ---------- 3D coin ---------- */
.coc-stage {
  width: 200px;
  height: 200px;
  perspective: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* drop-shadow must live OUTSIDE .coc-coin: putting `filter` on a preserve-3d
     element flattens its 3D context, which would render both faces overlapped
     in the same plane (so the coin never "flips" to the cruz side). */
  filter: drop-shadow(0 18px 28px rgba(0,0,0,0.55));
}

.coc-coin {
  position: relative;
  width: 180px;
  height: 180px;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition: none;
}

.coc-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 32% 28%, #fff5cc 0%, #f5d088 40%, #b88a2a 75%, #5a3a08 100%);
  box-shadow:
    inset 0 -8px 16px rgba(60,30,5,0.45),
    inset 0 6px 14px rgba(255,255,210,0.45),
    0 0 0 3px rgba(90,60,15,0.55);
  color: #5a3a08;
}
.coc-face svg { width: 88%; height: 88%; }
.coc-face--cara { transform: rotateY(0deg); }
.coc-face--cruz { transform: rotateY(180deg); }
/* Slight edge band */
.coc-edge {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.18);
}

/* Idle state: gentle wobble */
.coc-app[data-state="ready"] .coc-coin {
  animation: coc-idle 4s ease-in-out infinite;
}
@keyframes coc-idle {
  0%, 100% { transform: rotateY(-6deg) rotateX(2deg); }
  50%      { transform: rotateY(6deg) rotateX(-2deg); }
}

/* Flipping/revealed state: animation lands on the correct face per data-side.
   Cara → ends at rotateY(2880deg) = 8 full turns = 0° (cara visible).
   Cruz → ends at rotateY(3060deg) = 8.5 turns = 180° (cruz visible). */
.coc-app[data-state="flipping"][data-side="cara"] .coc-coin,
.coc-app[data-state="revealed"][data-side="cara"] .coc-coin {
  animation: coc-flip-cara 1.5s cubic-bezier(.45,.05,.35,1) forwards;
}
.coc-app[data-state="flipping"][data-side="cruz"] .coc-coin,
.coc-app[data-state="revealed"][data-side="cruz"] .coc-coin {
  animation: coc-flip-cruz 1.5s cubic-bezier(.45,.05,.35,1) forwards;
}

@keyframes coc-flip-cara {
  0%   { transform: rotateY(0deg)    translateY(0)    rotateX(0deg); }
  25%  { transform: rotateY(720deg)  translateY(-40px) rotateX(15deg); }
  50%  { transform: rotateY(1440deg) translateY(-60px) rotateX(0deg); }
  75%  { transform: rotateY(2160deg) translateY(-40px) rotateX(-15deg); }
  100% { transform: rotateY(2880deg) translateY(0)    rotateX(0deg); }
}
@keyframes coc-flip-cruz {
  0%   { transform: rotateY(0deg)    translateY(0)    rotateX(0deg); }
  25%  { transform: rotateY(720deg)  translateY(-40px) rotateX(15deg); }
  50%  { transform: rotateY(1440deg) translateY(-60px) rotateX(0deg); }
  75%  { transform: rotateY(2340deg) translateY(-40px) rotateX(-15deg); }
  100% { transform: rotateY(3060deg) translateY(0)    rotateX(0deg); }
}

/* ---------- Controls ---------- */
.coc-controls { width: 100%; }
.coc-form {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  align-items: stretch;
}
.coc-label {
  font-size: .9rem;
  color: rgba(245,236,210,0.75);
  text-align: center;
}
.coc-input {
  width: 100%;
  padding: .8rem 1rem;
  background: rgba(20,12,5,0.55);
  border: 1px solid rgba(255,216,138,0.4);
  border-radius: 10px;
  color: #f5ecd2;
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
}
.coc-input:focus {
  outline: none;
  border-color: rgba(255,216,138,0.85);
  box-shadow: 0 0 0 3px rgba(255,216,138,0.2);
}
.coc-input::placeholder { color: rgba(245,236,210,0.45); }
.coc-flip, .coc-restart {
  align-self: center;
  padding: .7rem 1.8rem;
  font-family: 'Cinzel', 'Times New Roman', serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.coc-app[data-state="flipping"] .coc-flip,
.coc-app[data-state="flipping"] .coc-input { opacity: .55; pointer-events: none; }

/* ---------- Result ---------- */
.coc-result {
  width: 100%;
  text-align: center;
  background: linear-gradient(160deg, rgba(60,40,12,0.55), rgba(20,12,4,0.4));
  border: 1px solid rgba(255,216,138,0.4);
  border-radius: 16px;
  padding: 1.4rem 1.2rem 1rem;
  box-shadow: 0 14px 28px rgba(0,0,0,0.45);
  animation: coc-reveal .55s ease-out;
}
@keyframes coc-reveal {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.coc-result-question {
  font-style: italic;
  color: rgba(245,236,210,0.7);
  margin: 0 0 1rem;
}
.coc-result-question:empty { display: none; }

.coc-verdict {
  display: inline-block;
  padding: .55rem 1.6rem;
  border-radius: 999px;
  font-family: 'Cinzel', 'Times New Roman', serif;
  font-size: 1.5rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  background: linear-gradient(160deg, #b88a2a, #5a3a08);
  color: #fff5cc;
  border: 1px solid rgba(255,216,138,0.55);
  box-shadow: 0 0 22px rgba(255,216,138,0.5);
  margin-bottom: .9rem;
}

.coc-result-short {
  color: #ffd88a;
  font-style: italic;
  margin: 0 0 .8rem;
  font-size: 1.05rem;
}
.coc-result-interpretation {
  color: #f5ecd2;
  line-height: 1.6;
  margin: 0 0 1.2rem;
  max-width: 50ch;
  margin-left: auto;
  margin-right: auto;
}

.coc-error {
  color: #ff9999;
  text-align: center;
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  .coc-app[data-state="ready"]    .coc-coin,
  .coc-app[data-state="flipping"] .coc-coin,
  .coc-app[data-state="revealed"] .coc-coin { animation: none; }
  .coc-app[data-side="cara"] .coc-coin { transform: rotateY(0deg); }
  .coc-app[data-side="cruz"] .coc-coin { transform: rotateY(180deg); }
  .coc-result { animation: none; }
}
