:root {
  --teal: #1a6b6b;
  --teal-dark: #0f4747;
  --gold: #c9a227;
  --gold-light: #e5c766;
  --terracotta: #a0522d;
  --brick: #8b3a2b;
  --parchment: #f5ecd7;
  --parchment-dark: #ece0c4;
  --ink: #2c1810;
  --ink-soft: #4a3222;
  --bg1: #14504f;
  --bg2: #1a6b6b;
  --bg3: #7a4a2a;
}

body.dark {
  --teal: #2a8a8a;
  --gold: #d9b644;
  --gold-light: #f0d478;
  --parchment: #2a2018;
  --parchment-dark: #241b13;
  --ink: #f0e4cc;
  --ink-soft: #d4c4a0;
  --bg1: #0a2827;
  --bg2: #0f3a39;
  --bg3: #2a1a10;
}

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

body {
  font-family: 'Vazirmatn', 'Amiri', serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at top, var(--bg2), var(--bg1) 55%, var(--bg3) 130%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.9;
  transition: background 0.5s ease, color 0.3s ease;
}

.app-root {
  position: relative;
  min-height: 100vh;
}
.app-root::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--pattern, url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="60" height="60"%3E%3Cg fill="none" stroke="%23c9a227" stroke-width="0.8" opacity="0.12"%3E%3Cpath d="M30 0 L60 30 L30 60 L0 30 Z"/%3E%3Cpath d="M30 12 L48 30 L30 48 L12 30 Z"/%3E%3Ccircle cx="30" cy="30" r="6"/%3E%3C/g%3E%3C/svg%3E'));
  pointer-events: none;
  z-index: 0;
}

/* ====== سربرگ ====== */
.header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1rem 1rem 1.5rem;
  border-bottom: 3px double var(--gold);
  background: linear-gradient(180deg, rgba(0,0,0,0.15), transparent);
}
.header-top { display: flex; justify-content: flex-start; }
.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid var(--gold);
  background: rgba(0,0,0,0.2);
  color: var(--gold-light);
  font-size: 1.2rem; cursor: pointer;
  transition: transform 0.3s, background 0.3s;
}
.theme-toggle:hover { transform: rotate(30deg) scale(1.1); background: var(--gold); color: var(--ink); }

.app-title {
  font-family: 'Amiri', serif;
  font-size: clamp(2rem, 7vw, 3.4rem);
  font-weight: 700;
  color: var(--gold-light);
  text-shadow: 0 2px 0 var(--brick), 0 0 24px rgba(201,162,39,0.4);
  letter-spacing: 1px;
  margin-top: -0.4rem;
}
.app-subtitle {
  font-family: 'Vazirmatn', serif;
  font-weight: 300;
  color: #e8dcc0;
  font-size: clamp(0.85rem, 3vw, 1.1rem);
  margin-top: 0.4rem;
  opacity: 0.9;
}

.ornament-divider {
  display: flex; align-items: center; justify-content: center;
  gap: 0.6rem; margin: 1rem auto; max-width: 400px;
  color: var(--gold); font-size: 1.1rem;
}
.ornament-divider.small { max-width: 260px; margin: 0.7rem auto; }
.orn-line { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

/* ====== ناوبری ====== */
.nav {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem;
}
.nav-btn {
  font-family: 'Vazirmatn', serif;
  font-size: 0.95rem;
  padding: 0.5rem 1.1rem;
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  background: rgba(0,0,0,0.18);
  color: #f0e4c8;
  cursor: pointer;
  transition: all 0.25s;
}
.nav-btn:hover { background: var(--gold); color: var(--ink); transform: translateY(-2px); }
.nav-active { background: var(--gold); color: var(--ink); box-shadow: 0 0 14px rgba(201,162,39,0.6); }

/* ====== محتوا ====== */
.main {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto; padding: 1.6rem 1rem 2rem;
}

/* بیت روز */
.daily-banner {
  text-align: center;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  max-width: 620px; margin: 0 auto 1.6rem;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.15);
}
.daily-label { color: var(--gold-light); font-size: 0.85rem; letter-spacing: 2px; }
.daily-text {
  font-family: 'Amiri', serif; font-size: clamp(1.1rem, 4vw, 1.5rem);
  color: #fbf3dd; margin-top: 0.3rem;
}
.daily-poet { display: block; color: var(--gold-light); margin-top: 0.4rem; font-size: 0.9rem; }

