/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: #2d3436;
  background-color: #f8f9fa;
  line-height: 1.6;
  min-height: 100vh;
}

/* Shared container */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ============================================
   AD SLOTS — placeholder blocks
   Replace these with real ad code later.
   To hide all placeholders, set display:none
   on .ad-slot or remove the elements.
   ============================================ */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(
    -45deg,
    #f0edff,
    #f0edff 8px,
    #e8e4fd 8px,
    #e8e4fd 16px
  );
  border: 2px dashed #c8c3f0;
  border-radius: 8px;
  overflow: hidden;
}

.ad-placeholder-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #a29bfe;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Leaderboard: 728x90 desktop, 320x50 mobile */
.ad-slot-leaderboard {
  max-width: 728px;
  height: 90px;
  margin: 0 auto;
  padding: 16px 20px;
}

@media (max-width: 767px) {
  .ad-slot-leaderboard {
    max-width: 320px;
    height: 50px;
  }
}

/* Large banner: 970x90 desktop, 728x90 tablet, 320x50 mobile */
.ad-slot-banner {
  max-width: 970px;
  height: 90px;
  margin: 32px auto 0;
  padding: 16px 20px;
}

@media (max-width: 999px) {
  .ad-slot-banner {
    max-width: 728px;
  }
}

@media (max-width: 767px) {
  .ad-slot-banner {
    max-width: 320px;
    height: 50px;
  }
}

/* Modal ad: 300x250 inside winner modal */
.ad-slot-modal {
  width: 300px;
  height: 250px;
  margin: 16px auto 20px;
  border-radius: 8px;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  text-align: center;
  padding: 32px 20px 24px;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
}

.hero-inner {
  max-width: 600px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  margin-top: 10px;
  font-size: 1.15rem;
  opacity: 0.9;
}

.hero-cta {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 700;
  color: #6c5ce7;
  background: #fff;
  border-radius: 50px;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s, box-shadow 0.15s;
}

.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

/* ============================================
   INTRO SECTION
   ============================================ */
.intro-section {
  text-align: center;
  padding: 48px 20px;
}

.intro-section h2 {
  font-size: 1.6rem;
  margin-bottom: 12px;
}

.intro-section p {
  max-width: 620px;
  margin: 0 auto;
  color: #636e72;
  font-size: 1.05rem;
}

/* ============================================
   APP CONTAINER (two-column on desktop)
   ============================================ */
.app-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

@media (min-width: 768px) {
  .app-container {
    flex-direction: row;
    align-items: flex-start;
  }
}

/* Mobile / Desktop visibility helpers */
.mobile-only { display: flex !important; }
.desktop-only { display: none !important; }

@media (min-width: 768px) {
  .mobile-only { display: none !important; }
  .desktop-only { display: flex !important; }
}

/* ============================================
   INPUT PANEL
   ============================================ */
.input-panel {
  flex: 1;
  min-width: 0;
}

.input-panel h2 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

/* ============================================
   OPTIONS TABLE
   ============================================ */
.options-table-wrap {
  border: 2px solid #dfe6e9;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.options-table {
  width: 100%;
  border-collapse: collapse;
}

.options-table thead th {
  padding: 10px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #636e72;
  background: #f8f9fa;
  text-align: left;
  border-bottom: 2px solid #dfe6e9;
}

.col-name { width: auto; }
.col-weight { width: 80px; text-align: center !important; }
.col-delete { width: 44px; }

.options-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}

.options-table tbody tr:last-child {
  border-bottom: none;
}

.options-table tbody tr:hover {
  background: #f8f9fa;
}

.options-table td {
  padding: 6px 12px;
}

.option-name-input {
  width: 100%;
  padding: 8px 0;
  font-size: 1rem;
  font-family: inherit;
  border: none;
  outline: none;
  background: transparent;
}

.option-weight-input {
  width: 100%;
  padding: 8px 4px;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid #dfe6e9;
  border-radius: 6px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.option-weight-input:focus {
  border-color: #6c5ce7;
}

/* Delete button — flat SVG icon */
.btn-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s;
}

.btn-delete svg {
  width: 18px;
  height: 18px;
  fill: #b2bec3;
  transition: fill 0.15s;
}

