/* ==========================================================================
   تخته‌نرد پلی — سیستم طراحی
   حال‌وهوا: میز چوبی گردو، عاج گرم، برنج عتیقه، نمد سبز. بازی‌محور و شب‌رنگ.
   ========================================================================== */

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

:root {
  --wood-900: #150d06;
  --wood-800: #1e1309;
  --wood-700: #2a1a0e;
  --wood-600: #3a2413;
  --felt: #10352f;
  --felt-2: #0c2a25;

  --ivory: #f6eeda;
  --ivory-dim: #d9ccb0;
  --muted: #a08f74;

  --brass: #c9a24a;
  --brass-lit: #eccc76;
  --brass-deep: #8a6d27;
  --teal: #3fbfae;
  --teal-deep: #1d7f73;
  --red: #d1614f;
  --green: #52b988;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 30px;

  --sh-1: 0 2px 10px rgba(0, 0, 0, 0.45);
  --sh-2: 0 18px 44px rgba(0, 0, 0, 0.55);
  --ring: 0 0 0 1px rgba(201, 162, 74, 0.35);

  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --fs-xs: 0.78rem;
  --fs-sm: 0.9rem;
  --fs-lg: 1.15rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2.1rem;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Vazirmatn", "Tahoma", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.9;
  color: var(--ivory);
  background:
    radial-gradient(900px 480px at 82% -8%, rgba(201, 162, 74, 0.13), transparent 68%),
    linear-gradient(180deg, #2a1a0e 0%, #1a1108 55%, var(--wood-900) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

h1, h2, h3, h4 { line-height: 1.5; font-weight: 800; margin: 0 0 0.6em; color: var(--ivory); }
h1 { font-size: clamp(1.75rem, 4.6vw, var(--fs-2xl)); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.35rem, 3.4vw, var(--fs-xl)); }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 1.05em; color: var(--ivory-dim); }
ul, ol { color: var(--ivory-dim); padding-inline-start: 1.35em; margin: 0 0 1.1em; }
li { margin-bottom: 0.45em; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brass-lit); text-decoration: none; }
a:hover { color: var(--ivory); }
strong { color: var(--ivory); }
:focus-visible { outline: 3px solid var(--brass-lit); outline-offset: 2px; border-radius: 6px; }
table { border-collapse: collapse; width: 100%; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 1.05rem; }
.section { padding-block: 2.6rem; }
.section-tight { padding-block: 1.6rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.stack > * + * { margin-top: 1rem; }

.skip-link { position: absolute; inset-inline-start: 1rem; top: -60px; background: var(--brass-lit); color: #241b06; padding: 0.6em 1em; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 0.6rem; }

/* ------------------------------------------------------------------ header */
.hdr {
  position: sticky; top: 0; z-index: 60;
  background: linear-gradient(180deg, rgba(21, 13, 6, 0.97), rgba(21, 13, 6, 0.86));
  backdrop-filter: blur(9px);
  border-bottom: 1px solid rgba(201, 162, 74, 0.2);
}
.hdr-in { display: flex; align-items: center; gap: 0.8rem; min-height: 62px; }
.logo { display: flex; align-items: center; gap: 0.55rem; font-weight: 900; font-size: 1.05rem; color: var(--ivory); }
.logo img { width: 34px; height: 34px; }
.logo b { color: var(--brass-lit); font-weight: 900; }
.nav { display: none; margin-inline-start: auto; gap: 0.1rem; }
.nav a { color: var(--ivory-dim); font-size: var(--fs-sm); font-weight: 600; padding: 0.5em 0.7em; border-radius: 9px; }
.nav a:hover, .nav a[aria-current="page"] { background: rgba(255,255,255,0.07); color: var(--ivory); }
.hdr-cta { display: none; }
@media (min-width: 1000px) { .nav { display: flex; } .hdr-cta { display: inline-flex; } .nav-btn { display: none; } }
.nav-btn {
  margin-inline-start: auto; width: 44px; height: 44px; border-radius: 10px;
  background: transparent; border: 1px solid rgba(201,162,74,0.35); color: var(--brass-lit);
  font-size: 1.25rem; cursor: pointer;
}
.mnav { display: none; flex-direction: column; padding: 0.5rem 1.05rem 1rem; border-top: 1px solid rgba(201,162,74,0.15); }
.mnav.open { display: flex; }
.mnav a { color: var(--ivory-dim); padding: 0.62em 0.3em; border-radius: 8px; font-size: 0.95rem; }
.mnav a:hover { background: rgba(255,255,255,0.06); }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 46px; padding: 0.65em 1.35em; border-radius: var(--r-md);
  font-family: inherit; font-size: 1rem; font-weight: 700; cursor: pointer;
  border: 1px solid transparent; transition: filter 0.15s var(--ease), background 0.15s var(--ease), transform 0.12s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--brass-lit), var(--brass-deep)); color: #241b06; box-shadow: var(--ring), 0 8px 20px rgba(0,0,0,0.4); }