/* ====== کارت شعر ====== */
.card-wrap { display: flex; justify-content: center; }
.poem-card {
  position: relative;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(160,82,45,0.03) 40px, rgba(160,82,45,0.03) 41px),
    linear-gradient(135deg, var(--parchment), var(--parchment-dark));
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 2.4rem 1.8rem 1.4rem;
  margin: 0 auto 1rem;
  max-width: 620px; width: 100%;
  box-shadow:
    0 0 0 5px rgba(26,107,107,0.35),
    0 0 0 7px var(--gold),
    0 18px 40px rgba(0,0,0,0.35);
  color: var(--ink);
}
.poem-card-big { padding: 3rem 2rem 1.6rem; }

.poem-lines { text-align: center; }
.poem-line {
  font-family: 'Amiri', serif;
  font-size: clamp(1.15rem, 4.5vw, 1.7rem);
  line-height: 2.2;
  color: var(--ink);
  opacity: 0;
  animation: lineReveal 0.6s ease forwards;
}
@keyframes lineReveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cartouche {
  display: block; margin: 1.2rem auto 0;
  font-family: 'Vazirmatn', serif;
  font-size: 0.95rem; font-weight: 600;
  color: var(--teal-dark);
  background: linear-gradient(90deg, transparent, rgba(201,162,39,0.25), transparent);
  border: none; border-top: 1px solid var(--gold); border-bottom: 1px solid var(--gold);
  padding: 0.4rem 1rem; cursor: pointer;
  transition: color 0.2s;
}
body.dark .cartouche { color: var(--gold-light); }
.cartouche:hover { color: var(--brick); }

.poem-tools {
  display: flex; justify-content: center; gap: 0.8rem; margin-top: 0.9rem;
}
.tool-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1.5px solid var(--teal);
  background: rgba(26,107,107,0.08);
  color: var(--teal);
  font-size: 1.3rem; cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.tool-btn:hover { background: var(--teal); color: var(--parchment); transform: scale(1.12); }
.tool-btn.faved { color: var(--brick); border-color: var(--brick); background: rgba(139,58,43,0.12); }

.fade-in { animation: fadeIn 0.4s ease; }
.fade-out { opacity: 0; transform: scale(0.97); transition: all 0.2s; }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }

.next-btn {
  display: block; margin: 1.4rem auto 0;
  font-family: 'Vazirmatn', serif; font-size: 1.05rem; font-weight: 600;
  padding: 0.75rem 2.2rem;
  border: 2px solid var(--gold);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(201,162,39,0.4);
  transition: all 0.25s;
}
.next-btn:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 10px 26px rgba(201,162,39,0.55); }
.next-btn:active { transform: translateY(0); }

/* ====== شاعران ====== */
.search-wrap {
  position: relative; max-width: 480px; margin: 0 auto 0.8rem;
}
.search-input {
  width: 100%;
  font-family: 'Vazirmatn', serif; font-size: 1rem;
  padding: 0.8rem 1.2rem 0.8rem 3rem;
  border: 2px solid var(--gold);
  border-radius: 999px;
  background: var(--parchment);
  color: var(--ink);
  outline: none;
  transition: box-shadow 0.2s;
}
.search-input:focus { box-shadow: 0 0 0 3px rgba(201,162,39,0.35); }
.search-input::placeholder { color: var(--ink-soft); opacity: 0.6; }
.search-icon {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%) rotate(45deg);
  color: var(--teal); font-size: 1.3rem; pointer-events: none;
}

.poets-count { text-align: center; color: var(--gold-light); font-size: 0.9rem; margin-bottom: 1.2rem; }

