/* «Рыцарский турнир» — оформление страницы. Цвета — токены сайта из style.css. */

.tn-igra { position: relative; scroll-margin-top: calc(var(--nav-h) + 8px); }
.tn-igra [hidden] { display: none !important; }
.tn-ekran {
  padding: clamp(16px, 3vw, 30px); border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border-strong);
}
.tn-h { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 14px; }
.tn-podzag { font-family: var(--font-display); font-size: 1.12rem; color: var(--gold-2); margin-bottom: 10px; }
.tn-prim { color: var(--text-3); font-size: .9rem; line-height: 1.5; }
.tn-knopki { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.tn-gerb { display: block; flex: none; filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); }

/* ---------- Застава ---------- */
.tn-zastava { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start;
  background: radial-gradient(120% 90% at 100% 0%, rgba(107,111,174,.16), transparent 60%), var(--surface); }
.tn-zastava p { color: var(--text-2); line-height: 1.65; max-width: 68ch; }
.tn-zastava p + p { margin-top: 10px; }
.tn-nastr { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.tn-flag { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 40px; color: var(--text-2); }
.tn-flag input { width: 20px; height: 20px; accent-color: var(--gold); flex: none; }
.tn-flag small { color: var(--text-3); }
.tn-kariera { margin-top: 12px; font-size: .9rem; color: var(--text-3) !important; }
@media (max-width: 700px) { .tn-zastava { grid-template-columns: 1fr; } }

/* ---------- Шатёр ---------- */
.tn-shater-verh { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
.tn-lestnica { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; list-style: none; margin: 0; padding: 0; flex: 1 1 560px; counter-reset: st; }
.tn-st { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: rgba(255,255,255,.02); min-width: 0; }
.tn-st-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.tn-st-e { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.tn-st-i { font-size: .86rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn-st.is-done { opacity: .6; }
.tn-st.is-done .tn-st-e { color: var(--teal); }
.tn-st.is-tek { border-color: var(--gold); background: linear-gradient(180deg, rgba(232,147,76,.14), rgba(232,147,76,.03)); }
.tn-st.is-tek .tn-st-e { color: var(--gold-2); }
.tn-st.is-tek .tn-st-i { color: var(--text); }
@media (max-width: 760px) {
  .tn-lestnica { flex-basis: 100%; gap: 4px; }
  .tn-st { flex-direction: column; padding: 6px 2px; gap: 4px; text-align: center; }
  .tn-st-i { display: none; }
  .tn-st-e { font-size: .64rem; letter-spacing: .02em; }
}
.tn-slava { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(240,180,111,.35); background: rgba(232,147,76,.08); }
.tn-slava span:first-child { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.tn-slava b { font-variant-numeric: lining-nums; font-family: var(--font-display); font-size: 1.3rem; color: var(--gold-2); }
.tn-lenta { font-size: .78rem; color: var(--rose); border: 1px solid rgba(240,143,176,.4); border-radius: 999px; padding: 2px 8px; }

.tn-scena { display: flex; gap: 16px; align-items: flex-start; margin-top: 18px; padding: 16px; border-radius: var(--radius-sm);
  border: 1px solid rgba(107,111,174,.45); background: rgba(107,111,174,.1); }
.tn-scena[hidden] { display: none; }
.tn-scena-p { width: 88px; height: 88px; border-radius: 50%; flex: none; }
.tn-scena-p[hidden] { display: none; }
.tn-scena-t b { font-family: var(--font-display); font-size: 1.1rem; color: var(--gold-2); }
.tn-scena-t p { color: var(--text-2); line-height: 1.6; margin-top: 4px; }
.tn-scena-v { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tn-scena-v .btn { min-height: 44px; }
.tn-scena-itog { font-style: italic; color: var(--text) !important; }
@media (max-width: 560px) { .tn-scena { flex-direction: column; } .tn-scena-p { width: 64px; height: 64px; } }

.tn-shater-niz { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
@media (max-width: 860px) { .tn-shater-niz { grid-template-columns: 1fr; } }
.tn-karta { display: flex; gap: 16px; padding: 18px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: rgba(0,0,0,.18); }
.tn-karta-g { flex: none; }
.tn-etap { font-size: .74rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.tn-karta h3 { font-size: 1.35rem; margin: 2px 0 8px; }
.tn-karta p { color: var(--text-2); line-height: 1.6; font-size: .95rem; }
.tn-sovet { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--rose); background: rgba(240,143,176,.07); border-radius: 0 8px 8px 0; color: var(--text) !important; }
.tn-sovet[hidden] { display: none; }
.tn-vyzov { margin-top: 10px; font-style: italic; color: var(--text-3) !important; }
@media (max-width: 480px) { .tn-karta { flex-direction: column; gap: 10px; padding: 14px; } }

.tn-lavka { padding: 18px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: rgba(0,0,0,.18); }
.tn-lavka-l { display: flex; flex-direction: column; gap: 10px; }
.tn-tovar { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.tn-tovar-p { width: 44px; height: 44px; border-radius: 50%; }
.tn-tovar-t { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.tn-tovar-t b { font-weight: 600; font-size: .95rem; }
.tn-tovar-t small { color: var(--text-3); font-size: .8rem; }
.tn-pips { color: var(--gold-2); letter-spacing: .2em; font-size: .8rem; }
.tn-tovar .btn { min-height: 44px; white-space: nowrap; }
@media (max-width: 560px) {
  .tn-tovar { grid-template-columns: 44px minmax(0, 1fr); }
  .tn-tovar .btn { grid-column: 2; justify-self: start; }
}

.tn-vyezd { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-end; }
.tn-vyezd .tn-knopki { margin-top: 0; }
.tn-gruppa { border: 0; padding: 0; margin: 0; min-width: 0; }
.tn-gruppa legend { font-size: .74rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; padding: 0; }
.tn-chipy { display: flex; flex-wrap: wrap; gap: 8px; }
.tn-chip { position: relative; display: inline-block; cursor: pointer; }
.tn-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tn-chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: .92rem; transition: border-color .2s, background .2s, color .2s; }
.tn-chip:hover span { background: var(--surface-2); }
.tn-chip input:checked + span { border-color: var(--gold); color: #1a1206; background: linear-gradient(135deg, var(--gold-2), var(--gold)); font-weight: 600; }
.tn-chip input:focus-visible + span { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.tn-chip input:disabled + span { opacity: .4; cursor: not-allowed; }
.tn-gruppa .tn-prim { margin-top: 6px; max-width: 52ch; }

/* ---------- Поединок ---------- */
.tn-boj { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 16px 22px;
  grid-template-areas: "tablo tablo" "holst panel" "zhurnal zhurnal"; }
.tn-tablo { grid-area: tablo; display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.tn-tablo-s { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tn-tablo-prav { justify-content: flex-end; text-align: right; }
.tn-tablo-i { color: var(--text-2); font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tn-tablo b { font-family: var(--font-display); font-size: 2rem; line-height: 1; color: var(--gold-2); font-variant-numeric: lining-nums tabular-nums; }
.tn-tablo-z { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); text-align: center; }
.tn-holst-obl { grid-area: holst; min-width: 0; }
.tn-holst, .tn-boj, .tn-panel { scroll-margin-top: calc(var(--nav-h) + 10px); }
.tn-skachka-info { color: var(--text-2); line-height: 1.6; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px dashed var(--border-strong); }
@media (max-width: 900px) { .tn-skachka-info { display: none; } }
.tn-holst { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: #120e1c; box-shadow: var(--shadow); cursor: default; }
.tn-holst-skachka { touch-action: none; cursor: crosshair; }
.tn-udar { display: block; width: 100%; margin-top: 10px; min-height: 64px; border-radius: var(--radius-sm); border: 0;
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; letter-spacing: .04em; color: #1a1206;
  background: linear-gradient(135deg, var(--gold-2), var(--gold)); box-shadow: 0 10px 30px rgba(232,147,76,.3);
  touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.tn-udar[hidden] { display: none; }
.tn-udar:disabled { opacity: .55; }
.tn-udar:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.tn-panel { grid-area: panel; min-width: 0; }
.tn-vybor[hidden], .tn-rez[hidden] { display: none; }
.tn-primeta { font-style: italic; color: var(--text); line-height: 1.55; padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(107,111,174,.12); border: 1px solid rgba(107,111,174,.35); margin-bottom: 14px; }
.tn-vybor .tn-gruppa + .tn-gruppa { margin-top: 12px; }
.tn-varianty { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tn-var { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; padding: 8px 6px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); text-align: center; line-height: 1.2;
  transition: border-color .2s, background .2s; }
.tn-var b { font-weight: 600; font-size: .95rem; }
.tn-var small { font-size: .74rem; color: var(--text-3); }
.tn-var:hover { background: var(--surface-2); }
.tn-var[aria-pressed="true"] { border-color: var(--gold); background: linear-gradient(180deg, rgba(232,147,76,.2), rgba(232,147,76,.05)); box-shadow: 0 0 0 1px var(--gold) inset; }
.tn-var[aria-pressed="true"] small { color: var(--gold-2); }
.tn-var:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.tn-rez-t { color: var(--text); line-height: 1.6; }
.tn-rez-p { color: var(--gold-2); margin-top: 8px; line-height: 1.5; font-size: .95rem; }
.tn-zhurnal-obl { grid-area: zhurnal; min-width: 0; }
.tn-zhurnal { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tn-zhurnal th, .tn-zhurnal td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tn-zhurnal thead th { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.tn-zhurnal tbody th { color: var(--text-3); width: 2.5em; }
.tn-zhurnal td { color: var(--text-2); }
.tn-zhurnal td.tn-ugadal { color: var(--teal); }
.tn-pusto { color: var(--text-3) !important; font-style: italic; }
@media (max-width: 900px) {
  .tn-boj { grid-template-columns: minmax(0, 1fr); grid-template-areas: "tablo" "holst" "panel" "zhurnal"; }
}
@media (max-width: 560px) {
  .tn-ekran.tn-boj { padding: 10px; }
  .tn-tablo b { font-size: 1.6rem; }
  .tn-tablo-i { font-size: .8rem; }
  .tn-tablo-z { font-size: .64rem; letter-spacing: .06em; }
  .tn-zhurnal { font-size: .78rem; }
  .tn-zhurnal th, .tn-zhurnal td { padding: 6px 4px; }
}

/* ---------- Итог ---------- */
.tn-itog { text-align: center; background: radial-gradient(90% 80% at 50% 0%, rgba(232,147,76,.14), transparent 70%), var(--surface); }
.tn-itog p { color: var(--text-2); line-height: 1.65; max-width: 60ch; margin: 0 auto; }
.tn-itog-m { margin-top: 10px !important; color: var(--gold-2) !important; }
.tn-itog .tn-knopki { justify-content: center; }
.tn-itog [data-koshel] { margin-top: 16px; }

[data-koshel] { max-width: 100%; }

/* ---------- Правила ---------- */
.tn-pravila { margin-top: 28px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.tn-pravila[open] { border-color: var(--border-strong); }
.tn-pravila summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 22px; font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; }
.tn-pravila summary::-webkit-details-marker { display: none; }
.tn-pravila summary svg { width: 20px; height: 20px; color: var(--text-3); transition: transform .25s; }
.tn-pravila[open] summary svg { transform: rotate(180deg); color: var(--gold); }
.tn-pravila summary:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; border-radius: var(--radius-sm); }
.tn-pravila-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; padding: 0 22px 24px; }
@media (max-width: 760px) { .tn-pravila-in { grid-template-columns: 1fr; padding: 0 16px 20px; } }
.tn-pravila-in h3 { font-family: var(--font-display); color: var(--gold-2); font-size: 1.08rem; margin: 16px 0 4px; }
.tn-pravila-in > div > h3:first-child { margin-top: 0; }
.tn-pravila-in p { color: var(--text-2); line-height: 1.6; }
.tn-pravila-in p + p { margin-top: 8px; }
.tn-tablica { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .86rem; }
.tn-tablica caption { text-align: left; color: var(--text-3); font-size: .8rem; margin-bottom: 6px; }
.tn-tablica th, .tn-tablica td { padding: 7px 6px; border: 1px solid var(--border); text-align: center; }
.tn-tablica thead th { color: var(--text-3); font-weight: 600; font-size: .78rem; }
.tn-tablica tbody th { color: var(--text); font-weight: 600; text-align: left; }
.tn-tablica td { color: var(--text-2); }
.tn-tablica .tn-p { color: var(--teal); font-weight: 600; }
.tn-tablica .tn-m { color: #ffb8a8; }
kbd { font: 600 12px/1 var(--font-body); padding: 3px 7px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .tn-var, .tn-chip span, .tn-pravila summary svg { transition: none; }
}
