@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
  --bg-primary: #1a0e0a;
  --bg-secondary: #241510;
  --bg-card: #2a1a12;
  --bg-card-hover: #352218;
  --text-primary: #ffecd2;
  --text-secondary: #c4a882;
  --text-muted: #8a7260;
  --accent: #e8703a;
  --accent-glow: rgba(232, 112, 58, 0.3);
  --accent-hover: #f0944e;
  --warning-bg: rgba(251, 191, 36, 0.12);
  --warning-border: rgba(251, 191, 36, 0.35);
  --warning-text: #fbbf24;
  --success: #e8a73a;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Screen container ── */
.screen {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen-content {
  max-width: 440px;
  width: 100%;
  padding: 24px 24px 140px;
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.5s var(--transition) forwards;
  margin: auto 0;
  /* Auto margin for safe vertical centering */
}

/* ── Icon ── */
.step-icon {
  font-size: 56px;
  margin-bottom: 20px;
  display: block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

/* ── Typography ── */
.step-title {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary), #f0944e, #e05535);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.step-body {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.7;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border: none;
  border-radius: 50px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 160px;
}

.quiz-btn-row {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--bg-primary);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 50;
  opacity: 0;
  animation: slideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s forwards;
}

.quiz-btn-row:empty,
.btn:empty {
  display: none !important;
}

.version-tag {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.3;
  pointer-events: none;
  z-index: 100;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.quiz-btn-row .btn {
  width: 100%;
  max-width: 500px;
  border-radius: 12px;
  /* More standard WebApp button shape */
  padding: 16px;
  font-size: 17px;
}

.btn-primary {
  background: linear-gradient(135deg, #e8703a, #c94420);
  color: #fff;
  box-shadow: 0 4px 24px var(--accent-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #f0944e, #e05535);
  box-shadow: 0 6px 32px var(--accent-glow);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

/* ── Warning box ── */
.warning-box {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 20px;
  text-align: left;
  font-size: 14px;
  color: var(--warning-text);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.warning-box::before {
  content: '⚠️';
  flex-shrink: 0;
  font-size: 18px;
}

/* ── Tips list ── */
.tips-list {
  list-style: none;
  text-align: left;
  margin-bottom: 24px;
}

.tips-list li {
  padding: 10px 0 10px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 15px;
  position: relative;
}

.tips-list li::before {
  content: '✓';
  color: var(--success);
  font-weight: 600;
  position: absolute;
  left: 0;
  top: 10px;
}

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

/* ── OS-specific instructions ── */
.os-instructions {
  text-align: left;
  margin-bottom: 24px;
}

.os-instructions h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--accent-hover);
  margin-bottom: 10px;
}

.os-instructions ol {
  list-style: none;
  counter-reset: step;
}

.os-instructions ol li {
  counter-increment: step;
  padding: 8px 0 8px 32px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

.os-instructions ol li::before {
  content: counter(step);
  background: var(--accent);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  position: absolute;
  left: 0;
  top: 8px;
}

/* ── OS selector chips ── */
.os-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.os-chip {
  padding: 8px 16px;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.os-chip:hover {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
}

.os-chip.active {
  border-color: var(--accent);
  background: rgba(232, 112, 58, 0.12);
  color: var(--accent-hover);
}

/* ── Video embed ── */
.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  background: var(--bg-secondary);
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ── Install screen card ── */
.install-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 24px;
}

/* ── Progress bar ── */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #c94420, #e8703a, #f0944e);
  transition: width 0.4s ease;
  z-index: 100;
  border-radius: 0 2px 2px 0;
}

/* ── Final screen ── */
.screen.final-screen {
  background: radial-gradient(ellipse at center bottom, rgba(232, 112, 58, 0.1) 0%, rgba(201, 68, 32, 0.05) 40%, transparent 70%);
}

.final-screen .step-icon {
  font-size: 72px;
}

.final-screen .step-title {
  font-size: 32px;
}

/* ── Auth mock ── */
.auth-btn {
  width: 100%;
  padding: 16px;
  font-size: 16px;
}

/* ── Scrollbar ── */
.screen::-webkit-scrollbar {
  width: 4px;
}

.screen::-webkit-scrollbar-track {
  background: transparent;
}

.screen::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

/* ── Quiz options ── */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.quiz-option:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.1);
}

.quiz-option input[type="radio"],
.quiz-option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: all var(--transition);
}

.quiz-option input[type="checkbox"] {
  border-radius: 4px;
}

.quiz-option input[type="radio"]:checked,
.quiz-option input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--bg-card);
}

.quiz-option input[type="checkbox"]:checked {
  box-shadow: none;
}

.quiz-option input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 6px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.quiz-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(232, 112, 58, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 0 15px rgba(232, 112, 58, 0.1);
}

.quiz-option-label {
  font-size: 16px;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.quiz-option:has(input:checked) .quiz-option-label {
  color: var(--text-primary);
}

/* ── Quiz time input ── */
.quiz-time-wrapper {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}

.quiz-time-input {
  font-family: inherit;
  font-size: 48px;
  font-weight: 300;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 16px 28px;
  text-align: center;
  outline: none;
  transition: all var(--transition);
  color-scheme: dark;
}

.quiz-time-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow);
}

/* ── Animated Arrow ── */
.arrow-pointer {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.arrow-icon {
  font-size: 32px;
  animation: bounceDown 1.5s infinite ease-in-out;
}

.arrow-text {
  font-size: 14px;
  color: var(--text-primary);
  max-width: 240px;
  line-height: 1.3;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.5s ease-out 0.8s backwards;
  text-align: center;
}

@keyframes bounceDown {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(8px);
  }
}

.success-message {
  color: #a3e635;
  /* Lime-green matching sunset palette */
  font-weight: 500;
  margin-top: 12px;
  font-size: 16px;
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Processing screen ── */
.processing-loader {
  width: 100%;
  max-width: 320px;
  margin: 40px auto;
}

.loader-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
  position: relative;
}

.loader-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 0.1s linear;
}

.loader-status {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 300;
  min-height: 24px;
  animation: pulseOpacity 2s infinite ease-in-out;
}

@keyframes pulseOpacity {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* ── Shake animation ── */
@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-6px);
  }

  40% {
    transform: translateX(6px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

/* ── Utilities ── */
.mb-8 {
  margin-bottom: 8px;
}

.mb-12 {
  margin-bottom: 12px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.text-muted {
  color: var(--text-muted);
  font-size: 13px;
}