.poets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.poet-card {
  display: flex; align-items: center; gap: 0.9rem;
  text-align: right;
  background: linear-gradient(135deg, var(--parchment), var(--parchment-dark));
  border: 1.5px solid var(--gold);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}
.poet-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.3), 0 0 16px rgba(201,162,39,0.4);
  border-color: var(--gold-light);
}
.poet-avatar {
  flex-shrink: 0;
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Amiri', serif; font-size: 1.6rem; font-weight: 700;
  color: var(--parchment);
  background: radial-gradient(circle, var(--teal), var(--teal-dark));
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 8px rgba(0,0,0,0.3);
}
.poet-info { flex: 1; min-width: 0; }
.poet-name { font-family: 'Amiri', serif; font-size: 1.2rem; color: var(--ink); }
.poet-era { font-size: 0.82rem; color: var(--ink-soft); }
.poet-poemcount {
  display: inline-block; margin-top: 0.3rem;
  font-size: 0.75rem; color: var(--teal-dark);
  background: rgba(26,107,107,0.12); padding: 0.1rem 0.6rem; border-radius: 999px;
}
body.dark .poet-poemcount { color: var(--gold-light); background: rgba(201,162,39,0.15); }

/* ====== صفحه شاعر ====== */
.back-btn {
  font-family: 'Vazirmatn', serif; font-size: 0.95rem;
  background: none; border: none; color: var(--gold-light);
  cursor: pointer; margin-bottom: 1rem; padding: 0.3rem;
  transition: color 0.2s;
}
.back-btn:hover { color: #fff; }

.poet-header {
  text-align: center;
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 1.6rem 1.4rem;
  max-width: 700px; margin: 0 auto 1.6rem;
}
.poet-avatar-big {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 0.8rem;
  font-family: 'Amiri', serif; font-size: 2.4rem; font-weight: 700;
  color: var(--parchment);
  background: radial-gradient(circle, var(--teal), var(--teal-dark));
  border: 3px solid var(--gold);
  box-shadow: 0 0 20px rgba(201,162,39,0.4);
}
.poet-header-name { font-family: 'Amiri', serif; font-size: 1.9rem; color: var(--gold-light); }
.poet-header-meta { color: #e8dcc0; font-size: 0.9rem; margin: 0.3rem 0 0.8rem; }
.poet-bio { color: #f0e4c8; font-size: 0.98rem; line-height: 2; max-width: 600px; margin: 0 auto; }

.section-title {
  text-align: center; font-family: 'Amiri', serif;
  color: var(--gold-light); font-size: 1.5rem; margin: 1.4rem 0 1.2rem;
}

.poet-poems { display: grid; gap: 1.2rem; }

/* ====== علاقه‌مندی خالی ====== */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: #f0e4c8; }
.empty-flower { font-size: 4rem; color: var(--gold); animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state p { margin: 1rem 0; font-size: 1.1rem; }

/* ====== پاورقی ====== */
.footer {
  position: relative; z-index: 1;
  text-align: center; padding: 1.6rem 1rem 2.2rem;
  border-top: 3px double var(--gold);
  color: #e8dcc0;
}
.footer-quote { font-family: 'Amiri', serif; font-size: 1.15rem; color: var(--gold-light); }
.footer-copy { font-size: 0.8rem; opacity: 0.7; margin: 0.6rem 0; }
.remix-link {
  display: inline-block; margin-top: 0.4rem;
  color: var(--gold); text-decoration: none;
  border: 1px solid var(--gold); border-radius: 999px;
  padding: 0.3rem 1rem; font-size: 0.85rem;
  transition: all 0.2s;
}
.remix-link:hover { background: var(--gold); color: var(--ink); }

/* ====== توست ====== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 100;
  background: var(--teal-dark); color: var(--parchment);
  border: 1.5px solid var(--gold);
  padding: 0.7rem 1.5rem; border-radius: 999px;
  font-family: 'Vazirmatn', serif; font-size: 0.95rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 480px) {
  .poems-grid, .poets-grid { grid-template-columns: 1fr; }
  .poem-card { padding: 2rem 1.2rem 1.2rem; }
}