* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  --bg: #f4f6fb;
  --panel-bg: rgba(255, 255, 255, 0.96);
  --text: #1c2230;
  --muted: #5c6372;
  --primary: #5661f6;
  --primary-soft: #eef0ff;
  --danger: #ff5c5c;
  --border: rgba(148, 156, 182, 0.3);
  --shadow: 0 24px 60px rgba(20, 22, 40, 0.18);
  --wheel-glass: linear-gradient(
      140deg,
      rgba(255, 255, 255, 0.6),
      rgba(255, 255, 255, 0.15)
    ),
    rgba(255, 255, 255, 0.25);
  --wheel-text: #131722;
}

body {
  min-height: 100vh;
  background: radial-gradient(
      circle at top,
      rgba(86, 97, 246, 0.08),
      transparent 60%
    ),
    var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body.theme-dark {
  color-scheme: dark;
  --bg: #0a0d17;
  --panel-bg: rgba(16, 20, 34, 0.96);
  --text: #f4f6ff;
  --muted: #9aa1b5;
  --primary: #7a86ff;
  --primary-soft: #1b233a;
  --danger: #ff7b7b;
  --border: rgba(92, 102, 128, 0.35);
  --shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
  --wheel-glass: linear-gradient(
      140deg,
      rgba(28, 33, 52, 0.75),
      rgba(14, 16, 24, 0.6)
    ),
    rgba(24, 29, 46, 0.9);
  --wheel-text: #f5f7ff;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.app {
  min-height: 100vh;
  position: relative;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px 28px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

body.theme-dark .site-header {
  background: rgba(10, 13, 23, 0.85);
}

.site-title {
  display: flex;
  gap: 12px;
  align-items: center;
}

.site-title h1 {
  font-size: 1.4rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  font-weight: 800;
}

.site-title p {
  font-size: 0.85rem;
  color: var(--muted);
}

.logo-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 6px rgba(86, 97, 246, 0.18);
}

.logo-image {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--panel-bg);
  padding: 6px;
  box-shadow: 0 8px 18px rgba(86, 97, 246, 0.2);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-nav a,
.site-nav button {
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 999px;
  transition: background 0.2s ease;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav button:hover {
  background: var(--primary-soft);
}

.wheel-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  gap: 16px;
  padding: 24px 24px 72px;
}

.wheel-shell {
  position: relative;
  width: min(78vh, 680px);
  height: min(78vh, 680px);
  min-width: 280px;
  min-height: 280px;
  border-radius: 50%;
  padding: 24px;
  background: var(--wheel-glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  display: grid;
  place-items: center;
  animation: wheelPulse 4s ease-in-out infinite;
}

.wheel-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

#wheel-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--panel-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  transition: transform 0.1s ease-out;
}

.wheel-pointer {
  position: absolute;
  top: -14px;
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 30px solid var(--text);
  z-index: 3;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.center-result {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  text-align: center;
  font-weight: 800;
  font-size: clamp(1.6rem, 3.8vw, 2.8rem);
  padding: 18px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  color: #1b24b6;
  text-shadow: 0 8px 24px rgba(86, 97, 246, 0.35);
  box-shadow: 0 16px 40px rgba(86, 97, 246, 0.25);
  backdrop-filter: blur(8px);
  z-index: 3;
}

body.theme-dark .center-result {
  background: rgba(16, 20, 34, 0.88);
  color: #cfd6ff;
}

.center-result--ready {
  animation: readyGlow 2.6s ease-in-out infinite;
}

.center-result--winner {
  font-size: clamp(1.8rem, 4.2vw, 3.1rem);
  animation: winnerPulse 1.8s ease-in-out infinite;
}

@keyframes readyGlow {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 16px 40px rgba(86, 97, 246, 0.25);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.03);
    box-shadow: 0 20px 50px rgba(86, 97, 246, 0.4);
  }
}

@keyframes winnerPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1.01);
    box-shadow: 0 20px 60px rgba(86, 97, 246, 0.45);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.06);
    box-shadow: 0 24px 70px rgba(86, 97, 246, 0.6);
  }
}

.spin-button {
  position: absolute;
  left: 50%;
  bottom: -24px;
  transform: translateX(-50%);
  z-index: 4;
  border: none;
  border-radius: 999px;
  padding: 18px 42px;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffffff;
  background: var(--primary);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.spin-button:hover {
  transform: translateX(-50%) translateY(-2px) scale(1.02);
  box-shadow: 0 16px 30px rgba(86, 97, 246, 0.35);
}

.spin-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: translateX(-50%);
  box-shadow: none;
}

.status-text {
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.content-section {
  display: grid;
  place-items: center;
  padding: 24px 24px 64px;
}

.content-card {
  width: min(980px, 100%);
  background: var(--panel-bg);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: grid;
  gap: 16px;
}

.content-card h2 {
  font-size: 1.6rem;
}

.content-card h3 {
  margin-top: 10px;
  font-size: 1.2rem;
}

.content-card h4 {
  font-size: 1rem;
  color: var(--muted);
}

.content-card p {
  color: var(--muted);
  line-height: 1.6;
}

.screenshot-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.screenshot-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  background: var(--primary-soft);
}

.screenshot-card img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  border: 1px solid rgba(120, 130, 170, 0.35);
}

.screenshot-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  border: 1px dashed rgba(120, 130, 170, 0.5);
  background: linear-gradient(
    135deg,
    rgba(86, 97, 246, 0.08),
    rgba(86, 97, 246, 0.02)
  );
}

