:root {
  --bg1: #16211a;
  --bg2: #0c120e;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f2ead8;
  --muted: #b9b09a;
  --accent: #f5b83d;
  --accent-dark: #c98a12;
  --danger: #ef5350;
  --ok: #7cc47f;
  --card-bg: #fdf6e3;
  --card-ink: #2b2416;
}

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

html, body { height: 100%; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, #2a3f2f 0%, transparent 60%),
    linear-gradient(160deg, var(--bg1), var(--bg2));
  min-height: 100vh;
}

#app { max-width: 1360px; margin: 0 auto; padding: 12px 18px 10px; }

:root { --s: clamp(36px, calc((100vh - 245px) / 6.26), 100px); }

#topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 2px 4px 6px; flex-wrap: wrap;
}

#topbar h1 { font-size: 20px; letter-spacing: .5px; }

#status-bar { display: flex; gap: 10px; }

#status-bar span {
  background: var(--panel); border: 1px solid var(--panel-border);
  padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
}

#layout {
  position: relative;
  display: grid; grid-template-columns: 1fr 290px; gap: 16px; align-items: start;
}

#game-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

#players {
  display: flex; flex-direction: column; gap: 8px;
}

.opp {
  background: rgba(255, 255, 255, .04); border: 1px solid var(--pc, var(--panel-border));
  border-radius: 12px; padding: 8px 12px;
  display: flex; align-items: center; gap: 10px;
}
.opp.human { box-shadow: 0 0 0 1px var(--pc, var(--accent)) inset; }
    .opp.gain { animation: gainPulse .7s ease; }
    @keyframes gainPulse {
      30% { box-shadow: 0 0 0 3px var(--pc, var(--accent)); transform: scale(1.03); }
    }
.donut-fall {
  position: fixed; z-index: 90; pointer-events: none;
  font-size: 26px; line-height: 1;
  will-change: transform, opacity;
}
.opp .avatar { font-size: 26px; }
.opp .opp-body { display: flex; flex-direction: column; gap: 2px; }
.opp .opp-name { font-weight: 700; font-size: 14px; }
.opp .opp-stats { font-size: 12px; color: var(--muted); }
.opp .opp-stats b { color: var(--text); }
.opp .opp-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.opp .committed { width: 20px; height: 28px; border-radius: 4px;
  background: repeating-linear-gradient(45deg, #b03a3a 0 3px, #8e2b2b 3px 6px);
  border: 1px solid #d99; animation: pulse 1.2s infinite; }

#table-wrap { display: flex; flex-direction: column; gap: 10px; }

#played-strip {
  min-height: calc(var(--s) + 16px); display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--panel); border: 1px dashed var(--panel-border);
  border-radius: 12px; padding: 6px 12px;
}
.strip-hint { color: var(--muted); font-size: 14px; }

.played-entry {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 8px; border-radius: 10px; transition: opacity .3s;
}
.played-entry .pe-name { font-size: 11px; color: var(--muted); white-space: nowrap; }
.played-entry.active { background: rgba(245, 184, 61, .15); outline: 1px solid var(--accent); }
.played-entry.done { opacity: .38; }

#banner {
  background: rgba(239, 83, 80, .16);
  border: 1px solid var(--danger);
  color: #ffcdd2; font-weight: 700; font-size: 14px;
  border-radius: 10px; padding: 6px 12px; text-align: center;
}
#banner.hidden { display: none; }

#rows { display: flex; flex-direction: column; gap: 7px; }

