/* ===========================
   RESET & BASE
   =========================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --purple: #7C6FE8;
  --purple-light: #9d92f0;
  --purple-dark: #5a4fd4;
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.65);
  --text-muted: rgba(255,255,255,0.4);
  --bg-dark: #0e0e18;
  --card-bg: #16161f;
  --card-border: rgba(255,255,255,0.08);
  --navbar-h: 52px;
}

html, body {
  height: 100%;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===========================
   NAVBAR
   =========================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: var(--navbar-h);
  background: transparent;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.logo-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  backdrop-filter: blur(8px);
}

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

.btn-icon:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.25);
}

.btn-primary {
  padding: 7px 18px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  backdrop-filter: blur(8px);
  font-family: inherit;
}

.btn-primary:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.35);
}

/* ===========================
   HERO
   =========================== */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 20px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('background.png');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 18, 0.47) 0%,
    rgba(10, 10, 18, 0.22) 20%,
    rgba(10, 10, 18, 0.27) 45%,
    rgba(10, 10, 18, 0.97) 72%,
    rgba(10, 10, 18, 1) 100%
  );
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding-top: var(--navbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* ===========================
   HERO TITLE
   =========================== */
.hero-title {
  margin-top: 30px;
  text-align: center;
  font-size: 34px;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-shadow: 0 2px 20px rgba(0,0,0,0.6);
}

.hero-title-accent {
  color: var(--purple-light);
}

.hero-subtitle {
  margin-top: 12px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}

/* ===========================
   SEARCH BAR
   =========================== */
.search-container {
  margin-top: 20px;
  width: 100%;
  max-width: 560px;
  padding: 0 20px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: rgba(18, 18, 28, 0.7);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  overflow: hidden;
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  transition: border-color 0.2s;
}

.search-bar:focus-within {
  border-color: rgba(124, 111, 232, 0.5);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  padding: 12px 16px;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  margin: 4px;
  border-radius: 8px;
  border: none;
  background: var(--purple);
  color: white;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.search-btn svg {
  width: 14px;
  height: 14px;
}

.search-btn:hover {
  background: var(--purple-dark);
}

.search-btn:active {
  transform: scale(0.97);
}

/* ===========================
   TRY SECTION
   =========================== */
.try-section {
  margin-top: 18px;
  width: 100%;
  max-width: 1160px;
  padding: 0 20px;
}

.try-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.try-star {
  width: 14px;
  height: 14px;
}

/* ===========================
   CARDS GRID
   =========================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.story-card {
  background: rgba(16, 16, 26, 0.82);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  backdrop-filter: blur(8px);
}

.story-card:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 111, 232, 0.3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(124, 111, 232, 0.1);
}

.card-image {
  width: 100%;
  aspect-ratio: 3/2;
  overflow: hidden;
  position: relative;
  background: #0d0d18;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.story-card:hover .card-image img {
  transform: scale(1.04);
}

.card-image-placeholder {
  position: relative;
}

.card-placeholder-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-body {
  padding: 10px 12px 10px;
}

.card-text-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
}

.card-title {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

.card-bookmark {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.card-bookmark svg {
  width: 14px;
  height: 14px;
}

.card-bookmark:hover {
  color: var(--purple-light);
  background: rgba(124, 111, 232, 0.1);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.meta-read {
  color: var(--text-muted);
}

.meta-audio {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.meta-audio svg {
  width: 13px;
  height: 13px;
}

/* ===========================
   AUDIO BANNER
   =========================== */
.audio-banner {
  max-width: 70%;
  margin: 0 auto;
  background: rgba(14, 14, 22, 1);
  padding: 0 20px 16px;
}

.audio-banner-inner {
  max-width: 100%;
  margin: 0 auto;
  background: rgba(20, 20, 31, 0.9); /* Darkened by 10% */
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.audio-icon-wrap svg {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.audio-text {
  flex-shrink: 0;
}

.audio-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.audio-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.audio-wave {
  flex: 1;
  height: 40px;
  overflow: hidden;
}

.audio-wave svg {
  width: 100%;
  height: 40px;
}

.wave-line {
  stroke: #7C6FE8;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.35;
}

.wave-line.active {
  opacity: 0.85;
  stroke: #9d92f0;
  animation: wavePulse 1.8s ease-in-out infinite alternate;
}

@keyframes wavePulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* ===========================
   FEATURES
   =========================== */
.features {
  background: rgba(14, 14, 22, 1);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 20px 28px;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 0 24px 0 0;
}

.feature-item:last-child {
  padding-right: 0;
}

.feature-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-icon svg {
  width: 40px;
  height: 40px;
}

.feature-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.feature-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(124,111,232,0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(124,111,232,0.5);
}

/* ===========================
   FOOTER
   =========================== */
.app-footer {
  width: 100%;
  height: 80px;
  background: transparent;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 40px;
}

.app-footer-inner {
  width: 100%;
  max-width: 1160px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.35);
}

.footer-left {
  flex-shrink: 0;
}

.footer-center {
  text-align: center;
  max-width: 600px;
  line-height: 1.4;
  font-size: 10.5px;
}

.footer-right {
  flex-shrink: 0;
}

/* ===========================
   AUTH MODAL & DROPDOWN
   =========================== */
.hidden { display: none !important; }

.auth-modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.auth-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.auth-modal-content {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 40px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.auth-modal-overlay.active .auth-modal-content {
  transform: translateY(0);
}

.auth-modal-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #fff;
}
.auth-modal-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  line-height: 1.5;
  margin-bottom: 24px;
}
.auth-modal-btn {
  display: block;
  width: 100%;
  background: #2AABEE;
  color: #fff;
  text-decoration: none;
  padding: 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.2s ease;
}
.auth-modal-btn:hover {
  background: #2298D4;
}

/* User Menu */
.user-menu {
  position: relative;
  display: inline-block;
}
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #7C6FE8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.1);
}
.user-dropdown {
  position: absolute;
  top: 50px;
  right: 0;
  background: rgba(30, 30, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  min-width: 180px;
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  overflow: hidden;
}
.user-menu.active .user-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.dropdown-item {
  display: block;
  padding: 12px 16px;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s ease;
}
.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 0;
}

/* ===========================
   LOADING & RESULT SCREENS
   =========================== */
.loading-screen {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: #0e0e18;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.spinner {
  width: 50px; height: 50px;
  border: 4px solid rgba(124, 111, 232, 0.2);
  border-top-color: #7C6FE8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
.loading-text {
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  opacity: 0.8;
  transition: opacity 0.3s;
}

.result-screen {
  position: absolute;
  top: 0; left: 0; width: 100%; min-height: 100%;
  background: #0e0e18;
  z-index: 500;
  padding: 100px 20px 80px;
  display: flex;
  justify-content: center;
}
.result-container {
  width: 100%;
  max-width: 800px;
}
.btn-back {
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 15px; cursor: pointer; margin-bottom: 30px;
  transition: color 0.2s;
}
.btn-back:hover { color: #fff; }
.result-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 40px;
}
.result-title {
  font-size: 40px; font-weight: 700; line-height: 1.2;
}
.btn-voice {
  align-self: flex-start;
  background: rgba(124, 111, 232, 0.1);
  color: #7C6FE8; border: 1px solid rgba(124, 111, 232, 0.3);
  padding: 10px 20px; border-radius: 30px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  transition: all 0.2s;
}
.btn-voice:hover {
  background: rgba(124, 111, 232, 0.2);
}
.result-content {
  font-size: 18px; line-height: 1.8; color: rgba(255,255,255,0.85);
}
.result-content p { margin-bottom: 24px; }
.result-content h2, .result-content h3 { margin: 40px 0 20px; color: #fff; }
.result-image {
  width: 100%; border-radius: 16px; margin: 30px 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

