/* ── Design Tokens ── */
:root {
  /* Colors — from Figma variables */
  --color-bg: #1e40af;
  --color-card: #f5f5f5;
  --color-card-border: #e5e5e5;
  --color-foreground: #0a0a0a;
  --color-muted: #737373;
  --color-primary: #171717;
  --color-primary-fg: #fafafa;
  --color-white: #ffffff;
  --color-icon-sky: #38bdf8;
  --color-icon-pink: #ec4899;

  /* Typography */
  --font-sans: 'Geist Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --lh-xs: 16px;
  --lh-sm: 20px;
  --lh-base: 24px;

  /* Spacing */
  --sp-0-5: 2px;
  --sp-1: 4px;
  --sp-1-5: 6px;
  --sp-2: 8px;
  --sp-2-5: 10px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-10: 40px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-card: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);

  /* Heights */
  --h-8: 32px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-foreground);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── Screens ── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-10);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.screen-active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Top Smile Icon (absolute, shared) ── */
.smile-icon {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.smile-icon svg {
  width: 32px;
  height: 38px;
}

body.show-top-smile .smile-icon {
  opacity: 1;
}

/* ── Screen 1: Loading ── */
.loading-smile {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: spin 4s linear infinite;
}

.loading-smile svg {
  width: 32px;
  height: 38px;
}

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

/* ── Screen 2: Password ── */
.password-card {
  background: var(--color-white);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-xs);
  padding: var(--sp-6);
  width: 384px;
  max-width: calc(100% - 2 * var(--sp-10));
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  overflow: hidden;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.field-label {
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: var(--lh-sm);
  color: var(--color-foreground);
}

.field-input {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  font-weight: 400;
  color: var(--color-foreground);
  background: var(--color-white);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  height: var(--h-8);
  padding: var(--sp-1) var(--sp-2-5);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

.field-input:focus {
  border-color: var(--color-bg);
  box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.15);
}

.field-error {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  color: #ef4444;
  font-weight: 400;
}

.field-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  align-items: stretch;
}

.field-hint {
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  color: var(--color-muted);
  text-align: center;
  font-weight: 400;
}

/* ── Buttons ── */
.btn-primary {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: var(--lh-sm);
  color: var(--color-primary-fg);
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-md);
  height: var(--h-8);
  padding: var(--sp-2) var(--sp-2-5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1-5);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease, transform 0.1s ease;
  overflow: hidden;
}

.btn-primary:hover {
  opacity: 0.85;
}

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

.btn-small {
  width: auto;
  min-width: 86px;
  display: inline-flex;
}

.product-card .btn-primary {
  align-self: flex-start;
}

.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Screen 3: Downloads ── */
.products-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  width: 366px;
  max-width: 100%;
}

.product-card {
  background: var(--color-card);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.product-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.product-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.product-icon svg {
  width: 16px;
  height: 19px;
}

.product-icon--sky {
  background: var(--color-icon-sky);
}

.product-icon--pink {
  background: var(--color-icon-pink);
}

.product-title {
  font-size: var(--text-base);
  font-weight: 600;
  line-height: var(--lh-base);
  color: var(--color-foreground);
  white-space: nowrap;
}

.product-meta {
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: var(--lh-xs);
  color: var(--color-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-description {
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: var(--lh-xs);
  color: var(--color-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: calc(-1 * var(--sp-3));
}

.product-badges {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}

.badge-outline {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: var(--lh-xs);
  color: var(--color-foreground);
  background: var(--color-white);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-full);
  padding: var(--sp-0-5) var(--sp-2);
  white-space: nowrap;
}

/* ── Mobile ── */
.mobile-note {
  display: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--text-sm);
  text-align: center;
  margin-top: var(--sp-6);
}

.footnote {
  color: rgba(255, 255, 255, 0.4);
  font-size: var(--text-sm);
  margin-top: var(--sp-4);
  text-align: center;
}

.footnote a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .products-list {
    display: none;
  }

  .mobile-note {
    display: block;
  }
}