.row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 5px 10px; min-height: calc(var(--s) + 12px);
  transition: box-shadow .25s, outline-color .25s;
}
.row-score {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; min-width: calc(var(--s) * .62); padding: 4px 8px;
  background: rgba(245, 184, 61, .12); border: 1px solid rgba(245, 184, 61, .45);
  border-radius: 10px;
}
.row-score .rs-num { font-size: calc(var(--s) * .34); font-weight: 800; line-height: 1.05; color: var(--accent); }
.row-score .rs-cow { font-size: calc(var(--s) * .20); line-height: 1; }
.row-cards { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.row.selectable { cursor: pointer; outline: 2px dashed var(--ok); outline-offset: -2px; animation: pulse 1.1s infinite; }
.row.selectable:hover { background: rgba(124, 196, 127, .12); }
.row.flash { box-shadow: 0 0 0 3px var(--accent); }

@keyframes pulse { 50% { outline-color: transparent; } }

.card {
  position: relative; display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: calc(var(--s) * .07);
  background-color: var(--card-bg); color: var(--card-ink);
  background-image: repeating-linear-gradient(-45deg,
    rgba(60, 40, 20, .04) 0 calc(var(--s) * .055),
    transparent calc(var(--s) * .055) calc(var(--s) * .11));
  border-radius: 8px; border: 2px solid #999;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .35);
  user-select: none;
}
.card::before {
  content: '🦝';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--s) * .78); line-height: 1;
  opacity: .09; pointer-events: none;
}
.card > span { position: relative; z-index: 1; }
.card .num { font-weight: 800; line-height: 1; }
.card .cows { line-height: 1; letter-spacing: -1px; }

.card.small { width: calc(var(--s) * .75); height: var(--s); }
.card.small .num { font-size: calc(var(--s) * .25); }
.card.small .cows { font-size: calc(var(--s) * .145); }

