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

:root {
  --primary: #EE4D2D;
  --primary-dark: #D43B1E;
  --primary-light: #FFF0ED;
  --secondary: #FF7337;
  --text: #1A1A1A;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --bg: #F9FAFB;
  --card: #FFFFFF;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 6px rgba(0,0,0,.05), 0 10px 40px rgba(0,0,0,.1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ── Header ── */
.header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo-text { font-weight: 700; font-size: 18px; color: var(--primary); letter-spacing: -.3px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all .15s;
}
.nav-link:hover { color: var(--primary); background: var(--primary-light); }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, #fff 0%, #FFF5F3 50%, #FFF0ED 100%);
  padding: 48px 0 40px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
  border: 1px solid #FED7CE;
}
.hero-title {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 12px;
  letter-spacing: -.5px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-desc {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Sections ── */
.section { padding: 32px 0; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.section-title { font-size: 18px; font-weight: 700; }
.section-actions { display: flex; align-items: center; gap: 8px; }

/* ── Card ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.main-card { padding: 24px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

/* ── Inputs ── */
.input-group { margin-bottom: 16px; }
.input-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-icon { position: absolute; left: 12px; color: var(--text-muted); pointer-events: none; flex-shrink: 0; }
.input-field {
  width: 100%;
  height: 44px;
  padding: 0 80px 0 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
  outline: none;
}
.input-field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(238,77,45,.1); }
.input-field::placeholder { color: #9CA3AF; }
.btn-paste {
  position: absolute;
  right: 8px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  font-size: 12px;
  transition: all .15s;
}
.btn-paste:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }


/* ── Buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 0 20px;
  height: 44px;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(238,77,45,.3); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-generate { width: 100%; height: 48px; font-size: 15px; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #FED7CE;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 0 16px;
  height: 36px;
  transition: all .15s;
}
.btn-secondary:hover { background: #FFE4DE; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 0 14px;
  height: 36px;
  transition: all .15s;
}
.btn-ghost:hover { color: var(--text); border-color: #9CA3AF; }

/* ── Result ── */
.result-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 24px 0 16px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.result-divider::before, .result-divider::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border);
}
.result-item { margin-bottom: 12px; }
.result-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.result-row { display: flex; gap: 6px; align-items: center; }
.result-input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text);
  background: var(--bg);
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-input:focus { border-color: var(--primary); }
.btn-copy {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.btn-copy:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-copy.copied { border-color: #10B981; color: #10B981; background: #ECFDF5; }
.btn-buy {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 0 14px;
  height: 40px;
  text-decoration: none;
  white-space: nowrap;
  transition: all .15s;
  flex-shrink: 0;
}
.btn-buy:hover { background: var(--primary-dark); }

/* Loading spinner */
.loading-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Stats bar ── */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 12px;
  overflow: hidden;
}
.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px;
  gap: 2px;
}
.stat-num { font-size: 22px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.stat-divider { width: 1px; height: 32px; background: var(--border); flex-shrink: 0; }

/* ── History ── */
.search-wrapper {
  position: relative;
  display: flex; align-items: center;
}
.search-wrapper svg { position: absolute; left: 10px; color: var(--text-muted); }
.search-input {
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: #fff;
  width: 200px;
  transition: all .15s;
}
.search-input:focus { border-color: var(--primary); width: 240px; }

.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all .15s;
  cursor: default;
}
.history-item:hover { border-color: #D1D5DB; box-shadow: var(--shadow); }
.history-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}
.history-content { flex: 1; min-width: 0; }
.history-original {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.history-short {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-time { font-size: 11px; color: #9CA3AF; margin-top: 2px; }
.history-actions { display: flex; gap: 4px; flex-shrink: 0; }
.btn-icon {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-icon.del:hover { border-color: #EF4444; color: #EF4444; background: #FEF2F2; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  gap: 8px;
}
.empty-state p { font-weight: 600; color: var(--text); font-size: 15px; }
.empty-state span { font-size: 13px; }


/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--text);
  color: #fff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn .25s ease;
  max-width: 300px;
}
.toast.success { background: #10B981; }
.toast.error { background: #EF4444; }
.toast.info { background: #3B82F6; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { to { transform: translateX(20px); opacity: 0; } }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .hero { padding: 32px 0 28px; }
  .main-card { padding: 16px; }
  .result-actions { flex-wrap: wrap; }
  .result-actions > * { flex: 1; }
  .search-input { width: 160px; }
  .search-input:focus { width: 180px; }
  .stat-num { font-size: 18px; }
  .history-item { padding: 12px; }
  .card-header { flex-direction: column; align-items: flex-start; }
}
