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

:root {
  --bg: #ffffff;
  --bg-section: #f7f7f5;
  --bg-input: #fafafa;
  --bg-card: #ffffff;
  --border: #e5e5e5;
  --border-focus: #932253;
  --text: #111111;
  --text-muted: #666666;
  --text-light: #999999;
  --primary: #932253;
  --primary-hover: #7a1a45;
  --primary-light: rgba(147, 34, 83, 0.06);
  --success: #1a7a3e;
  --success-bg: #f0faf4;
  --success-border: #a3d9b8;
  --warning: #92580a;
  --warning-bg: #fef9f0;
  --warning-border: #f5cc7a;
  --error: #c0392b;
  --radius: 2px;
  --radius-sm: 2px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
}

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.25rem 5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
header {
  padding: 2rem 0 1.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

/* Wordmark logo */
.etnia-wordmark {
  display: flex;
  align-items: center;
  line-height: 1;
}

.etnia-wordmark img {
  display: block;
  height: 48px;
  width: auto;
}

.etnia-wordmark--footer {
  font-size: 0.55rem;
  font-weight: 900;
  color: #932253;
  text-transform: uppercase;
  opacity: 0.4;
}

.logo-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 1rem;
}

.logo-tagline {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --- Main --- */
main { flex: 1; }

.hero {
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.25;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.hero h1 em {
  font-style: normal;
  color: var(--primary);
}

.hero p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* --- Card --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

/* --- Form fields --- */
.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.45rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field textarea,
.field input[type="password"],
.field input[type="text"],
.field select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  padding: 0.75rem 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  resize: vertical;
}

.field textarea:focus,
.field input:focus,
.field select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.field textarea { min-height: 130px; }

.field select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 15px;
  padding-right: 2.5rem;
}

.char-count {
  text-align: right;
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.3rem;
}

/* Password strength */
.strength-bar {
  display: flex;
  gap: 3px;
  margin-top: 0.4rem;
}

.strength-bar span {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.25s;
}

.strength-label {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.3rem;
  height: 1em;
  transition: color 0.2s;
}

.options-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .options-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.4rem; }
  .card { padding: 1.5rem; }
}

/* --- Divider --- */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--text-light);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* --- Buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
  margin-top: 0.75rem;
}

.btn-primary svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.99); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-decoration: none;
  margin-top: 0.6rem;
}

.btn-secondary svg { width: 15px; height: 15px; }
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }

/* --- Result box --- */
.result { text-align: center; }
.result h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.4rem; }
.result > p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  margin-bottom: 1.25rem;
}

.result-badge svg { width: 13px; height: 13px; }

.url-box {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.url-box input {
  flex: 1;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.82rem;
  padding: 0.65rem 0.875rem;
  outline: none;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.btn-copy {
  padding: 0.6rem 1.1rem;
  background: var(--text);
  border: 1px solid var(--text);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.825rem;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-copy:hover { background: #333; border-color: #333; }
.btn-copy.copied { background: var(--success); border-color: var(--success); }

/* Share actions */
.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.825rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-decoration: none;
}

.btn-share svg { width: 14px; height: 14px; }
.btn-share:hover { border-color: var(--primary); color: var(--primary); }

/* QR code */
.qr-wrapper {
  margin: 1rem 0 0;
}

.qr-wrapper img {
  display: block;
  margin: 0.75rem auto 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: #fff;
  width: 200px;
  height: 200px;
}

.qr-label {
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: center;
}

/* --- Features --- */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.75rem;
}

@media (max-width: 540px) {
  .features { grid-template-columns: 1fr; }
}

.feature {
  padding: 1.25rem;
  border-top: 2px solid var(--border);
}

.feature.accent { border-top-color: var(--primary); }

.feature svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
  margin-bottom: 0.65rem;
  display: block;
}

.feature h3 {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
}

.feature p {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- State cards (view page) --- */
.state-card {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}

.state-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.state-icon svg { width: 22px; height: 22px; }

.state-icon--success { background: var(--success-bg); color: var(--success); }
.state-icon--error { background: #fdf2f2; color: var(--error); }
.state-icon--warning { background: var(--primary-light); color: var(--primary); }

.state-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  letter-spacing: -0.025em;
}

.state-card p {
  color: var(--text-muted);
  font-size: 0.925rem;
  margin-bottom: 1.5rem;
}

.state-card .field {
  text-align: left;
  margin-bottom: 1.5rem;
}

/* --- Secret box --- */
.alert-warning {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--warning);
  margin-bottom: 1.25rem;
  text-align: left;
}

.alert-warning svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; }

.secret-box {
  position: relative;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: left;
  margin-bottom: 1rem;
}

.secret-box pre {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-all;
  padding: 1rem 3.5rem 1rem 1rem;
  color: var(--text);
  line-height: 1.65;
  max-height: 300px;
  overflow-y: auto;
}

.btn-copy-secret {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 600;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.btn-copy-secret svg { width: 12px; height: 12px; }
.btn-copy-secret:hover { color: var(--text); border-color: var(--text-muted); }
.btn-copy-secret.copied { color: var(--success); border-color: var(--success-border); }

/* --- Spinner --- */
.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 1rem;
}

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

/* --- Error message --- */
.error-msg {
  font-size: 0.82rem;
  color: var(--error);
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* --- Utility --- */
.hidden { display: none !important; }
.text-muted  { color: var(--text-muted); margin: 0; }
.field--left { text-align: left; }
.hint-text   { font-size: 0.78rem; color: var(--text-light); margin-top: 0.75rem; margin-bottom: 0; }
.icon-sm     { width: 13px; height: 13px; flex-shrink: 0; }

/* --- Footer --- */
footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

footer p {
  font-size: 0.78rem;
  color: var(--text-light);
}

footer .footer-logo svg {
  height: 14px;
  width: auto;
  opacity: 0.35;
}