.cows.pips {
  position: absolute; inset: calc(var(--s) * .09) calc(var(--s) * .07);
  display: grid; grid-template-columns: repeat(3, auto);
  grid-template-rows: auto 1fr auto;
  column-gap: calc(var(--s) * .055);
  align-items: center; justify-items: center;
  letter-spacing: 0;
}
.card.pipface { overflow: hidden; }
.cows.pips i { font-style: normal; line-height: 1; font-size: calc(var(--s) * .12); }
.card.pipface .num { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.pips5 i:nth-child(1) { grid-area: 1 / 1; }
.pips5 i:nth-child(2) { grid-area: 1 / 3; }
.pips5 i:nth-child(3) { grid-area: 3 / 1; }
.pips5 i:nth-child(4) { grid-area: 3 / 3; }
.pips7 i:nth-child(1) { grid-area: 1 / 1; }
.pips7 i:nth-child(2) { grid-area: 1 / 2; }
.pips7 i:nth-child(3) { grid-area: 1 / 3; }
.pips7 i:nth-child(4) { grid-area: 2 / 1; }
.pips7 i:nth-child(5) { grid-area: 2 / 3; }
.pips7 i:nth-child(6) { grid-area: 3 / 1; }
.pips7 i:nth-child(7) { grid-area: 3 / 3; }

.card.p1 { border-color: #86b97e; background-color: #edf6ea; }
.card.p2 { border-color: #3b82f6; background-color: #e8f1fd; }
.card.p3 { border-color: #f59e0b; background-color: #fdf3df; }
.card.p5 { border-color: #a855f7; background-color: #f4e9fd; }
.card.p7 { border-color: #ef4444; background-color: #ffe9ec; }

.card.just-placed { animation: pop .45s ease; }
@keyframes pop {
  0% { transform: scale(.4) translateY(-18px); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

#hand-area {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 14px; padding: 8px 10px 10px;
}
#hand-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
#hand-header h2 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.turn-timer {
  font-weight: 800; font-size: 14px; color: var(--text);
  background: rgba(255, 255, 255, .08); border: 1px solid var(--panel-border);
  border-radius: 999px; padding: 3px 12px;
}
.turn-timer.low { color: #fff; background: var(--danger); border-color: var(--danger); }
.turn-timer[hidden] { display: none; }

#hand { display: flex; gap: 10px; flex-wrap: wrap; min-height: calc(var(--s) * 1.15 + 10px); }

.hand-card { width: calc(var(--s) * .87); height: calc(var(--s) * 1.15); cursor: default; transition: transform .15s, box-shadow .15s; }
.hand-card .num { font-size: calc(var(--s) * .285); }
.hand-card .cows { font-size: calc(var(--s) * .148); }
.hand-card.pickable { cursor: pointer; }
.hand-card.pickable:hover { transform: translateY(-6px); }
.hand-card.selected {
  transform: translateY(-14px);
  box-shadow: 0 0 0 3px var(--accent), 0 6px 14px rgba(0, 0, 0, .45);
}

.btn {
  font: inherit; font-weight: 700; border: none; border-radius: 10px;
  padding: 10px 22px; cursor: pointer; transition: filter .15s, transform .1s;
}
.btn.primary { background: var(--accent); color: #33230a; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.primary:active:not(:disabled) { transform: scale(.97); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--panel-border); margin-left: 10px; }
.btn.secondary:hover { background: rgba(255, 255, 255, .08); }
.btn.hidden { display: none; }

#sidebar {
  position: absolute; top: 0; bottom: 0; right: 0; width: 290px;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 14px; padding: 12px 14px;
  display: flex; flex-direction: column;
}
#sidebar h2 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
#players { display: flex; flex-direction: column; gap: 8px; }
#chat-box {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--panel-border);
  flex: 1 1 auto; min-height: 140px;
  display: flex; flex-direction: column;
}
#chat-box[hidden] { display: none; }
#chat-log {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 5px;
  font-size: 13px;
  scrollbar-width: none; -ms-overflow-style: none;
}
#chat-log::-webkit-scrollbar { display: none; width: 0; height: 0; }
.chat-msg {
  background: rgba(255, 255, 255, .05); border-radius: 8px;
  padding: 4px 8px; overflow-wrap: anywhere;
}
.chat-msg.mine { background: rgba(245, 184, 61, .14); outline: 1px solid rgba(245, 184, 61, .35); }
.chat-msg .cm-head { color: inherit; font-weight: 700; opacity: .9; }
#chat-form { display: flex; gap: 6px; margin-top: 8px; }
#chat-input {
  flex: 1; min-width: 0; font: inherit; font-size: 13px;
  padding: 7px 10px; border-radius: 8px;
  background: #101812; color: var(--text); border: 1px solid var(--panel-border);
}
.chat-send { padding: 6px 12px; font-size: 14px; }
#chat-box .subtitle { font-size: 13px; opacity: .7; }

#overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(5, 10, 7, .72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#overlay.hidden { display: none; }

.panel {
  position: relative;
  background: linear-gradient(170deg, #233228, #182119);
  border: 1px solid var(--panel-border);
  border-radius: 18px; padding: 28px 32px; max-width: 640px; width: 100%;
  max-height: 90vh; overflow-y: auto; text-align: center;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .55);
  animation: rise .3s ease;
}
@keyframes rise { from { transform: translateY(18px); opacity: 0; } }

.panel h2 { font-size: 26px; margin-bottom: 10px; }
.panel .subtitle { color: var(--muted); margin-bottom: 14px; }
.rules-short { text-align: left; font-size: 14px; line-height: 1.55; color: #ddd5c2;
  background: rgba(255, 255, 255, .05); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; }
.rules-short p + p { margin-top: 8px; }

.bot-picker { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; font-weight: 600; }
.bot-picker select {
  font: inherit; padding: 8px 12px; border-radius: 8px;
  background: #101812; color: var(--text); border: 1px solid var(--panel-border);
}

.score-table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: 15px; }
.score-table th, .score-table td { padding: 8px 10px; text-align: center; }
.score-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.score-table tr { border-top: 1px solid var(--panel-border); }
.score-table td:first-child { text-align: left; font-weight: 700; }
.score-table .pts-round { color: var(--danger); font-weight: 700; }
.score-table .pts-total { font-weight: 800; font-size: 17px; }

.final-title { font-size: 15px; margin-top: 4px; }
.final-title.winner { color: var(--accent); font-weight: 800; }
.final-title.loser { color: var(--danger); font-weight: 700; }

.mp-error { color: #ff8a80; font-weight: 600; min-height: 20px; font-size: 14px; text-align: center; }

.room-code {
  font-size: 44px; font-weight: 900; letter-spacing: 10px;
  background: rgba(245, 184, 61, .12); border: 2px dashed var(--accent);
  color: var(--accent); border-radius: 14px; padding: 10px 24px 10px 34px;
  margin: 0 auto 16px; width: max-content; cursor: pointer; user-select: none;
}
.room-code:hover { background: rgba(245, 184, 61, .22); }

.hidden { display: none !important; }

#exit-btn { position: relative; z-index: 60; }

#auth-block {
  position: fixed; top: 14px; right: 16px; z-index: 40;
  width: 380px; margin: 0;
}
.auth-row { text-align: left; font-size: 13px; color: var(--muted); }
.muted { opacity: .7; }
.auth-providers {
  display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap;
  margin-top: 10px;
}
.auth-providers .btn { padding: 8px 12px; font-size: 14px; }
.auth-link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.auth-link-row input {
  width: 120px; padding: 6px 10px; font-size: 14px;
  border: 1px solid var(--panel-border); border-radius: 8px; background: var(--panel); color: inherit;
}
.auth-providers .sm-btn { padding: 6px 10px; font-size: 13px; }
#auth-form { margin-top: 12px; }
#auth-form .menu-name { max-width: none; margin: 0 0 8px; }
@media (max-width: 660px) {
  #auth-block {
    position: static; width: auto; margin: 0 0 12px;
  }
  .auth-row { text-align: center; }
}

#layout.in-lobby #sidebar,
#layout.in-lobby #hand-area,
#layout.in-lobby #played-strip,
#layout.in-lobby #rows { display: none; }

#lobby-panel { text-align: center; padding: 34px 12px; }
#lobby-panel h2 { margin-bottom: 8px; }
.lobby-actions { text-align: center; margin-top: 14px; }

#menu-screen {
  max-width: 1100px; margin: 20px 0 0; padding: 0 16px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 110px);
}
#menu-screen .menu-rooms { display: flex; flex-direction: column; min-height: 0; }
.menu-top { position: relative; display: flex; align-items: center; margin-bottom: 20px; }
.menu-actions { display: flex; gap: 12px; width: 100%; }
#menu-screen .btn { font-size: 17px; padding: 13px 12px; flex: 1 1 0; }
.icon-btn {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  font-size: 22px; line-height: 1; padding: 8px;
  background: transparent; border: none; cursor: pointer; border-radius: 8px;
}
.icon-btn:hover { background: rgba(255,255,255,.08); }
.my-room-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(245, 184, 61, .1); border: 1px solid var(--accent);
  border-radius: 10px; padding: 11px 14px; margin-bottom: 12px; font-weight: 600; font-size: 16px;
}
.rr-mine { color: var(--accent); font-weight: 700; font-size: 14px; white-space: nowrap; }
.menu-rooms {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 14px; padding: 20px 24px;
}
.menu-name {
  display: flex; flex-direction: column; gap: 6px;
  font-weight: 600; font-size: 15px; color: var(--muted);
  max-width: 340px; margin: 0 auto 8px; text-align: left;
}
.menu-name input {
  font: inherit; padding: 12px 14px; border-radius: 8px;
  background: #101812; color: var(--text); border: 1px solid var(--panel-border);
}
.menu-rooms h2 { margin: 14px 0 12px; text-align: center; font-size: 21px; }
#mp-mybar { flex: 0 0 auto; }
#mp-rooms {
  flex: 1 1 auto; min-height: 120px; overflow-y: auto;
  padding-right: 8px; margin-right: -4px;
  scrollbar-width: thin; scrollbar-color: rgba(245,184,61,.5) transparent;
}
#mp-rooms::-webkit-scrollbar { width: 8px; }
#mp-rooms::-webkit-scrollbar-thumb { background: rgba(245,184,61,.4); border-radius: 8px; }
.net-label { text-align: center; font-weight: 600; margin-bottom: 12px; }
.count-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.count-btn { min-width: 46px; padding: 10px 0; font-size: 16px; }