.btn-delete:hover { background: #ffeaea; }
.btn-delete:hover svg { fill: #d63031; }

/* Add option button */
.btn-add {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  background: #f8f9fa;
  color: #6c5ce7;
  border: 2px dashed #dfe6e9;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-add:hover {
  background: #f0edff;
  border-color: #a29bfe;
}

/* ============================================
   SETTINGS PANEL
   ============================================ */
.settings-panel {
  margin-top: 16px;
  border: 1px solid #dfe6e9;
  border-radius: 10px;
  overflow: hidden;
}

.settings-toggle {
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #636e72;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-toggle::-webkit-details-marker { display: none; }
.settings-toggle::before { content: '⚙'; font-size: 1rem; }

.settings-body {
  padding: 12px 16px 16px;
  border-top: 1px solid #dfe6e9;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.setting-row label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #2d3436;
}

.setting-row select {
  padding: 6px 10px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid #dfe6e9;
  border-radius: 6px;
  outline: none;
  background: #fff;
  cursor: pointer;
}

.setting-row select:focus { border-color: #6c5ce7; }

.btn-toggle {
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 2px solid #dfe6e9;
  border-radius: 20px;
  background: #f8f9fa;
  color: #b2bec3;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 60px;
}

.btn-toggle[data-on="true"] {
  background: #6c5ce7;
  border-color: #6c5ce7;
  color: #fff;
}

/* Buttons row */
.input-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.btn {
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn:active { transform: scale(0.97); }

.btn-spin {
  flex: 1;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  box-shadow: 0 4px 14px rgba(108, 92, 231, 0.35);
}

.btn-spin:hover {
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.5);
}

.btn-clear { background: #dfe6e9; color: #2d3436; }
.btn-clear:hover { background: #b2bec3; }

/* ============================================
   WHEEL PANEL
   ============================================ */
.wheel-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.wheel-wrapper {
  position: relative;
  display: inline-block;
}

.wheel-pointer {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  color: #d63031;
  z-index: 2;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

#wheel-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ============================================
   WINNER HISTORY
   ============================================ */
.history-area {
  margin-top: 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.history-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #2d3436;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-history-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  color: #b2bec3;
  transition: color 0.15s, background 0.15s;
}

.btn-history-icon svg {
  width: 16px;
  height: 16px;
}

.btn-history-icon:hover {
  color: #6c5ce7;
  background: #f0edff;
}

.btn-clear-history {
  background: none;
  border: none;
  font-size: 0.8rem;
  color: #b2bec3;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.btn-clear-history:hover {
  color: #d63031;
  background: #ffeaea;
}

.history-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}

.history-list li {
  padding: 10px 16px;
  font-size: 0.95rem;
  border-bottom: 1px solid #f8f9fa;
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-list li:last-child { border-bottom: none; }

.history-empty {
  color: #b2bec3;
  text-align: center;
  justify-content: center;
}

.history-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: #6c5ce7;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-name { font-weight: 600; color: #2d3436; }

.history-list li.history-new {
  animation: historySlide 0.3s ease-out;
}

@keyframes historySlide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Spinning state */
.btn-spin.spinning {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-spin.spinning:active { transform: none; }

/* ============================================
   HOW IT WORKS
   ============================================ */
.how-section {
  padding: 56px 20px;
  background: #fff;
}

.how-section h2 {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 36px;
}

.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 960px;
  margin: 0 auto;
}

@media (min-width: 600px) {
  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.step-card {
  text-align: center;
  padding: 28px 20px;
  border-radius: 12px;
  background: #f8f9fa;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 14px;
}

.step-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.step-card p {
  font-size: 0.9rem;
  color: #636e72;
}

/* ============================================
   USE CASES
   ============================================ */
.usecases-section {
  padding: 48px 20px;
  text-align: center;
}

.usecases-section h2 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.usecases-hint {
  color: #b2bec3;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.usecases-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 700px;
  margin: 0 auto;
}

.usecase-tag {
  padding: 10px 20px;
  background: #fff;
  border: 2px solid #dfe6e9;
  border-radius: 50px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  color: #2d3436;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.usecase-tag:hover {
  border-color: #6c5ce7;
  color: #6c5ce7;
  background: #f0edff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.15);
}

/* ============================================
   FAQ
   ============================================ */
.faq-section {
  padding: 56px 20px;
  background: #fff;
}

.faq-section h2 {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 32px;
}

.faq-list {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  border: 1px solid #dfe6e9;
  border-radius: 10px;
  overflow: hidden;
}

.faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  font-size: 1.3rem;
  font-weight: 300;
  color: #b2bec3;
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item summary:hover {
  background: #f8f9fa;
}

.faq-item p {
  padding: 0 20px 16px;
  color: #636e72;
  font-size: 0.95rem;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  padding: 40px 20px;
  background: #2d3436;
  color: #b2bec3;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.footer-brand strong {
  font-size: 1.1rem;
  color: #fff;
}

.footer-brand p {
  font-size: 0.85rem;
  margin-top: 4px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.footer-links a {
  color: #b2bec3;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: #fff;
}

.footer-copy {
  font-size: 0.8rem;
  opacity: 0.6;
}

/* ============================================
   WINNER MODAL — festive style
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.25s ease-out;
}

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

.modal-content {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #fff 60%, #f0edff);
  border-radius: 20px;
  padding: 48px 40px 36px;
  text-align: center;
  box-shadow:
    0 20px 60px rgba(108, 92, 231, 0.25),
    0 0 0 3px rgba(108, 92, 231, 0.1);
  animation: modalBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 400px;
  width: 92%;
}

.modal-winner {
  font-size: 2.4rem;
  font-weight: 800;
  color: #6c5ce7;
  margin-bottom: 4px;
  word-break: break-word;
  animation: winnerGlow 1.5s ease-in-out infinite alternate;
}

.modal-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #a29bfe;
  margin-bottom: 24px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.modal-btn {
  min-width: 140px;
  font-size: 1.05rem;
  padding: 14px 32px;
}

/* Confetti burst — CSS-only particles */
.confetti-burst {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalBounce {
  0%   { transform: scale(0.3) rotate(-8deg); opacity: 0; }
  50%  { transform: scale(1.08) rotate(2deg); opacity: 1; }
  70%  { transform: scale(0.95) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes winnerGlow {
  from { text-shadow: 0 0 8px rgba(108, 92, 231, 0.2); }
  to   { text-shadow: 0 0 20px rgba(108, 92, 231, 0.4); }
}

@keyframes confettiFall {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(0.5);
    opacity: 0;
  }
}