.btn-primary:hover { filter: brightness(1.07); color: #241b06; }
.btn-ghost { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.14); color: var(--ivory-dim); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: var(--ivory); }
.btn-teal { background: linear-gradient(180deg, var(--teal), var(--teal-deep)); color: #05211e; }
.btn-teal:hover { filter: brightness(1.07); color: #05211e; }
.btn-lg { min-height: 54px; font-size: var(--fs-lg); padding-inline: 1.9rem; }
.btn-sm { min-height: 38px; font-size: var(--fs-sm); padding: 0.35em 0.85em; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* ------------------------------------------------------------------- cards */
.panel {
  background: linear-gradient(160deg, #24170d, #1a1108);
  border: 1px solid rgba(201, 162, 74, 0.17);
  border-radius: var(--r-lg);
  padding: 1.3rem;
  box-shadow: var(--sh-1);
}
.panel-teal { border-color: rgba(63, 191, 174, 0.3); background: linear-gradient(160deg, rgba(16,53,47,0.75), rgba(12,42,37,0.5)); }
.grid { display: grid; gap: 1rem; }
@media (min-width: 620px) { .g2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 880px) { .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); } }

.eyebrow {
  display: inline-block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.05em;
  color: var(--brass); background: rgba(201,162,74,0.1); border: 1px solid rgba(201,162,74,0.28);
  padding: 0.2em 0.8em; border-radius: 999px; margin-bottom: 0.7rem;
}
.tag { display: inline-flex; align-items: center; gap: 0.3em; font-size: var(--fs-xs); font-weight: 700; padding: 0.2em 0.65em; border-radius: 999px; border: 1px solid rgba(255,255,255,0.14); background: rgba(0,0,0,0.3); color: var(--ivory-dim); }
.tag-pending { color: var(--muted); border-style: dashed; }
.tag-good { color: var(--green); border-color: rgba(82,185,136,0.4); }

/* --------------------------------------------------------------------- hero */
.hero { padding-block: 2.2rem 1.4rem; position: relative; overflow: hidden; }
.hero-grid { display: grid; gap: 1.6rem; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.05fr 0.95fr; } .hero { padding-block: 3.2rem 2rem; } }
.hero h1 { margin-bottom: 0.5rem; }
.hero .lead { font-size: var(--fs-lg); color: var(--ivory); }
.hero-art { border-radius: var(--r-xl); overflow: hidden; border: 1px solid rgba(201,162,74,0.3); box-shadow: var(--sh-2); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }
.hero-stats span { font-size: var(--fs-xs); color: var(--ivory-dim); background: rgba(0,0,0,0.3); border: 1px solid rgba(201,162,74,0.2); border-radius: 999px; padding: 0.25em 0.8em; }

/* -------------------------------------------------------------- breadcrumb */
.crumb { font-size: var(--fs-sm); color: var(--muted); padding-block: 0.9rem 0.2rem; }
.crumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35em; padding: 0; margin: 0; }
.crumb li::after { content: "‹"; margin-inline-start: 0.35em; color: rgba(255,255,255,0.25); }
.crumb li:last-child::after { content: ""; }
.crumb a { color: var(--ivory-dim); }

