/* 線上抽獎器 — clean, high-contrast, mobile-first */

:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --border: #2e3d52;
  --text: #f0f4f8;
  --text-muted: #8b9cb3;
  --accent: #ff6b35;
  --accent-hover: #ff8255;
  --accent-text: #0f1419;
  --success: #3dd68c;
  --ad-bg: #1e2836;
  --ad-border: #334155;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC",
    system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(255, 107, 53, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(61, 214, 140, 0.06), transparent);
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 1rem;
  padding-top: 0.5rem;
}

.logo {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #fff 30%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Ad placeholders — fixed height, no CLS */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ad-bg);
  border: 1px dashed var(--ad-border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  user-select: none;
}

.ad-banner {
  width: 100%;
  height: 50px;
  margin-bottom: 1.25rem;
}

.ad-rect {
  width: 100%;
  max-width: 300px;
  height: 250px;
  margin: 1.25rem auto;
}

.ad-label {
  opacity: 0.7;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.field {
  margin-bottom: 1rem;
}

.field label,
.check-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.check-label input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

textarea,
input[type="number"] {
  width: 100%;
  padding: 0.75rem 0.875rem;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  resize: vertical;
  min-height: 160px;
  line-height: 1.6;
}

textarea:focus,
input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.25);
}

textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.meta {
  margin: 0.4rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: right;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.field-sm {
  flex: 0 0 7rem;
  margin-bottom: 0;
}

.field-sm input {
  text-align: center;
}

.field-check {
  flex: 1 1 12rem;
  margin-bottom: 0;
  padding-bottom: 0.55rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.9rem 1.25rem;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary.spinning {
  opacity: 0.85;
  pointer-events: none;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9375rem;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-muted);
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

@media (min-width: 400px) {
  .btn-row {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* Result */
.result-card {
  margin-top: 0;
  text-align: center;
  border-color: rgba(255, 107, 53, 0.35);
}

.result-title {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
}

.spin-area {
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.spin-text {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-muted);
  animation: pulse 0.35s ease-in-out infinite alternate;
}

@keyframes pulse {
  from {
    opacity: 0.45;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1.02);
  }
}

.winners-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.winners-list li {
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  animation: reveal 0.4s ease-out both;
}

.winners-list li .rank {
  display: inline-block;
  min-width: 1.75rem;
  margin-right: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  vertical-align: middle;
}

.winners-list.single li {
  font-size: 1.75rem;
  padding: 1.25rem 1rem;
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(61, 214, 140, 0.1));
  border-color: rgba(255, 107, 53, 0.4);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--success);
  font-weight: 600;
}

/* Footer */
.footer {
  margin-top: 2rem;
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.footer-nav {
  margin-bottom: 0.5rem;
}

.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.footer-nav a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.85;
}

/* Privacy page */
.privacy-body {
  max-width: 640px;
}

.privacy-body h1 {
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
}

.privacy-body .updated {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.privacy-body h2 {
  font-size: 1.125rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--accent);
}

.privacy-body p,
.privacy-body li {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.privacy-body ul {
  padding-left: 1.25rem;
}

.privacy-body a {
  color: var(--accent);
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.back-link:hover {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .spin-text,
  .winners-list li {
    animation: none;
  }
}
