@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* تم مشکی و بورگاندی با طلایی */
:root {
  --bg: #0b0608;
  --bg-2: #170a0e;
  --card: #1e0c12;
  --card-2: #2c1019;
  --line: #55202f;
  --text: #f7ecee;
  --muted: #c8a5ad;
  --gold: #e8b85a;
  --gold-soft: #f3d79a;
  --violet: #e46a86;
  --good: #7fd6a0;
  --bad: #ff8f9a;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  color: var(--text);
  background: radial-gradient(120% 60% at 50% 0%, #5c1426 0%, var(--bg) 60%) fixed, var(--bg);
  min-height: 100vh;
  line-height: 1.9;
  padding: 0 16px 24px;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

.top { display: flex; align-items: center; gap: 12px; padding: 16px 0 8px; }
.logo { width: 52px; height: 52px; border-radius: 50%; box-shadow: 0 0 0 2px var(--gold), 0 0 24px #c2335a66; }
.top h1 { margin: 0; font-size: 22px; color: var(--gold-soft); }
.top > div { flex: 1; }
.back {
  font: inherit; font-size: 14px; font-weight: 700; color: var(--gold-soft); cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px;
  display: flex; align-items: center; gap: 6px;
}
.back:active { border-color: var(--gold); transform: scale(.97); }
.back span { font-size: 16px; line-height: 1; }
.tagline { margin: 0; font-size: 13px; color: var(--muted); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.tile {
  font: inherit; color: inherit; text-align: right; cursor: pointer;
  background: linear-gradient(160deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-radius: 18px; padding: 16px 14px;
  display: flex; flex-direction: column; gap: 2px;
  transition: transform .15s ease, border-color .15s ease;
}
.tile:active { transform: scale(.97); border-color: var(--gold); }
.tile.wide { grid-column: 1 / -1; }
.tile .ico { font-size: 28px; line-height: 1.3; }
.tile b { font-size: 16px; }
.tile small { color: var(--muted); font-size: 12.5px; }
.note { color: var(--muted); font-size: 13px; text-align: center; margin-top: 18px; }

.intro { color: var(--muted); text-align: center; margin: 8px 0 14px; }
.intro p { margin: 0 0 14px; }
.niyat { color: var(--gold-soft); font-size: 15px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

button.primary {
  font: inherit; font-weight: 700; cursor: pointer; border: 0; border-radius: 14px;
  padding: 12px 18px; color: #2a1a05;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  box-shadow: 0 6px 18px #e8b85a33;
}
button.primary:active { transform: translateY(1px); }
button.ghost {
  font: inherit; cursor: pointer; color: var(--gold-soft); background: transparent;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; margin: 14px auto 0; display: block;
}

.panel {
  background: linear-gradient(170deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-radius: 20px; padding: 18px 16px; margin-top: 14px;
  animation: rise .45s ease both;
}
.panel h2 { margin: 0 0 6px; font-size: 18px; color: var(--gold-soft); }
.panel h3 { margin: 16px 0 4px; font-size: 15px; color: var(--violet); }
.panel p { margin: 0; }
.sub { color: var(--muted); font-size: 13px; }
.verdict { font-size: 17px; font-weight: 800; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.verdict.mid { color: var(--gold-soft); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* غزل: هر بیت دو مصراع، با فاصله */
.poem { text-align: center; margin: 12px 0 4px; }
.beit { margin: 0 0 20px; }
.beit span { display: block; }
.arabic { font-size: 18px; line-height: 2.2; text-align: center; margin: 10px 0; }

/* دیوان در حال باز شدن */
.book { width: 120px; height: 86px; margin: 24px auto; position: relative; perspective: 600px; }
.book::before, .book::after {
  content: ""; position: absolute; top: 0; width: 60px; height: 86px; border-radius: 6px;
  background: linear-gradient(160deg, #7a4a1f, #4a2a10); border: 2px solid var(--gold);
}
.book::before { right: 0; transform-origin: left center; animation: flip 1.1s ease-in-out infinite alternate; }
.book::after { left: 0; }
@keyframes flip { from { transform: rotateY(0); } to { transform: rotateY(-160deg); } }

/* میز تاروت و کارت‌ها */
.table { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.card { width: 30%; max-width: 150px; perspective: 900px; cursor: pointer; }
.table.single .card { width: 52%; max-width: 210px; }
.card .inner {
  position: relative; width: 100%; aspect-ratio: 7 / 12;
  transition: transform .7s cubic-bezier(.2,.7,.2,1); transform-style: preserve-3d;
}
.card.open .inner { transform: rotateY(180deg); }
.card .face {
  position: absolute; inset: 0; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  overflow: hidden; border: 2px solid var(--gold);
}
.card .back {
  background:
    radial-gradient(circle at 50% 50%, #f3d79a 0 6%, transparent 7%),
    radial-gradient(circle at 50% 50%, transparent 0 22%, #e8b85a55 23% 24%, transparent 25%),
    repeating-linear-gradient(45deg, #3a0f1c 0 10px, #2a0a14 10px 20px);
  box-shadow: 0 8px 20px #0008;
}
.card .front { transform: rotateY(180deg); background: #fff; }
.card .front img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .front img.reversed { transform: rotate(180deg); }
.card .pos { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.hint { text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }

/* ماه‌های تولد */
.months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.months button {
  font: inherit; color: inherit; cursor: pointer; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center;
}
.months button.on { border-color: var(--gold); background: var(--card-2); }
.months .sign { font-size: 20px; }

/* فهرست فال‌های هر دسته */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  font: inherit; color: inherit; text-align: right; cursor: pointer; display: flex; align-items: center; gap: 12px;
  background: linear-gradient(160deg, var(--card-2), var(--card)); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px 14px;
}
.item:active { border-color: var(--gold); transform: scale(.99); }
.item .ico { font-size: 24px; width: 34px; text-align: center; }
.item b { display: block; font-size: 15px; }
.item small { display: block; color: var(--muted); font-size: 12.5px; }
.out { margin-top: 6px; }
main > .primary, .view > .primary { display: block; margin: 0 auto; }
#view > button.primary { display: block; margin: 4px auto 0; }
button.ghost.inline { margin: 0; }

/* فرم‌ها */
.form { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.form label { color: var(--muted); font-size: 13.5px; }
.form input {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; outline: none;
}
.form input:focus { border-color: var(--gold); }
.form button { margin-top: 6px; }
.form .datefield {
  font: inherit; margin-top: 0; cursor: pointer; text-align: right; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.form .datefield.set { color: var(--text); border-color: #e8b85a80; }

/* تقویم شمسی که از پایین صفحه باز می‌شود */
.picker {
  position: fixed; inset: 0; z-index: 50; background: #000000b3;
  display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease both;
}
.picker .sheet {
  width: 100%; max-width: 480px; background: linear-gradient(170deg, var(--card-2), var(--card));
  border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0;
  padding: 16px 14px calc(14px + env(safe-area-inset-bottom)); animation: rise .25s ease both;
}
.picker-head { display: flex; gap: 8px; align-items: center; }
.picker-head select {
  flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px;
}
.picker-head .nav {
  flex: none; width: 40px; height: 40px; font: inherit; font-size: 22px; line-height: 1; cursor: pointer;
  color: var(--gold-soft); background: transparent; border: 1px solid var(--line); border-radius: 10px;
}
.picker .week, .picker .grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; text-align: center; }
.picker .week { margin: 14px 0 6px; color: var(--muted); font-size: 12.5px; }
.picker .grid button {
  font: inherit; aspect-ratio: 1; max-height: 46px; width: 100%; cursor: pointer; border: 0; border-radius: 10px;
  color: var(--text); background: var(--bg-2);
}
.picker .grid button.on { color: #2a1a05; font-weight: 800; background: linear-gradient(180deg, var(--gold-soft), var(--gold)); }
.picker .ghost { margin-top: 12px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* کارت نمادی (لنورماند، ماهجونگ، سنگ‌ها و ...) */
.card .symbol {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(170deg, #fff8e8, #f1e2bf); color: #3b2a12; padding: 6px; text-align: center;
}
.card .symbol span { font-size: 44px; line-height: 1.2; }
.table.single .card .symbol span { font-size: 72px; }
.card .symbol b { font-size: 13px; line-height: 1.5; }
.table.small .card { width: 22%; }
.table.small .card .symbol span { font-size: 30px; }
.hint .link { font: inherit; color: var(--gold-soft); background: none; border: 0; text-decoration: underline; cursor: pointer; }

/* شمع‌ها */
.candles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 8px 0; }
.candles button {
  height: 120px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 12px;
}
.candles .stick { width: 22px; height: 54px; border-radius: 6px 6px 3px 3px; background: linear-gradient(90deg, #efe2c9, #fff8ea, #e2d0ad); }
.candles .flame {
  width: 16px; height: 26px; margin-bottom: 4px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #fff6c7 0 25%, #ffc24a 45%, #ff7b1f 80%);
  box-shadow: 0 0 18px #ffb23f; animation: flicker 1.4s ease-in-out infinite alternate;
}
.candles button.on { border-color: var(--gold); background: var(--card-2); }
.candles button.on .flame { transform: scale(1.35); box-shadow: 0 0 30px #ffcf6a; }
@keyframes flicker { from { transform: scaleY(1) rotate(-2deg); } to { transform: scaleY(1.12) rotate(2deg); } }

/* فال ابجد */
.sticks { display: flex; justify-content: center; gap: 14px; margin: 10px 0; }
.stick-letter {
  width: 64px; height: 110px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 800; color: #3b2208; background: linear-gradient(90deg, #8a5a2b, #c48a4e, #8a5a2b);
  border: 2px solid var(--gold); transition: transform .3s ease;
}
.stick-letter.on { transform: rotate(-6deg) scale(1.05); color: #fff3d6; }

/* ای چینگ */
.hexagram { display: flex; flex-direction: column; gap: 10px; align-items: center; margin: 12px 0; }
.hexagram .line { display: flex; gap: 14px; width: 170px; animation: rise .35s ease both; }
.hexagram .line span { height: 14px; flex: 1; border-radius: 4px; background: var(--gold); }
.hexagram .line.yang { gap: 0; }

/* تاس */
.dice { display: flex; justify-content: center; gap: 14px; font-size: 64px; line-height: 1; color: var(--gold-soft); margin: 10px 0; }

/* روزهای ماه، ساعت‌ها و امتیاز */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days button {
  font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 0; cursor: pointer;
}
.days button.on { border-color: var(--gold); background: var(--card-2); }
.hours { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.hours div { display: flex; justify-content: space-between; border-bottom: 1px dashed #55202f88; padding: 3px 0; }
.hours span { color: var(--muted); }
.score { text-align: center; margin: 10px 0; }
.score b { display: block; font-size: 44px; color: var(--gold-soft); line-height: 1.3; }
.score span { color: var(--muted); font-size: 13px; }

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 28px; }

@media (min-width: 560px) {
  body { max-width: 560px; margin: 0 auto; }
}
