/* ============================================
   RANDOMUNIVERSE — GLOBAL RESET & VARIABLES
   ============================================ */
:root {
  --bg-deep: #070709;
  --bg-surface: rgba(255, 255, 255, 0.04);
  --bg-elevated: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-light: rgba(255, 255, 255, 0.15);
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #6e6e73;
  --accent: #5e5ce6;
  --accent-glow: rgba(94, 92, 230, 0.3);
  --success: #30d158;
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glass: 0 4px 24px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   BACKGROUND LAYERS
   ============================================ */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(94, 92, 230, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(48, 209, 88, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 60% at 50% 80%, rgba(94, 92, 230, 0.1) 0%, transparent 50%),
    var(--bg-deep);
  animation: meshShift 20s ease-in-out infinite;
}

@keyframes meshShift {
  0%, 100% { transform: scale(1) translate(0, 0); }
  33% { transform: scale(1.05) translate(-1%, 1%); }
  66% { transform: scale(0.95) translate(1%, -1%); }
}

.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  pointer-events: none;
}

/* ============================================
   APP CONTAINER
   ============================================ */
.app-container {
  max-width: 540px;
  margin: 0 auto;
  padding: 0 20px 40px;
  position: relative;
  z-index: 1;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: linear-gradient(to bottom, rgba(7, 7, 9, 0.9) 60%, transparent);
  margin: 0 -20px;
  padding: 20px 20px 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-glass);
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, #a1a1a6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s var(--spring);
}

.icon-btn:active {
  transform: scale(0.88);
  background: var(--bg-elevated);
}

/* ============================================
   HERO
   ============================================ */
.hero {
  padding: 32px 0 28px;
  text-align: center;
}

.hero h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff 0%, #c7c7cc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ============================================
   SEARCH
   ============================================ */
.search-container {
  position: relative;
  margin-bottom: 24px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
  pointer-events: none;
}

.search-input, .keyword-input {
  width: 100%;
  padding: 14px 16px 14px 42px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-glass);
  transition: all 0.3s var(--ease-out);
}

.search-input::placeholder, .keyword-input::placeholder {
  color: var(--text-tertiary);
}

.search-input:focus, .keyword-input:focus {
  border-color: var(--glass-border-light);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-glass);
}

.keyword-input {
  padding: 14px 16px;
  margin-bottom: 16px;
}

/* ============================================
   GENERATORS GRID
   ============================================ */
.generators-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 32px;
}

.gen-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--glass-border);
  background: var(--bg-surface);
  text-decoration: none;
  color: inherit;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: var(--shadow-glass);
  transition: all 0.4s var(--spring);
  position: relative;
  overflow: hidden;
}

.gen-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.gen-card:active {
  transform: scale(0.97);
  background: var(--bg-elevated);
}

.gen-card .icon-wrapper {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.3s var(--spring);
}

.gen-card:active .icon-wrapper {
  transform: scale(0.9);
}

.gen-card h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 2px;
  color: var(--text-primary);
}

.gen-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ============================================
   KO-FI CARD (HOMEPAGE #6)
   ============================================ */
.kofi-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(0, 255, 170, 0.2);
  background: rgba(0, 255, 170, 0.08);
  text-decoration: none;
  color: inherit;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 0 20px rgba(0, 255, 170, 0.15), var(--shadow-glass);
  transition: all 0.4s var(--spring);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.kofi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(0, 255, 170, 0.3) 0%, transparent 50%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.kofi-card:active {
  transform: scale(0.97);
  background: rgba(0, 255, 170, 0.12);
}

.kofi-card .icon-wrapper {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(0, 255, 170, 0.15);
  border: 1px solid rgba(0, 255, 170, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.3s var(--spring);
}

.kofi-card:active .icon-wrapper {
  transform: scale(0.9);
}

.kofi-card h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 2px;
  color: #00ffaa;
}

.kofi-card p {
  font-size: 13px;
  color: rgba(0, 255, 170, 0.7);
  line-height: 1.4;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 15px;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  text-align: center;
  padding: 24px 0;
  border-top: 1px solid var(--glass-border);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-links a:active {
  color: var(--text-primary);
}

.kofi-footer-link {
  display: inline-block;
  color: #00ffaa;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0, 255, 170, 0.2);
  background: rgba(0, 255, 170, 0.06);
  transition: all 0.3s var(--spring);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.kofi-footer-link:hover {
  background: rgba(0, 255, 170, 0.12);
  box-shadow: 0 0 16px rgba(0, 255, 170, 0.15);
  transform: translateY(-1px);
}

.kofi-footer-link:active {
  transform: scale(0.95);
}

.footer p {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 1000;
  opacity: 0;
  transition: all 0.5s var(--spring);
  pointer-events: none;
}

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

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--shadow-soft);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--success);
  color: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================
   GENERATOR PAGE STYLES
   ============================================ */
.generator-page {
  padding-top: 8px;
}

.generator-header {
  text-align: center;
  margin-bottom: 24px;
}

.generator-header h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 0%, #c7c7cc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.generator-header p {
  font-size: 15px;
  color: var(--text-secondary);
}

