:root {
  --tik-black: #000000;
  --tik-white: #ffffff;
  --tik-cyan: #00f2ea;
  --tik-pink: #ff0050;
  --tik-gray: #161616;
  --tik-glass: rgba(255, 255, 255, 0.08);
  --tik-glass-border: rgba(255, 255, 255, 0.12);
  --terminal-green: #00ff00;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background: var(--tik-black);
  color: var(--tik-white);
  min-height: 100dvh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(0, 242, 234, 0.15), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 80%, rgba(255, 0, 80, 0.12), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 440px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
}

.logo-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  padding-top: env(safe-area-inset-top, 0);
}

.logo-animated-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
}

.logo-animated-wrap::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--tik-cyan), var(--tik-pink), var(--tik-cyan));
  opacity: 0.45;
  animation: logoRingSpin 4s linear infinite;
  filter: blur(12px);
}

.logo-animated {
  position: relative;
  z-index: 1;
  width: 120px;
  height: auto;
  object-fit: contain;
  animation: logoFloat 3s ease-in-out infinite, logoPulse 2.2s ease-in-out infinite;
}

.page-logo-center {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  opacity: 0.06;
}

.page-logo-center .logo-animated {
  width: min(70vw, 320px);
  animation: logoSpinSlow 24s linear infinite;
  filter: none;
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-10px) scale(1.04);
  }
}

@keyframes logoPulse {
  0%, 100% {
    filter: drop-shadow(0 0 14px rgba(0, 242, 234, 0.45));
  }
  50% {
    filter: drop-shadow(0 0 28px rgba(255, 0, 80, 0.55));
  }
}

@keyframes logoRingSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes logoSpinSlow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.step-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 24px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.35s ease;
}

.step-dot.active {
  width: 24px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--tik-cyan), var(--tik-pink));
}

.step-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  animation: fadeSlideIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.step-panel.active {
  display: flex;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.glass-card {
  background: var(--tik-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--tik-glass-border);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
}

.step-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
  text-align: center;
}

.step-subtitle {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.5;
}

.lang-grid,
.resource-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  color: var(--tik-white);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
  text-align: left;
}

.option-btn:hover,
.option-btn:focus-visible {
  border-color: var(--tik-cyan);
  background: rgba(0, 242, 234, 0.08);
  transform: scale(1.02);
  outline: none;
}

.option-btn:active {
  transform: scale(0.98);
}

.option-btn .flag,
.option-btn .icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.option-btn .label {
  flex: 1;
}

.option-btn .chevron {
  opacity: 0.4;
  font-size: 1.2rem;
}

.input-field {
  width: 100%;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  color: var(--tik-white);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.input-field::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.input-field:focus {
  outline: none;
  border-color: var(--tik-cyan);
}

.input-prefix-wrap {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.input-prefix-wrap:focus-within {
  border-color: var(--tik-cyan);
}

.input-prefix {
  padding: 16px 0 16px 18px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
}

.input-prefix-wrap .input-field {
  border: none;
  margin: 0;
  background: transparent;
}

.btn-primary {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--tik-white);
  cursor: pointer;
  background: linear-gradient(135deg, var(--tik-cyan), var(--tik-pink));
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: auto;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255, 0, 80, 0.35);
}

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

.device-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.device-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  color: var(--tik-white);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.device-btn svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
  opacity: 0.85;
}

.device-btn.selected {
  border-color: var(--tik-cyan);
  background: rgba(0, 242, 234, 0.12);
  box-shadow: 0 0 20px rgba(0, 242, 234, 0.2);
}

.amount-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.amount-btn {
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  color: var(--tik-white);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.amount-btn.selected {
  border-color: var(--tik-pink);
  background: rgba(255, 0, 80, 0.12);
}

.section-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 12px;
}

/* Terminal (Step 5) */
.terminal-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000000;
  display: none;
  flex-direction: column;
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
}

.terminal-fullscreen.active {
  display: flex;
}

.terminal-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-dot.red { background: #ff5f57; }
.terminal-dot.yellow { background: #febc2e; }
.terminal-dot.green { background: #28c840; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: #888;
}

.terminal-body {
  flex: 1;
  padding: 20px 16px;
  overflow-y: auto;
  color: var(--terminal-green);
  font-size: 0.8rem;
  line-height: 1.6;
}

.terminal-line {
  margin-bottom: 4px;
  opacity: 0;
  animation: terminalLineIn 0.15s forwards;
}

@keyframes terminalLineIn {
  to { opacity: 1; }
}

.terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--terminal-green);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes blink {
  50% { opacity: 0; }
}

.terminal-progress-wrap {
  padding: 16px 20px 32px;
  background: #0a0a0a;
}

.terminal-progress-label {
  color: var(--terminal-green);
  font-size: 0.75rem;
  margin-bottom: 8px;
  font-family: 'SF Mono', Menlo, monospace;
}

.terminal-progress-bar {
  height: 6px;
  background: #222;
  border-radius: 3px;
  overflow: hidden;
}

.terminal-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--terminal-green);
  border-radius: 3px;
  transition: width 0.3s ease;
  box-shadow: 0 0 12px rgba(0, 255, 0, 0.5);
}

/* Step 6 verification */
.verify-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 242, 234, 0.2), rgba(255, 0, 80, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.verify-card {
  text-align: center;
}

.verify-pulse {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.85; }
}

/* Non-closing modal (Step 7) */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  width: 100%;
  max-width: 400px;
  background: var(--tik-gray);
  border: 1px solid var(--tik-glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  animation: modalIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 20px 20px 12px;
  text-align: center;
  background: linear-gradient(135deg, rgba(0, 242, 234, 0.1), rgba(255, 0, 80, 0.1));
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
}

.modal-body {
  padding: 0;
  min-height: 280px;
}

.modal-body iframe {
  width: 100%;
  height: 320px;
  border: none;
  background: #fff;
}

.modal-footer {
  padding: 16px 20px 20px;
  text-align: center;
}

.modal-footer p {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

.modal-cta {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  color: var(--tik-white);
  background: linear-gradient(135deg, var(--tik-cyan), var(--tik-pink));
  border-radius: var(--radius-lg);
}

/* Error toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--tik-pink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 300;
  opacity: 0;
  transition: transform 0.35s, opacity 0.35s;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.app-footer {
  margin-top: auto;
  padding-top: 24px;
  text-align: center;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.35);
}

.hidden {
  display: none !important;
}

@media (max-width: 380px) {
  .step-title {
    font-size: 1.2rem;
  }

  .device-btn {
    padding: 14px 6px;
    font-size: 0.65rem;
  }
}