.room-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.room-table th {
  text-align: left; color: var(--muted); font-size: 14px;
  padding: 8px 12px; border-bottom: 1px solid var(--panel-border);
}
.room-table td { padding: 11px 12px; border-bottom: 1px solid rgba(255,255,255,.05); font-weight: 600; }
.room-table tr:last-child td { border-bottom: none; }
.room-table .rt-action { text-align: right; }
.room-table .rr-join { padding: 8px 20px; font-size: 15px; }
.room-table .rr-group-mine { background: rgba(245, 184, 61, .05); }
.room-table .rr-head { cursor: pointer; }
.room-table .rr-head td { font-weight: 700; }
.room-table .rr-head:hover td { color: var(--accent); }
.rr-caret { display: inline-block; color: var(--muted); font-size: 14px; }
.rt-avg { color: #ffd479; font-weight: 700; white-space: nowrap; }
.room-table .rr-members td { padding: 0 12px 12px; }
.rm-list { display: flex; flex-direction: column; gap: 4px; border-top: 1px dashed rgba(255,255,255,.14); padding-top: 10px; }
.rm-item { display: flex; justify-content: space-between; gap: 14px; color: #9a9ab0; font-size: 15px; font-weight: 600; }
.rm-item.rm-host { color: var(--text); }
.rm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-rating { color: #ffd479; white-space: nowrap; }
.rm-empty { color: var(--muted); font-weight: 600; }

@media (max-width: 980px) {
      #layout { grid-template-columns: 1fr; }
      #sidebar { position: static; width: auto; }
  #chat-box { flex: none; min-height: 160px; max-height: 260px; }
  #chat-log { min-height: 80px; }
}

.auth-stats { flex: 1 1 100%; margin-top: 8px; font-size: 13px; }
.auth-summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none;
}
.auth-summary:hover .auth-name { text-decoration: underline; }
.auth-name {
  font-weight: bold; color: var(--text); font-size: 18px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.auth-rating { color: #ffd479; font-weight: bold; font-size: 18px; white-space: nowrap; }
.auth-caret { color: var(--muted); font-size: 12px; }
.as-line { display: flex; justify-content: space-between; gap: 12px; padding: 1.5px 0; color: #9a9ab0; }
.as-line b { color: #eaeaf2; white-space: nowrap; }
.auth-stats-sub { font-size: 12px; color: #9a9ab0; }
.tops-cols { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.tops-cols > div { flex: 1 1 240px; min-width: 220px; }
.tops-period { margin: 4px 0; }
.tops-card { background: rgba(0,0,0,.15); border-radius: 10px; padding: 6px 12px 2px; margin-bottom: 8px; }
.tops-card h3 { font-size: 14px; margin: 10px 0 2px; }
.tops-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tops-table td { padding: 3px 4px; border-bottom: 1px solid rgba(255,255,255,.06); text-align: left; }
.tops-medal { width: 28px; white-space: nowrap; }
.tops-val { text-align: right !important; color: #ffd479; white-space: nowrap; }
.tops-val small { color: #9a9ab0; }
.tops-you { font-size: 13px; margin-bottom: 6px; color: #9a9ab0; }
.tops-you.me { color: #ffd479; }
.tops-board { max-height: 460px; overflow-y: auto; border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 6px 12px 6px 10px; scrollbar-width: thin; scrollbar-color: #f5b83d rgba(255,255,255,.05); }
.tops-board::-webkit-scrollbar { width: 10px; }
.tops-board::-webkit-scrollbar-track { background: rgba(255,255,255,.04); border-radius: 8px; margin: 4px 0; }
.tops-board::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #ffd479, #d98f1e); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.tops-board::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #ffe4a8, #f5b83d); background-clip: padding-box; }
.tops-tabs { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.tops-tabs .btn { padding: 6px 14px; font-size: 13px; }

/* ===== Обучение: правила ===== */
#tut-rules-wrap { text-align: left; margin-bottom: 16px; }
.tut-x {
  position: absolute; top: 12px; right: 16px; z-index: 1;
  background: rgba(255,255,255,.06); border: 1px solid var(--panel-border);
  color: var(--muted); border-radius: 50%; width: 34px; height: 34px;
  font-size: 16px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.tut-x:hover { background: rgba(255,255,255,.14); color: var(--text); }
.tut-slide { background: rgba(255, 255, 255, .05); border-radius: 12px; padding: 16px 18px; }
.tut-slide.hidden { display: none; }
.tut-slide h3 { font-size: 17px; color: var(--accent); margin-bottom: 8px; }
.tut-body { font-size: 14px; line-height: 1.55; color: #ddd5c2; margin-bottom: 10px; }
.tut-bullets { list-style: none; padding: 0; }
.tut-bullets li { font-size: 14px; line-height: 1.5; color: #b9b09a; padding-left: 22px; position: relative; margin-bottom: 5px; }
.tut-bullets li::before { content: '🍩'; position: absolute; left: 0; top: 1px; font-size: 12px; }
.tut-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tut-nav .btn { margin-left: 0; }
.tut-dots { display: flex; gap: 6px; flex: 1; justify-content: center; }
.tut-dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .2); transition: background .2s; }
.tut-dot.on { background: var(--accent); }
.tut-carddemo { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tut-demo-card { background: var(--card-bg); color: var(--card-ink); border-radius: 8px; padding: 6px 10px; font-weight: 800; font-size: 14px; box-shadow: 0 2px 6px rgba(0,0,0,.35); }

/* ===== Тренажёр: тренер-панель ===== */
#tut-coach {
  width: 100%;
  z-index: 70; background: linear-gradient(170deg, #2a3a2f, #1a231c);
  border: 1px solid var(--accent); border-radius: 16px;
  box-shadow: 0 14px 50px rgba(0,0,0,.6);
  padding: 14px 18px 12px;
}
#tut-coach.tut-read { animation: tutReadGlow 1.6s ease-in-out infinite; }
@keyframes tutReadGlow {
  0%, 100% { border-color: rgba(245, 184, 61, .55); box-shadow: 0 0 0 2px rgba(245,184,61,.12), 0 14px 50px rgba(0,0,0,.6); }
  50% { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(245,184,61,.35), 0 0 26px rgba(245,184,61,.35), 0 14px 50px rgba(0,0,0,.6); }
}
#tut-coach.hidden { display: none; }
.tut-coach-step { font-size: 14px; line-height: 1.55; color: #e8e2d2; margin-bottom: 12px; }
.tut-coach-step b { color: var(--accent); }
.tut-coach-actions { display: flex; align-items: center; gap: 8px; }
.tut-coach-phase { font-size: 12px; color: var(--muted); margin-right: auto; font-weight: 700; letter-spacing: .5px; }

/* подсветка объектов */
.opp.human.tut-target {
  outline: 3px solid var(--accent); outline-offset: 2px;
  border-radius: 12px; animation: tutGlow 0.9s ease-in-out infinite;
  box-shadow: 0 0 0 3px rgba(245, 184, 61, .35);
}
.row.tut-target {
  outline: 3px solid var(--accent); outline-offset: 2px;
  border-radius: 12px; animation: tutGlow 0.9s ease-in-out infinite;
  box-shadow: 0 0 0 3px rgba(245, 184, 61, .35);
}
@keyframes tutGlow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(245, 184, 61, .55); outline-color: rgba(245, 184, 61, .9); }
  50% { box-shadow: 0 0 0 8px rgba(245, 184, 61, .18); }
}
#hand.tut-pick .hand-card:not(.pickable) { opacity: .35; filter: grayscale(.7); }
#hand.tut-pick .hand-card:not(.pickable):hover { transform: none; }
.hand-card.tut-required {
  animation: tutCardPulse 1s ease-in-out infinite;
  transform: translateY(-6px);
}
@keyframes tutCardPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--accent), 0 0 12px rgba(245, 184, 61, .45); transform: translateY(-5px); }
  50% { box-shadow: 0 0 0 7px var(--accent), 0 0 28px rgba(245, 184, 61, .95); transform: translateY(-9px); }
}
#play-btn.tut-pulse {
  animation: tutBtnPulse 0.9s ease-in-out infinite;
}
@keyframes tutBtnPulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--ok, #7cc47f), 0 0 10px rgba(124, 196, 127, .5); }
  50% { box-shadow: 0 0 0 6px var(--ok, #7cc47f), 0 0 24px rgba(124, 196, 127, .9); }
}