:root {
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --surface: #1e293b;
  --surface-2: #0f172a;
  --border: rgba(34, 197, 94, 0.22);
  --border-muted: rgba(255, 255, 255, 0.07);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --valid: #22c55e;
  --invalid: #ef4444;
}

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

body {
  font-family: Arial, system-ui, sans-serif;
  background: var(--surface-2);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.container {
  background: var(--surface);
  border-radius: 18px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.ticket-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 18px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ticket-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.01em;
}

.ticket-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.18);
  color: #0f172a;
  padding: 4px 9px;
  border-radius: 999px;
}

.ticket-body {
  padding: 26px 24px 28px;
}

h2 {
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 22px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 14px;
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #cbd5e1;
}

input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #334155;
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

input::placeholder {
  color: #64748b;
}

.phone-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  padding: 0 12px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  transition:
    max-height 0.28s ease,
    opacity 0.22s ease,
    margin-top 0.24s ease,
    padding 0.24s ease,
    background 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.phone-status::before {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.phone-status.valid {
  max-height: 44px;
  opacity: 1;
  margin-top: 7px;
  padding: 8px 12px;
  color: #4ade80;
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.28);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.06);
}

.phone-status.valid::before {
  content: '✓';
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

.phone-status.invalid {
  max-height: 44px;
  opacity: 1;
  margin-top: 7px;
  padding: 8px 12px;
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.28);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.06);
}

.phone-status.invalid::before {
  content: '⚠';
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.phone-status.error {
  max-height: 44px;
  opacity: 1;
  margin-top: 7px;
  padding: 8px 12px;
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.28);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.06);
}

.phone-status.error::before {
  content: '!';
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  background: var(--primary);
  color: #0f172a;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, transform 0.18s, box-shadow 0.2s;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.28);
  margin-top: 6px;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(34, 197, 94, 0.36);
}

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

.btn-mini {
  display: inline-block;
  padding: 7px 18px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 999px;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.btn-mini:hover {
  background: rgba(34, 197, 94, 0.08);
}

.btn-mini.copied {
  color: #4ade80;
  border-color: #4ade80;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: #4ade80;
}

[hidden] { display: none !important; }

.divider {
  height: 1px;
  background: var(--border-muted);
  margin: 20px 0;
}

.loader {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 24px 0 18px;
}

.loader span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  animation: ldot 1.2s ease-in-out infinite;
}

.loader span:nth-child(2) { animation-delay: 0.15s; }
.loader span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ldot {
  0%, 100% { transform: scale(0.45); opacity: 0.35; }
  50% { transform: scale(1); opacity: 1; }
}

.step-title {
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  color: var(--primary);
  margin-bottom: 8px;
}

.step-text {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.6;
}

.waiting-phone {
  text-align: center;
  font-size: 1rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 6px;
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton-layer {
  display: none;
}

#step-code.is-loading .skeleton-layer {
  display: block;
}

#step-code.is-loading .code-content {
  display: none;
}

.code-content {
  animation: code-fadein 0.22s ease;
}

@keyframes code-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.skel {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.09) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: 8px;
}

.skel-title {
  height: 22px;
  width: 58%;
  margin: 0 auto 18px;
}

.skel-code-display {
  height: 66px;
  border-radius: 10px;
  margin-bottom: 14px;
}

.skel-center {
  text-align: center;
  margin-bottom: 16px;
}

.skel-copy {
  height: 30px;
  width: 120px;
  border-radius: 999px;
  display: inline-block;
}

.skel-instructions {
  border-radius: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
}

.skel-inner-line {
  height: 11px;
  border-radius: 5px;
  margin: 8px 0;
  background: rgba(255, 255, 255, 0.06);
}

.skel-inner-line--short {
  width: 68%;
}

.skel-tip-block {
  height: 42px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.skel-conn {
  height: 12px;
  width: 55%;
  border-radius: 5px;
  display: inline-block;
  margin-bottom: 4px;
}

.skel-foot {
  height: 11px;
  width: 42%;
  border-radius: 5px;
  display: inline-block;
}

.pair-code {
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: clamp(24px, 7vw, 34px);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: rgba(34, 197, 94, 0.07);
  border: 1px solid rgba(34, 197, 94, 0.22);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0;
  user-select: all;
}

.pair-actions {
  text-align: center;
  margin-bottom: 18px;
}

.howto {
  border: 1px solid rgba(34, 197, 94, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.howto-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #cbd5e1;
  border-bottom: 1px dashed rgba(34, 197, 94, 0.1);
}

.howto-line:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.howto-num {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #0f172a;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.howto-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.06);
  border: 1px solid rgba(34, 197, 94, 0.18);
  font-size: 12px;
  color: #a3c9a8;
  line-height: 1.55;
}

.tip-label {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(34, 197, 94, 0.14);
  border-radius: 4px;
  padding: 3px 6px;
  margin-top: 1px;
}

.conn-status {
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

.footnote {
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.success-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #0f172a;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.1);
}

.error-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.claimed-icon {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #fbbf24);
  color: #0f172a;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.1);
}

.claimed-greeting {
  text-align: center;
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.claimed-greeting strong {
  color: var(--primary);
}

.claimed-checklist {
  list-style: none;
  border: 1px solid rgba(34, 197, 94, 0.14);
  border-radius: 10px;
  padding: 4px 12px;
  margin-bottom: 16px;
}

.claimed-checklist li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: #cbd5e1;
  border-bottom: 1px dashed rgba(34, 197, 94, 0.1);
}

.claimed-checklist li:last-child {
  border-bottom: none;
}

.claimed-checklist .check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  color: #0f172a;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.claimed-note {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 16px;
}

.claimed-reset {
  text-align: center;
}

@media (max-width: 420px) {
  .ticket-body { padding: 20px 18px 24px; }
  .ticket-header { padding: 15px 18px 13px; }
}
