:root {
  --bg: #e8f5fb;
  --panel: #ffffff;
  --text: #113b63;
  --accent: #00a6d6;
  --myth: #f76e2c;
  --reality: #1ca8d8;
  --ok: #31b56b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 15%, #f5fcff 0%, transparent 35%),
    radial-gradient(circle at 80% 80%, #d4eef8 0%, transparent 36%),
    linear-gradient(135deg, #eaf7fd, #d8eef9);
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.app {
  width: min(960px, 100%);
  background: var(--panel);
  border-radius: 24px;
  box-shadow: 0 16px 35px rgba(6, 58, 104, 0.2);
  overflow: hidden;
}

.hero {
  padding: 1.6rem 1.4rem 0.4rem;
  text-align: center;
  background: linear-gradient(180deg, #f0fbff 10%, #fff 100%);
}

.hero img {
  width: min(400px, 100%);
  height: auto;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.2rem, 4vw, 2rem);
  font-weight: 800;
}

.hero h1 span {
  color: var(--accent);
}

.hero p {
  margin: 0.5rem auto 0;
  max-width: 70ch;
  line-height: 1.4;
}

.wheel-panel {
  padding: 0.6rem 1rem 1.4rem;
  display: grid;
  justify-items: center;
  gap: 0.95rem;
  position: relative; /* 👈 clave */
}

.pointer {
  width: 32px;
  height: 86px;
  position: absolute; /* 👈 antes estaba relative */
  top: 10px; /* 👈 controla qué tanto se mete en la ruleta */
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.24));
}

.pointer::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 62px;
  clip-path: polygon(50% 100%, 5% 8%, 95% 8%);
  background: linear-gradient(180deg, #f0f6fb 0%, #aec4d8 48%, #5f7993 100%);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.pointer-cap {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 30%,
    #fff,
    #c9dae9 45%,
    #5d7895 100%
  );
  border: 2px solid #f7fcff;
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.7);
}

.pointer-cap::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f4fbff;
  top: 7px;
  left: 8px;
}

.wheel-wrapper {
  --wheel-size: min(92vw, 640px);
  width: var(--wheel-size);
  height: var(--wheel-size);
  margin-top: 40px;
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 1.45rem;
  background: radial-gradient(circle at center, #f8feff, #d7effa);
  box-shadow: inset 0 0 0 8px #ecf8fe;
  position: relative;
}

.spin-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 16px solid rgba(10, 95, 140, 0.18);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.7),
    0 4px 10px rgba(0, 0, 0, 0.13);
  pointer-events: auto;
  touch-action: none;
}

.wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transition: transform 0ms linear;
  touch-action: none;
  border: 10px solid #fff;
  box-shadow:
    0 10px 22px rgba(17, 59, 99, 0.18),
    inset 0 0 0 6px rgba(255, 255, 255, 0.7);
  position: relative;
}

.segment-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: 0 0;
  text-align: right;
  width: 44%;

  color: #082640;
  font-weight: 700;
  font-size: clamp(0.54rem, 1.6vw, 0.95rem);
  line-height: 1.17;
  letter-spacing: 0.1px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  cursor: pointer;
  user-select: none;

  padding: 0; /* quitamos padding para control total */
}

.segment-label:hover {
  background: rgba(255, 255, 255, 0.3);
}

.segment-type {
  position: absolute;
  left: -1px;
  top: 50%;

  transform: translate(-50%, -50%) rotate(-90deg); /* 👈 clave real */
  transform-origin: center;

  font-size: 0.6em;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;

  line-height: 1;
  white-space: nowrap;

  width: max-content; /* 👈 evita falsos centros */
  text-align: center;

  pointer-events: none;
}

.segment-text {
  position: absolute;
  left: 10px; /* 👈 base */
  top: 50%;
  transform: translateY(-50%);

  width: calc(100% - 10px);
  text-align: left;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;

  font-size: 0.98em;

  /* 👇 desplazamiento dinámico respecto al título */
  margin-left: 14px; /* 👈 separación mínima real */

  clip-path: polygon(0% 0%, 100% 15%, 100% 85%, 0% 100%);
}

.wheel-core {
  position: absolute;
  width: 17%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #b8e8f9);
  display: grid;
  place-items: center;
  font-size: clamp(1.2rem, 2.5vw, 1.7rem);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  border: 3px solid #fff;
}

.spin-btn {
  border: none;
  border-radius: 999px;
  padding: 0.8rem 2rem;
  min-width: 150px;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #19a2d0, #1273aa);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(18, 115, 170, 0.3);
  transition: transform 120ms ease;
}

.spin-btn:active {
  transform: scale(0.98);
}

.result {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  max-width: 58ch;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 28, 48, 0.58);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 20;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 50px rgba(5, 28, 48, 0.34);
  padding: 1.3rem 1.1rem 1.2rem;
  border: 3px solid #d4edf9;
}

.modal h2 {
  margin: 0 0 0.45rem;
  color: #0f4f77;
}

.modal-type {
  margin: 0 0 0.55rem;
  font-weight: 800;
  font-size: 1.05rem;
}

.close-btn {
  margin-top: 0.75rem;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #1ca8d8, #1273aa);
  cursor: pointer;
}

@media (max-width: 860px) {
  body {
    padding: 0.9rem;
  }

  .app {
    border-radius: 20px;
  }

  .wheel-wrapper {
    --wheel-size: min(86vw, 560px);
  }
}

@media (max-width: 560px) {
  body {
    padding: 0.45rem;
  }

  .app {
    border-radius: 16px;
  }

  .hero {
    padding-inline: 0.85rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .wheel-panel {
    padding-inline: 0.45rem;
  }

  .wheel-wrapper {
    --wheel-size: min(calc(100vw - 1.6rem), 520px);
    margin-top: 34px;
    padding: 0.95rem;
  }

  .wheel {
    border-width: 7px;
  }

  .pointer {
    transform: translateX(-50%) scale(0.82);
    top: 8px;
  }

  .spin-ring {
    border-width: 10px;
  }
}