.generator-card {
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  background: var(--bg-surface);
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  margin-bottom: 20px;
}

.generator-controls {
  padding: 24px 20px;
  border-bottom: 1px solid var(--glass-border);
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.control-row:last-child {
  margin-bottom: 0;
}

.control-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
}

.control-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-elevated);
  outline: none;
  margin-top: 8px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text-primary);
  border: 3px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.2s var(--spring);
}

input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.2);
}

/* Toggles — SCROLLABLE */
.toggle-group {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
}

.toggle-group::-webkit-scrollbar {
  display: none;
}

.toggle-btn {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--spring);
  white-space: nowrap;
  flex-shrink: 0;
}

.toggle-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Generate Button — COMPACT */
.generate-btn {
  width: calc(100% - 40px);
  margin: 16px 20px;
  padding: 14px 20px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--accent) 0%, #7c7af0 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: all 0.3s var(--spring);
  position: relative;
  overflow: hidden;
}

.generate-btn:active {
  transform: scale(0.96);
  box-shadow: 0 2px 10px var(--accent-glow);
}

.generate-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.2) 0%, transparent 50%);
  pointer-events: none;
}

/* Results Area */
.results-area {
  padding: 20px;
  min-height: 200px;
}

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  margin-bottom: 10px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: var(--bg-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.3s var(--spring);
  animation: slideIn 0.4s var(--spring) both;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.result-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  word-break: break-word;
  padding-right: 12px;
}

.copy-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s var(--spring);
}

.copy-btn:active {
  transform: scale(0.88);
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Tags inside results */
.result-tags {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.tag {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

.tag.accent {
  background: rgba(94, 92, 230, 0.15);
  color: #a5a3f0;
  border-color: rgba(94, 92, 230, 0.3);
}

/* Empty results */
.results-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
}

.results-empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.results-empty p {
  font-size: 15px;
}

/* History Section */
.history-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
}

.history-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--bg-surface);
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.history-item:active {
  background: var(--bg-elevated);
}

/* Back Button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s var(--spring);
}

.back-btn:active {
  transform: scale(0.95);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ============================================
   ANIMATIONS & MICRO-INTERACTIONS
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gen-card, .kofi-card {
  animation: fadeInUp 0.5s var(--ease-out) both;
}

.gen-card:nth-child(1) { animation-delay: 0.05s; }
.gen-card:nth-child(2) { animation-delay: 0.1s; }
.gen-card:nth-child(3) { animation-delay: 0.15s; }
.gen-card:nth-child(4) { animation-delay: 0.2s; }
.gen-card:nth-child(5) { animation-delay: 0.25s; }
.kofi-card:nth-child(6) { animation-delay: 0.3s; }
.gen-card:nth-child(7) { animation-delay: 0.35s; }
.gen-card:nth-child(8) { animation-delay: 0.4s; }
.gen-card:nth-child(9) { animation-delay: 0.45s; }
.gen-card:nth-child(10) { animation-delay: 0.5s; }
.gen-card:nth-child(11) { animation-delay: 0.55s; }

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--glass-border-light);
}

/*
======================================================
===== RESPONSIVE (TABLET+)
======================================================
*/
@media (min-width: 640px) {
  .app-container {
    max-width: 600px;
    padding: 0 24px 48px;
  }

  .hero h1 {
    font-size: 40px;
  }

  .hero p {
    font-size: 17px;
    max-width: 400px;
  }

  .generators-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .gen-card {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
    gap: 12px;
  }

  .gen-card .icon-wrapper {
    width: 56px;
    height: 56px;
    font-size: 28px;
  }

  .gen-card h3 {
    font-size: 16px;
  }

  .gen-card p {
    font-size: 13px;
  }

  .kofi-card {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
    gap: 12px;
  }

  .kofi-card .icon-wrapper {
    width: 56px;
    height: 56px;
    font-size: 28px;
  }

  .kofi-card h3 {
    font-size: 16px;
  }

  .kofi-card p {
    font-size: 13px;
  }

  .generator-header h1 {
    font-size: 36px;
  }

  .toggle-group {
    margin: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .generate-btn {
    width: 100%;
    margin: 16px 0;
  }
}
