/* بخش تورنمنت — روی توکن‌های site.css (کپی global.css سایت). */
header.night { border-bottom: 1px solid var(--line); }
header .bar { display: flex; justify-content: space-between; align-items: center; padding-block: 1rem; flex-wrap: wrap; gap: .6rem 1rem; }
header .logo, footer .logo { color: var(--ink); font-weight: 800; letter-spacing: .05em; font-size: 1.15rem; }
header .logo span, footer .logo span { color: var(--gold); }
header nav { display: flex; gap: 1.4rem; flex-wrap: wrap; }
header nav a { color: var(--ink-2); font-size: .9rem; }
header nav a.on, header nav a:hover { color: var(--ink); }
header nav a.accent { color: var(--gold); }
footer.night { border-top: 1px solid var(--line); margin-top: 4rem; padding-block: 2rem 1.5rem; }
footer .inner { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
footer nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
footer nav a { color: var(--ink-2); font-size: .85rem; }

.subbar { display: flex; gap: 1.2rem; align-items: center; justify-content: flex-end; padding-block: .6rem; font-size: .85rem; flex-wrap: wrap; }
.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--gold); font: inherit; cursor: pointer; }
.linkbtn:hover { color: var(--gold-hover); }
main { min-height: 50vh; padding-top: .5rem; }
h1 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }

.flash { padding: .8rem 1rem; border-radius: 6px; margin: .5rem 0 1rem; font-size: .95rem; }
.flash-ok { background: #2e7d5b1a; color: #1f5a41; border: 1px solid #2e7d5b44; }
.flash-err, .err-box { background: #b4442a14; color: #8c2f1b; border: 1px solid #b4442a44; padding: .8rem 1rem; border-radius: 6px; }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .05rem .55rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); vertical-align: middle; white-space: nowrap; }
.badge-live { color: #fff; background: #B4442A; border-color: #B4442A; }
.badge-done { color: var(--ok); border-color: #2e7d5b55; }
.badge-gold { color: var(--gold); border-color: var(--gold-soft); }

.t-head { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: baseline; margin-bottom: .2rem; }
.t-meta { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; color: var(--ink-2); font-size: .9rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.tabs { display: flex; gap: .3rem; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 1rem 0 1.4rem; scrollbar-width: thin; }
.tabs a { padding: .55rem .7rem; color: var(--ink-2); white-space: nowrap; border-bottom: 2px solid transparent; font-size: .95rem; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); font-weight: 700; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1rem 1.5rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.panel h2 { font-size: 1.1rem; margin-bottom: .6rem; }
.champ { text-align: center; padding: 1.4rem 1rem; }
.champ strong { display: block; font-size: 1.4rem; color: var(--gold); }

/* کارت بازی: دو ردیف، هر تیم با گیم‌های خودش — بدون ابهام ترتیب اعداد در راست‌به‌چپ */
.matches { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.match { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .8rem; }
.match-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem .8rem; font-size: .78rem; color: var(--ink-3); margin-bottom: .25rem; }
.match-top .when { color: var(--ink-2); font-weight: 700; }
.side { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .15rem 0; }
.side .nm { overflow-wrap: anywhere; }
.side.win .nm { font-weight: 800; }
.side.win .nm::after { content: ' ✓'; color: var(--ok); }
.cells { display: flex; gap: .25rem; flex-shrink: 0; }
.cells span { min-width: 1.6rem; text-align: center; background: var(--surface-2); border-radius: 4px; font-variant-numeric: tabular-nums; font-size: .9rem; }
.side.win .cells span { background: #2e7d5b1f; font-weight: 700; }
.tbd .nm { color: var(--ink-3); font-style: italic; }
.match-actions { margin-top: .3rem; font-size: .85rem; }

.day { margin: 1.6rem 0 .6rem; font-size: 1.05rem; position: sticky; top: 0; background: var(--bg); padding: .3rem 0; z-index: 1; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .6rem; list-style: none; padding: 0; margin: 0; }

.tbl-wrap { overflow-x: auto; margin-bottom: 1.2rem; }
table.st { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table.st caption { text-align: start; font-weight: 800; padding: .3rem 0 .5rem; font-size: 1.05rem; }
table.st th, table.st td { padding: .45rem .45rem; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.st th { color: var(--ink-3); font-weight: 500; font-size: .78rem; }
table.st td.nm, table.st th.nm { text-align: start; white-space: normal; min-width: 9rem; }
table.st tr.q td { background: #2e7d5b12; }
table.st tr.q td:first-child { border-inline-start: 3px solid var(--ok); }
abbr[title] { text-decoration: none; }
table.st td.pts { font-weight: 800; }

/* براکت: ستون به‌ازای هر دور، از راست به چپ؛ روی موبایل افقی اسکرول می‌شود */
.bracket { display: flex; gap: 1.2rem; overflow-x: auto; padding-bottom: 1rem; align-items: stretch; }
.b-round { display: flex; flex-direction: column; min-width: 14rem; flex: 1; }
.b-round h2 { font-size: .9rem; color: var(--ink-2); text-align: center; margin-bottom: .6rem; }
.b-col { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: .8rem; }

/* فرم‌ها */
form.stack { display: grid; gap: .9rem; max-width: 40rem; }
.field { display: grid; gap: .25rem; }
.field label, fieldset legend { font-size: .88rem; font-weight: 700; }
.hint { font-size: .78rem; color: var(--ink-3); }
input[type=text], input[type=password], input:not([type]), select, textarea {
  font: inherit; font-size: 1rem; padding: .55rem .7rem; border: 1px solid #00000033; border-radius: 6px; background: var(--surface); color: var(--ink); width: 100%; }
textarea { min-height: 7rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem 1rem; margin: 0; display: grid; gap: .8rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .8rem; }
.check { display: flex; gap: .5rem; align-items: center; font-size: .92rem; }
.check input { width: 1.1rem; height: 1.1rem; }
button, .button { font: inherit; font-size: .95rem; padding: .6rem 1.3rem; border-radius: 6px; border: 1px solid var(--ink); background: var(--ink); color: var(--bg); cursor: pointer; font-weight: 700; display: inline-block; }
button:hover, .button:hover { background: var(--gold); border-color: var(--gold); color: #fff; }
button.ghost, .button.ghost { background: transparent; color: var(--ink); border-color: #00000033; font-weight: 500; }
button.ghost:hover { border-color: var(--gold); color: var(--gold); background: transparent; }
button.danger { background: #8c2f1b; border-color: #8c2f1b; }
button.small, .button.small { padding: .3rem .7rem; font-size: .82rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

.score-grid { display: grid; grid-template-columns: minmax(8rem, 1fr) repeat(3, 4.2rem); gap: .5rem; align-items: center; }
.score-grid input { text-align: center; direction: ltr; padding: .5rem .2rem; }
.score-grid .h { font-size: .78rem; color: var(--ink-3); text-align: center; }
.score-grid.pts { grid-template-columns: minmax(8rem, 1fr) 5rem; }

.ent { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.ent li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; padding: .45rem .7rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.ent .seed { width: 3.6rem; text-align: center; padding: .3rem; }
.ent .who { flex: 1; min-width: 10rem; }
.t-list { list-style: none; padding: 0; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.t-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 1rem 1.1rem; }
.t-card h3 { font-size: 1.1rem; margin: .3rem 0; }
.t-card h3 a { color: var(--ink); }
.t-card h3 a::after { content: ''; position: absolute; inset: 0; }
.t-card:hover { border-color: var(--gold-soft); }
details summary { cursor: pointer; font-weight: 700; }
.mt { margin-top: 1.5rem; }
@media (max-width: 36rem) {
  header nav { gap: .9rem; }
  .score-grid { grid-template-columns: minmax(6rem, 1fr) repeat(3, 3.3rem); }
}
select.auto { width: auto; max-width: 100%; }
.mt-s { margin-top: .5rem; }
.w9 { max-width: 9rem; } .w14 { max-width: 14rem; } .w20 { max-width: 20rem; }
.pre { white-space: pre-line; }
/* لینک‌های داخل متن فقط با رنگ متمایز نباشند (WCAG 1.4.1). */
main p a:not(.button), main li > a.small, .t-meta a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