/* ------------------------------------------------------------- brand cards */
.brand-card {
  display: flex; flex-direction: column; gap: 0.75rem;
  background: linear-gradient(165deg, #251810, #190f08);
  border: 1px solid rgba(201,162,74,0.18); border-radius: var(--r-lg);
  padding: 1.05rem; position: relative;
}
.brand-card .rankpip {
  position: absolute; inset-block-start: -12px; inset-inline-start: 16px;
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #f2dfa9, #a8801f 72%); color: #241b06;
  font-weight: 900; font-size: 0.85rem; border: 2px solid #150d06;
}
.brand-head { display: flex; align-items: center; gap: 0.7rem; }
.brand-logo {
  width: 62px; height: 44px; flex: 0 0 auto; border-radius: 10px; background: #fff;
  display: grid; place-items: center; padding: 4px; overflow: hidden;
}
.brand-logo img { max-height: 36px; width: auto; object-fit: contain; }
.brand-name { font-weight: 800; font-size: 1.02rem; }
.brand-name small { display: block; color: var(--muted); font-weight: 600; font-size: var(--fs-xs); }
.score-big { margin-inline-start: auto; text-align: center; }
.score-big b { display: block; font-size: 1.4rem; color: var(--brass-lit); line-height: 1.2; }
.score-big span { font-size: var(--fs-xs); color: var(--muted); }
.bars { display: grid; gap: 0.4rem; }
.bar-row { display: grid; grid-template-columns: 6.6rem 1fr 2.1rem; align-items: center; gap: 0.5rem; font-size: var(--fs-xs); }
.bar-track { height: 7px; border-radius: 99px; background: rgba(255,255,255,0.08); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brass-deep), var(--brass-lit)); }
.bar-fill.teal { background: linear-gradient(90deg, var(--teal-deep), var(--teal)); }
.bar-row b { text-align: end; color: var(--ivory); }
.bar-row .na { color: var(--muted); font-weight: 600; }
.stars { color: var(--brass-lit); letter-spacing: 0.1em; font-size: 0.95rem; }
.stars .off { color: rgba(255,255,255,0.18); }