.screenshot-card figcaption {
  font-size: 0.9rem;
  color: var(--muted);
}

.faq-list {
  display: grid;
  gap: 14px;
}

.faq-item {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
}

body.theme-dark .faq-item {
  background: rgba(16, 20, 34, 0.8);
}

.icon-rail {
  position: fixed;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 15;
}

.icon-button {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: none;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 1.4rem;
  display: grid;
  place-items: center;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.icon-button:hover {
  transform: translateY(-2px);
}

.icon-button--fab {
  display: none;
}

.icon-button[data-tooltip]::after,
.floating-button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  white-space: nowrap;
  background: var(--panel-bg);
  color: var(--text);
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.icon-button[data-tooltip]::after {
  left: 60px;
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
}

.floating-button[data-tooltip]::after {
  right: 64px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
}

.icon-button:hover::after,
.floating-button:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.floating-controls {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 16;
}

.social-share {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 16;
}

.social-share a {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease;
}

.social-share a:hover {
  transform: translateY(-2px);
}

.social-share img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
}

.floating-button {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 1.3rem;
  display: grid;
  place-items: center;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.floating-button:hover {
  transform: translateY(-2px);
}

.floating-group {
  position: relative;
}

.floating-popover {
  position: absolute;
  bottom: 64px;
  right: 0;
  width: 220px;
  padding: 14px;
  background: var(--panel-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.floating-popover.is-open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 12, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 12;
}

.panel-overlay.is-visible {
  opacity: 1;
  pointer-events: all;
}

.panel-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: min(360px, 92vw);
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 16px;
  overflow-y: auto;
  transform: translateX(-110%);
  transition: transform 0.25s ease;
  z-index: 14;
  border-top-right-radius: 20px;
  border-bottom-right-radius: 20px;
}

.panel-drawer.is-open {
  transform: translateX(0);
}

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel__meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.panel-close {
  border: none;
  background: var(--primary-soft);
  border-radius: 12px;
  padding: 6px 10px;
  cursor: pointer;
}

.add-form {
  display: grid;
  gap: 10px;
}

.add-form textarea {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  resize: vertical;
  min-height: 90px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.inline-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.inline-controls button,
.items-list button,
.ghost-button,
.primary-button {
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
}

.ghost-button,
.inline-controls button {
  background: var(--primary-soft);
  color: var(--text);
}

.toggle,
.radio {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.toggle input,
.radio input {
  accent-color: var(--primary);
}

.items-list {
  list-style: none;
  display: grid;
  gap: 12px;
}

.items-list li {
  display: grid;
  grid-template-columns: 1fr 80px auto auto;
  gap: 8px;
  align-items: center;
}

body.weights-disabled .items-list li {
  grid-template-columns: 1fr auto auto;
}

body.weights-disabled .item-weight {
  display: none;
}

.items-list input[type="text"],
.items-list input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
}

.items-list button.delete {
  background: rgba(255, 92, 92, 0.15);
  color: var(--danger);
}

.settings-group {
  display: grid;
  gap: 10px;
}

.settings-group select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.history-list {
  list-style: none;
  display: grid;
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.history-list li {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 12px;
  background: var(--primary-soft);
}

.history-list button {
  border: none;
  border-radius: 10px;
  padding: 6px 10px;
  background: rgba(255, 92, 92, 0.15);
  color: var(--danger);
  cursor: pointer;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.import-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
}

.import-control input {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 20, 0.5);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}

.modal.is-visible {
  opacity: 1;
  pointer-events: all;
}

.modal__card {
  background: var(--panel-bg);
  border-radius: 18px;
  padding: 24px;
  width: min(420px, 90%);
  text-align: center;
  position: relative;
  box-shadow: var(--shadow);
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--muted);
}

.modal__eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  margin-bottom: 8px;
}

.modal__time {
  color: var(--muted);
  margin: 12px 0 18px;
}

.modal__actions {
  display: grid;
  gap: 10px;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 28px 32px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.site-footer a:hover {
  color: var(--text);
}

.ad-slot {
  width: min(100%, 980px);
  margin: 24px auto;
  padding: 16px;
  border-radius: 16px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.ad-slot iframe,
.ad-slot img,
.ad-slot .ad-media {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes wheelPulse {
  0%,
  100% {
    box-shadow: var(--shadow);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 30px 70px rgba(86, 97, 246, 0.25);
    transform: scale(1.01);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wheel-shell {
    animation: none;
  }
}

@media (max-width: 900px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-nav {
    flex-wrap: wrap;
  }

  .wheel-shell {
    width: min(84vw, 560px);
    height: min(84vw, 560px);
  }
}

@media (max-width: 720px) {
  .site-header {
    position: static;
  }

  .icon-rail {
    top: auto;
    bottom: 24px;
    left: 24px;
    transform: none;
  }

  .icon-button {
    display: none;
  }

  .icon-button--fab {
    display: grid;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.4rem;
  }

  .icon-rail.is-open .icon-button {
    display: grid;
  }

  .panel-drawer {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: min(70vh, 520px);
    border-radius: 20px 20px 0 0;
    transform: translateY(110%);
  }

  .panel-drawer.is-open {
    transform: translateY(0);
  }

  .social-share {
    right: 16px;
    top: auto;
    bottom: 110px;
    transform: none;
    flex-direction: row;
  }
}

@media (max-width: 540px) {
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .items-list li {
    grid-template-columns: 1fr 60px auto;
  }

  .items-list li .item-weight {
    display: none;
  }
}
