/* ==========================================================================
   Article Spinner — stylesheet
   ==========================================================================
   Layout: a single centered column. The wheel scales responsively while
   staying perfectly square, and the SVG viewBox guarantees crisp vector
   rendering at any size or device pixel ratio.
   ========================================================================== */

:root {
  --bg-0: #ffffff;
  --bg-1: #f4f6f9;
  --panel: #ffffff;
  --text-0: #14171c;
  --text-1: #5c6472;
  --accent: #ff5a5f;
  --accent-hover: #ff787c;
  --focus-ring: #0f8a9e;
  --shadow-color: rgba(20, 24, 32, 0.35);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(ellipse at 50% -10%, #eef2f8 0%, var(--bg-0) 60%);
  color: var(--text-0);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 24px 24px;
}

.app {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.app-title {
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
}

.remaining {
  margin: 0;
  color: var(--text-1);
  font-size: 0.95rem;
}

.spin-count {
  margin: 0;
  color: var(--text-1);
  font-size: 0.85rem;
}

.spin-count[hidden] {
  display: none;
}

.wheel-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.wheel-wrap {
  /* Sizing purely off viewport width lets the wheel stay large on a wide
     but short window (extra browser chrome eating into vertical space,
     e.g. Firefox's default toolbars) and push the total page height past
     the viewport, forcing a scrollbar with the top/bottom clipped. The
     third min() term reserves ~260px for the title, button, and label
     around the wheel and caps the wheel's height to whatever's left. */
  width: min(88vw, 560px, calc((100vh - 260px) / 1.1));
  aspect-ratio: 600 / 660;
}

.wheel-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.floor-shadow {
  fill: var(--shadow-color);
  filter: blur(10px);
  opacity: 0.55;
}

/* Winning slice highlight pulse, toggled by JS */
.slice-winner {
  animation: winner-pulse 1.4s ease-out 2;
}

@keyframes winner-pulse {
  0%   { stroke: #ffffff; stroke-width: 2; filter: drop-shadow(0 0 0 rgba(255,255,255,0)); }
  35%  { stroke: #ffffff; stroke-width: 6; filter: drop-shadow(0 0 14px rgba(255,255,255,0.95)); }
  100% { stroke: #14161c; stroke-width: 2; filter: drop-shadow(0 0 0 rgba(255,255,255,0)); }
}

/* ---------------------------------------------------------------- button */

.spin-button {
  appearance: none;
  border: none;
  cursor: pointer;
  min-width: 160px;
  padding: 11px 40px;
  border-radius: 999px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #1a1006;
  /* Cold (left) to hot (right) — matches the spin force, which is weaker
     the closer you click to the cold/left end and stronger toward the
     hot/right end. The vertical wash on top keeps the glossy 3D-pill look
     without fighting the left-right hue direction. */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.12) 100%),
    linear-gradient(90deg, #12a9e0 0%, #9a3fc4 50%, #ff3b1f 100%);
  box-shadow:
    0 5px 0 #5a2560,
    0 8px 16px rgba(0, 0, 0, 0.45);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
}

.spin-button:hover:not(:disabled) {
  filter: brightness(1.05);
}

.spin-button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow:
    0 2px 0 #5a2560,
    0 4px 10px rgba(0, 0, 0, 0.45);
}

.spin-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.5) brightness(0.7);
  box-shadow:
    0 5px 0 #3a2a3d,
    0 8px 16px rgba(0, 0, 0, 0.35);
}

/* -------------------------------------------------------- focus outlines */

.spin-button:focus-visible,
.continue-button:focus-visible,
.modal-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

/* ----------------------------------------------------------------- modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 10, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  padding-top: 2vh;
  z-index: 50;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid #e2e5ea;
  border-radius: 16px;
  padding: 28px 26px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(20, 24, 32, 0.18);
  animation: modal-in 0.18s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-label {
  margin: 0 0 10px;
  color: var(--text-1);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.modal-article {
  margin: 0 0 22px;
  font-size: 1.25rem;
  font-weight: 700;
  word-break: break-word;
}

.modal-image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
  margin: -8px 0 22px;
}

.modal-image[hidden] {
  display: none;
}

.modal-link {
  color: var(--focus-ring);
  text-decoration: none;
  border-bottom: 2px solid currentColor;
}

.modal-link:hover {
  color: #0c6d7d;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.continue-button {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--bg-0);
  background: var(--text-0);
  transition: filter 0.15s ease, transform 0.08s ease;
}

.continue-button:hover {
  filter: brightness(0.92);
}

.continue-button:active {
  transform: translateY(2px);
}

/* --------------------------------------------------------- small screens */

@media (max-width: 420px) {
  .spin-button {
    min-width: 130px;
    padding: 9px 30px;
    font-size: 1rem;
  }
}