/* --------------------------------------------------------------- data table */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid rgba(201,162,74,0.18); }
table.data { min-width: 680px; font-size: var(--fs-sm); background: rgba(0,0,0,0.2); }
table.data th, table.data td { padding: 0.7rem 0.8rem; text-align: start; border-bottom: 1px solid rgba(255,255,255,0.07); }
table.data thead th { background: rgba(201,162,74,0.1); color: var(--brass-lit); font-size: var(--fs-xs); white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td b { color: var(--ivory); }

/* ------------------------------------------------------------------- prose */
.prose { max-width: 74ch; }
.prose h2 { margin-top: 2rem; padding-top: 0.4rem; }
.prose h3 { margin-top: 1.5rem; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose figure { margin: 1.4rem 0; }
.prose figcaption { font-size: var(--fs-xs); color: var(--muted); margin-top: 0.4rem; }
.callout { border-inline-start: 3px solid var(--brass); background: rgba(201,162,74,0.08); border-radius: 0 var(--r-md) var(--r-md) 0; padding: 0.9rem 1.1rem; margin: 1.3rem 0; }
.callout.teal { border-color: var(--teal); background: rgba(63,191,174,0.09); }
.callout p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------- faq */
.faq details { border: 1px solid rgba(201,162,74,0.18); border-radius: var(--r-md); padding: 0.85rem 1rem; background: rgba(0,0,0,0.2); margin-bottom: 0.6rem; }
.faq summary { cursor: pointer; font-weight: 700; color: var(--ivory); list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: inline-start; color: var(--brass); margin-inline-end: 0.5rem; font-weight: 900; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0.7rem 0 0; }

/* ---------------------------------------------------------------- comments */
.review { border: 1px solid rgba(255,255,255,0.09); border-radius: var(--r-md); background: rgba(0,0,0,0.22); padding: 0.9rem 1rem; }
.review-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.35rem; flex-wrap: wrap; }
.review-head b { font-size: 0.95rem; }
.review-head time { font-size: var(--fs-xs); color: var(--muted); margin-inline-start: auto; }
.review p { margin: 0; font-size: var(--fs-sm); }
.review.pending { border-style: dashed; border-color: rgba(201,162,74,0.4); }
.pending-flag { font-size: var(--fs-xs); color: var(--brass); }
.form-grid { display: grid; gap: 0.8rem; }
@media (min-width: 620px) { .form-grid .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; } }
label { display: block; font-size: var(--fs-sm); font-weight: 700; margin-bottom: 0.3rem; color: var(--ivory-dim); }
input, select, textarea {
  width: 100%; font-family: inherit; font-size: 0.95rem; color: var(--ivory);
  background: rgba(0,0,0,0.35); border: 1px solid rgba(201,162,74,0.25);
  border-radius: var(--r-sm); padding: 0.6rem 0.75rem; min-height: 44px;
}
textarea { min-height: 110px; resize: vertical; }
.form-note { font-size: var(--fs-xs); color: var(--muted); }
.form-ok { color: var(--green); font-size: var(--fs-sm); font-weight: 700; }

/* --------------------------------------------------------------- game page */
.game-wrap { margin-block: 1.2rem; }
#game-root { min-height: 480px; }
#game-root.game-loading { display: grid; place-items: center; border: 1px dashed rgba(201,162,74,0.3); border-radius: var(--r-lg); color: var(--muted); }
.rulechips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-block: 1rem; }
.rulechips a { font-size: var(--fs-sm); font-weight: 700; padding: 0.35em 0.9em; border-radius: 999px; border: 1px solid rgba(201,162,74,0.3); color: var(--ivory-dim); background: rgba(0,0,0,0.25); }
.rulechips a:hover { border-color: var(--brass); color: var(--ivory); }

/* --------------------------------------------------------- mini board grid */
.mini-board { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; background: #2a1a0e; padding: 6px; border-radius: 10px; border: 1px solid rgba(201,162,74,0.25); }
.mini-board i { display: block; aspect-ratio: 1 / 2.4; background: linear-gradient(180deg, #e8d7b0, #c9b184); border-radius: 2px; }
.mini-board i:nth-child(even) { background: linear-gradient(180deg, #52301a, #3a2110); }
.mini-board i[data-h]::after, .mini-board i[data-c]::after { content: ""; display: block; width: 72%; margin: 6% auto; aspect-ratio: 1; border-radius: 50%; }
.mini-board i[data-h]::after { background: radial-gradient(circle at 34% 30%, #fff, #cdbf9e 76%); }
.mini-board i[data-c]::after { background: radial-gradient(circle at 34% 30%, #a9702f, #4c2a10 78%); }

/* ------------------------------------------------------------------ footer */
.ftr { margin-top: 3rem; border-top: 1px solid rgba(201,162,74,0.18); background: linear-gradient(180deg, transparent, rgba(0,0,0,0.42)); padding-block: 2.2rem 1.3rem; }
.ftr-grid { display: grid; gap: 1.4rem; }
@media (min-width: 760px) { .ftr-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; } }
.ftr h4 { font-size: var(--fs-sm); color: var(--brass); margin-bottom: 0.7rem; }
.ftr a { display: block; color: var(--ivory-dim); font-size: var(--fs-sm); padding: 0.18em 0; }
.ftr-bottom { margin-top: 1.8rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.08); font-size: var(--fs-xs); color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.05ms !important; }
  html { scroll-behavior: auto; }
}
