/* Светлая тема: фон и панели светлые */
:root {
  --bg-main: #c0c4c0;
  --bg-panel: #b0b4b0;
  --border-subtle: #909690;
  --text-main: #1a1a1a;
  --text-muted: #5a5a5a;
  --text-dim: #5a5a5a;
  --square-light: #f0d9b5;
  --square-dark: #946f51;
  --coord-light: #946f51;
  --coord-dark: #f0d9b5;
  --shadow-board: 0 2px 2px 0 rgba(0, 0, 0, 0.08), 0 3px 1px -2px rgba(0, 0, 0, 0.1), 0 1px 5px 0 rgba(0, 0, 0, 0.06);
  --radius-large: 8px;
  --radius-board: 6px;
  --radius-pill: 999px;
  --transition-fast: 0.15s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  padding: 0;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 18px 22px;
  min-width: 0;
}

/* Боковое меню слева: тёмный фон, белый шрифт в названиях и подписях дебютов; две колонки карточек */
.app-sidebar {
  width: 360px;
  min-width: 360px;
  background: #2c2c2e;
  border-right: 1px solid #3a3a3c;
  padding: 16px 0;
}

.sidebar-scroll {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sidebar-mobile-header,
.sidebar-stats,
.sidebar-divider,
.sidebar-free-game {
  display: none;
}

.sidebar-title {
  margin: 0 12px 12px;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.sidebar-nav {
  padding: 0;
}

.sidebar-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 12px 12px;
}

.sidebar-filter-btn {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 500;
  color: #b0b0b0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.sidebar-filter-btn:hover {
  color: #e0e0e0;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.sidebar-filter-btn.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.35);
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sidebar-menu-item {
  margin: 0;
  min-width: 0;
}

.sidebar-details {
  margin: 0;
}

.sidebar-summary {
  padding: 8px 12px;
  font-size: 13px;
  color: #ffffff;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.sidebar-summary::-webkit-details-marker {
  display: none;
}

.sidebar-summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 6px;
  font-size: 10px;
  transition: transform 0.2s ease;
}

.sidebar-details[open] .sidebar-summary::before {
  transform: rotate(90deg);
}

.sidebar-summary:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-debut-description {
  margin: 0 0 6px;
  padding: 0 0 2px;
  font-size: 11px;
  line-height: 1.35;
  color: #ffffff;
  text-align: left;
}

.sidebar-fegatello-block .sidebar-debut-description {
  margin: 4px 0 8px;
  padding: 0;
  text-align: left;
}

/* Карточки дебютов: прямоугольник с рамкой, мини-доска, название, подпись */
.sidebar-menu-item.sidebar-fegatello-block,
.sidebar-menu-item.sidebar-debut-card-block {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
}

.sidebar-fegatello-card,
.sidebar-debut-card {
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-small, 6px);
  padding: 6px;
  margin: 0;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.sidebar-fegatello-title,
.sidebar-debut-title {
  display: block;
  width: 100%;
  margin: 4px 0 0;
  padding: 4px 0;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.sidebar-fegatello-title:hover,
.sidebar-debut-title:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-fegatello-block .sidebar-mini-board-wrap,
.sidebar-debut-card .sidebar-mini-board-wrap {
  padding: 0;
  margin: 0 0 4px;
  border: none;
  margin-left: 0;
  flex-shrink: 0;
}

/* В двух колонках: мини-доска увеличена; отступы слева/справа = 6px (как сверху) */
.sidebar-menu .sidebar-mini-board-wrap {
  width: 100%;
  align-self: stretch;
  flex-shrink: 0;
  margin-left: 0;
  margin-right: 0;
}

.sidebar-menu .sidebar-mini-board {
  width: 100% !important;
  height: 0 !important;
  padding-bottom: 100% !important;
  margin: 0;
  max-width: 100%;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

.sidebar-menu .sidebar-mini-board .minib-sq {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  left: calc(var(--col, 0) * 12.5%);
  top: calc(var(--row, 0) * 12.5%);
  margin: 0;
  aspect-ratio: unset;
}

.sidebar-menu .sidebar-mini-board .minib-sq[data-square="a8"] { --row: 0; --col: 0; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="b8"] { --row: 0; --col: 1; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="c8"] { --row: 0; --col: 2; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="d8"] { --row: 0; --col: 3; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="e8"] { --row: 0; --col: 4; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="f8"] { --row: 0; --col: 5; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="g8"] { --row: 0; --col: 6; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="h8"] { --row: 0; --col: 7; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="a7"] { --row: 1; --col: 0; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="b7"] { --row: 1; --col: 1; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="c7"] { --row: 1; --col: 2; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="d7"] { --row: 1; --col: 3; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="e7"] { --row: 1; --col: 4; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="f7"] { --row: 1; --col: 5; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="g7"] { --row: 1; --col: 6; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="h7"] { --row: 1; --col: 7; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="a6"] { --row: 2; --col: 0; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="b6"] { --row: 2; --col: 1; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="c6"] { --row: 2; --col: 2; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="d6"] { --row: 2; --col: 3; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="e6"] { --row: 2; --col: 4; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="f6"] { --row: 2; --col: 5; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="g6"] { --row: 2; --col: 6; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="h6"] { --row: 2; --col: 7; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="a5"] { --row: 3; --col: 0; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="b5"] { --row: 3; --col: 1; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="c5"] { --row: 3; --col: 2; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="d5"] { --row: 3; --col: 3; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="e5"] { --row: 3; --col: 4; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="f5"] { --row: 3; --col: 5; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="g5"] { --row: 3; --col: 6; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="h5"] { --row: 3; --col: 7; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="a4"] { --row: 4; --col: 0; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="b4"] { --row: 4; --col: 1; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="c4"] { --row: 4; --col: 2; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="d4"] { --row: 4; --col: 3; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="e4"] { --row: 4; --col: 4; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="f4"] { --row: 4; --col: 5; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="g4"] { --row: 4; --col: 6; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="h4"] { --row: 4; --col: 7; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="a3"] { --row: 5; --col: 0; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="b3"] { --row: 5; --col: 1; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="c3"] { --row: 5; --col: 2; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="d3"] { --row: 5; --col: 3; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="e3"] { --row: 5; --col: 4; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="f3"] { --row: 5; --col: 5; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="g3"] { --row: 5; --col: 6; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="h3"] { --row: 5; --col: 7; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="a2"] { --row: 6; --col: 0; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="b2"] { --row: 6; --col: 1; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="c2"] { --row: 6; --col: 2; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="d2"] { --row: 6; --col: 3; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="e2"] { --row: 6; --col: 4; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="f2"] { --row: 6; --col: 5; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="g2"] { --row: 6; --col: 6; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="h2"] { --row: 6; --col: 7; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="a1"] { --row: 7; --col: 0; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="b1"] { --row: 7; --col: 1; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="c1"] { --row: 7; --col: 2; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="d1"] { --row: 7; --col: 3; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="e1"] { --row: 7; --col: 4; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="f1"] { --row: 7; --col: 5; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="g1"] { --row: 7; --col: 6; }
.sidebar-menu .sidebar-mini-board .minib-sq[data-square="h1"] { --row: 7; --col: 7; }

/* Дебюты за чёрных: мини-доска перевёрнута — чёрные снизу, белые сверху (как на Lichess) */
.sidebar-mini-board[data-orientation="black"],
.sidebar-menu .sidebar-mini-board[data-orientation="black"] {
  transform: rotate(180deg);
}

/* Фигуры внутри перевёрнутой доски повернуть на 180° вокруг своей оси, чтобы не были «вверх ногами» (как на Lichess) */
.sidebar-mini-board[data-orientation="black"] .minib-piece,
.sidebar-mini-board[data-orientation="black"] .minib-piece-moving,
.sidebar-menu .sidebar-mini-board[data-orientation="black"] .minib-piece,
.sidebar-menu .sidebar-mini-board[data-orientation="black"] .minib-piece-moving {
  transform: rotate(180deg);
}

.sidebar-submenu--visible {
  display: block;
}

.sidebar-mini-board-wrap {
  padding: 0;
  margin: 0 0 4px;
}

.sidebar-mini-board-title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.sidebar-mini-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 154px;
  height: 154px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
  cursor: default;
}

.sidebar-mini-board .minib-piece-moving {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  transition: left 0.28s ease-out, top 0.28s ease-out;
}

.sidebar-mini-board .minib-sq {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.sidebar-mini-board .minib-piece {
  width: 100%;
  height: 100%;
  display: block;
}

.sidebar-mini-board .minib-sq.light {
  background: var(--board-light, #f0d9b5);
}

.sidebar-mini-board .minib-sq.dark {
  background: var(--board-dark, #b58863);
}

.sidebar-mini-board .minib-piece {
  pointer-events: none;
  user-select: none;
}

/* При раскрытии блока показываем список ловушек */
.sidebar-details[open] .sidebar-submenu {
  display: block;
}

/* Списки ловук под дебютами скрыты из интерфейса (остаются в разметке для последующего вывода) */
.sidebar-debut-card-block .sidebar-submenu,
.sidebar-fegatello-block .sidebar-submenu {
  display: none !important;
}

.sidebar-submenu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0 0 0 12px;
  border-left: 1px solid var(--border-subtle);
  margin-left: 16px;
}

.sidebar-submenu li {
  margin: 0;
}

.sidebar-link {
  display: block;
  padding: 6px 12px;
  font-size: 12px;
  color: #ffffff;
  text-decoration: none;
}

.sidebar-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-link.sidebar-link--active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
  font-weight: 600;
}

.sidebar-link-placeholder {
  cursor: default;
  color: #ffffff;
}
.sidebar-link-placeholder:hover {
  background: transparent;
}

.trap-sources-wrap {
  margin-top: 12px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.trap-sources-title {
  margin: 0 0 6px 0;
  font-size: 11px;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.trap-sources-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.trap-sources-list li {
  margin: 0 0 4px 0;
}

.trap-source-link {
  font-size: 12px;
  color: #ffffff;
  text-decoration: none;
}

.trap-source-link:hover {
  text-decoration: underline;
  color: #ffffff;
}

.app-sidebar .trap-source-link {
  color: #ffffff;
}

.app-content {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-width: 0;
  gap: 16px;
}

.board-wrapper {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
}

.sidebar-free-game {
  margin: 0 12px 12px;
  width: calc(100% - 24px);
}

/* Чат в тёмной теме (в стиле Telegram) */
.chat-panel {
  width: 320px;
  min-width: 320px;
  max-width: 320px;
  height: min(80vmin, 560px);
  max-height: min(80vmin, 560px);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-large);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}

.chat-contact-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-main);
}

.chat-welcome {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 12px;
}

.chat-msg-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}

.chat-msg-wrap-coach {
  align-self: flex-start;
}

.chat-msg-wrap.chat-msg-enter {
  animation: chat-msg-enter 0.28s ease forwards;
}

@keyframes chat-msg-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.chat-avatar-coach {
  background: linear-gradient(135deg, #0088cc 0%, #006699 100%);
  color: #fff;
}

.chat-avatar-coach svg {
  width: 18px;
  height: 18px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.chat-msg-coach {
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
}

.chat-input-wrap {
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-panel);
}

.chat-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  outline: none;
}

.chat-input::placeholder {
  color: var(--text-dim);
}

.chat-input:focus {
  border-color: #0a84ff;
}

.burger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0 8px 0 0;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  color: var(--text-main);
  box-shadow: none;
}

.burger-btn:hover {
  background: transparent;
  opacity: 0.85;
}

.burger-icon {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -7px 0 currentColor, 0 7px 0 currentColor;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-panel);
  border-radius: var(--radius-large);
  padding: 10px 16px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.top-bar-debut-info {
  display: none;
  flex: 1;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding-left: 8px;
}
.top-bar-debut-name {
  font-size: 14px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-bar-move-count {
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.top-bar-user-level {
  display: none;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  font-size: 14px;
  color: var(--text-muted);
}
.top-bar-user-level-label {
  font-size: 14px;
}
.top-bar-user-level-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.top-bar-trap-errors {
  display: none;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  font-size: 14px;
  color: var(--text-muted);
}
.top-bar-trap-errors.is-visible {
  display: flex;
}
.top-bar-trap-errors-label {
  font-size: 14px;
}
.top-bar-trap-errors-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.top-bar-stats-and-fire {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.top-bar-stats-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.strike-fire-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 47px;
  height: 47px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-small, 6px);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}

.strike-fire-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

/* Состояние «день засчитан» отображается картинкой strike-fire-bright.png */
.strike-fire-btn.strike-achieved:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Иконки +30%: 24 → 31px */
.strike-fire-icon {
  display: block;
  width: 31px;
  height: 31px;
}

/* Тусклая иконка: тонкая красная обводка по силуэту (~⅓ px), без лишней тени */
.strike-fire-btn:not(.strike-achieved) .strike-fire-icon {
  filter: drop-shadow(0 0 1.5px #ff1744);
}

/* Яркая иконка: жёлтое свечение до 3px, плавно в прозрачность */
.strike-fire-btn.strike-achieved .strike-fire-icon {
  filter:
    drop-shadow(0 0 1px rgba(255, 235, 100, 0.95))
    drop-shadow(0 0 2px rgba(255, 220, 80, 0.6))
    drop-shadow(0 0 3px rgba(255, 200, 50, 0.25));
}

.strike-fire-tooltip {
  position: absolute;
  right: calc(100% + 10px);
  left: auto;
  top: calc(50% + 90px);
  transform: translateY(-50%);
  width: 280px;
  max-width: min(280px, calc(100vw - 80px));
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-main);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-small, 6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 200;
  text-align: left;
}

.strike-fire-btn:hover .strike-fire-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Окно поверх затемнённого фона в тёмной теме */
.strike-fire-popup {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  max-width: 90vw;
  padding: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-main);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-large);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 301;
  text-align: left;
}

.strike-fire-popup h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--text-main);
}

.strike-fire-popup p {
  margin: 0 0 8px;
  color: var(--text-main);
}

.strike-fire-popup-close {
  display: block;
  margin-top: 12px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  background: var(--border-subtle);
  border: none;
  border-radius: var(--radius-small, 6px);
  color: var(--text-main);
}

.strike-fire-popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #5a9f4c;
  color: #fff;
  font-size: 18px;
}

.brand-title {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 17px;
  color: var(--text-main);
}

.status-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.pill {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill--white::before,
.pill--black::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.pill--white::before {
  background: #f4f4f4;
}

.pill--black::before {
  background: #4a4a4a;
  color: #f5f5f5;
}

.your-turn-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #2d7a3e;
  background: rgba(45, 122, 62, 0.12);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(45, 122, 62, 0.35);
}

.your-turn-indicator.is-visible {
  display: inline-flex;
}

.your-turn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2d7a3e;
  animation: your-turn-pulse 1.2s ease-in-out infinite;
}

@keyframes your-turn-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.15); }
}

.gamification-bar {
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.gamification-bar.is-visible {
  display: inline-flex;
}

.gamification-bar span {
  white-space: nowrap;
}

.gamification-bar .gamification-streak {
  color: #c96a0e;
  font-weight: 600;
}

.gamification-bar .gamification-daily {
  color: #2d7a3e;
  font-weight: 600;
}

.btn-primary {
  border-radius: var(--radius-pill);
  border: none;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: #5a9f4c;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition-fast);
}

.btn-primary:hover {
  background: #4d8c40;
}

.btn-primary:active {
  background: #457a39;
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn-control {
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-panel);
  color: var(--text-main);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.btn-control:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-subtle);
}

.btn-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-control-icon .btn-icon {
  display: none;
}
.btn-control-icon .btn-label {
  display: inline;
}

.chat-next-lesson-wrap {
  margin-top: 8px;
}

.chat-next-lesson-wrap .btn-primary {
  font-size: 13px;
}

.board-frame {
  position: relative;
  padding: 16px;
  border-radius: var(--radius-large);
  background: var(--bg-main);
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
}

.board-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 6px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 4px 0 12px;
  width: 100%;
  max-width: min(80vmin, 560px);
  box-sizing: border-box;
}

/* Шкала оценки Stockfish (вертикальная, как на Lichess) */
.eval-bar {
  width: 14px;
  min-width: 14px;
  height: min(80vmin, 560px);
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 0 var(--radius-board) var(--radius-board) 0;
  margin-left: 2px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.eval-bar-fill {
  position: absolute;
  left: 0;
  right: 0;
  transition: height 0.2s ease;
}

.eval-bar-white {
  bottom: 0;
  background: #f5f5f5;
  height: 50%;
}

.eval-bar-black {
  top: 0;
  background: #989c98;
  height: 50%;
}

.eval-bar-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  font-size: 10px;
  font-weight: bold;
  color: var(--text-main);
  pointer-events: none;
  white-space: nowrap;
}

.board-shadow {
  display: none;
}

.board-error {
  margin: 0;
  padding: 1rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.board {
  position: relative;
  width: min(80vmin, 560px);
  height: min(80vmin, 560px);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border-radius: var(--radius-board);
  overflow: hidden;
  box-shadow: var(--shadow-board);
  container-type: inline-size;
  container-name: board;
}

/* Ориентация за чёрных: доска перевёрнута, пользователь внизу */
.board.board--black {
  transform: rotate(180deg);
}
.board.board--black .square {
  transform: rotate(180deg);
}
/* Фигуры не поворачиваем — как на Lichess остаются читаемыми (короны вверх) */
.board.board--black .piece {
  transform: none;
}
.board.board--black .piece-drag-ghost {
  transform: none;
}
.board.board--black .piece-premove {
  transform: none;
}
.board.board--black .coord {
  transform: none;
}

/* За чёрных: координаты внизу (буквы) и справа (цифры), без поворота — как на Lichess */
.coord-file-flip,
.coord-rank-flip {
  display: none;
}
.board.board--black .coord-file,
.board.board--black .coord-rank {
  display: none;
}
.board.board--black .coord-file-flip,
.board.board--black .coord-rank-flip {
  display: block;
  transform: none;
}
/* За чёрных: буквы внизу слева, цифры справа вверху */
.board.board--black .coord-file-flip {
  left: calc(1cqw - 1px);
  right: auto;
  bottom: calc(0.5cqw - 1px);
  top: auto;
}
.board.board--black .coord-rank-flip {
  right: calc(1cqw - 1px);
  left: auto;
  top: calc(0.5cqw - 1px);
  bottom: auto;
}
.board.board--black .board-shapes-overlay,
.board.board--black .board-shapes-overlay svg {
  transform: rotate(180deg);
}
.board.board--black .board-shapes-overlay {
  width: 100%;
  height: 100%;
}
.board.board--black .board-shapes-overlay svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.board.board--black .board-piece-overlay {
  transform: none;
  width: 100%;
  height: 100%;
}

.board-piece-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

.board-piece-overlay .piece-moving {
  position: absolute;
  transition: left 0.22s ease-out, top 0.22s ease-out;
  z-index: 20;
}

.board.board--black .board-piece-overlay .piece-moving {
  transform: none;
}

.board.board--touch-drag {
  touch-action: none;
}

.board-shapes-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}
.board-shapes-overlay svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.square.light {
  background: var(--square-light);
}

.square.dark {
  background: var(--square-dark);
}

/* 1 — выделенная фигура: разный цвет для светлой и тёмной клетки */
.square.selected.light {
  background-color: rgb(130, 150, 105) !important;
}
.square.selected.dark {
  background-color: rgb(101, 112, 65) !important;
}

/* 2 — последний ход (откуда и куда) */
.square.last-move.light {
  background-color: rgb(204, 209, 105) !important;
}
.square.last-move.dark {
  background-color: rgb(171, 163, 58) !important;
}

/* Автоход (премув): поле «откуда» — светло-синий */
.square.premove-from.light {
  background-color: rgba(100, 149, 237, 0.45) !important;
}
.square.premove-from.dark {
  background-color: rgba(70, 130, 220, 0.5) !important;
}

/* Автоход: поле «куда» — синий фон */
.square.premove-to.light {
  background-color: rgba(65, 105, 225, 0.6) !important;
}
.square.premove-to.dark {
  background-color: rgba(65, 105, 225, 0.7) !important;
}

/* Фигура автохода на поле «куда» — синий фон */
.piece.piece-premove {
  background-color: #4a7fd4 !important;
  border-radius: 50%;
  box-sizing: border-box;
}

/* 4 — поле, доступное для хода: окрашивается только при наведении курсора на эту ячейку */
.square.move-target.light:hover {
  background-color: rgb(174, 176, 136) !important;
}
.square.move-target.dark:hover {
  background-color: rgb(106, 96, 62) !important;
}

/* 3 — кружки возможных ходов */
.square.move-target::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
}
.square.move-target.light::after {
  background: radial-gradient(circle, rgb(204, 209, 105) 19%, transparent calc(20% + 1px));
}
.square.move-target.dark::after {
  background: radial-gradient(circle, rgb(171, 163, 58) 19%, transparent calc(20% + 1px));
}
.square.move-target.capture.light::after {
  background: radial-gradient(circle, transparent 0%, transparent 79%, rgb(204, 209, 105) calc(80% + 1px));
}
.square.move-target.capture.dark::after {
  background: radial-gradient(circle, transparent 0%, transparent 79%, rgb(171, 163, 58) calc(80% + 1px));
}

/* Шах: красный круг 20×20 под королём, круглая красная тень (100% → 80% к 50% размера → 0% у границы) */
.square.king-check::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #c33;
  box-shadow:
    0 0 2px 1px rgba(180, 0, 0, 1),
    0 0 5px 6px rgba(200, 0, 0, 1),
    0 0 15px 14px rgba(220, 0, 0, 1);
  z-index: 0;
  pointer-events: none;
}

.square.king-check .piece {
  z-index: 1;
}

/* Мат: поле короля полностью красное */
.square.king-checkmate {
  background: #a22 !important;
}

.square.king-checkmate .piece {
  z-index: 1;
}

/* Ничья: знак ½ по центру короля, жёлтый с чёрной обводкой */
.square.king-draw::after {
  content: '½';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 42px;
  font-weight: bold;
  color: #ffd700;
  -webkit-text-stroke: 1.5px black;
  text-stroke: 1.5px black;
  text-shadow: 0 0 2px #000, 0 0 4px #000, 1px 1px 2px #000, -1px -1px 2px #000, 1px -1px 2px #000, -1px 1px 2px #000;
  z-index: 2;
  pointer-events: none;
  animation: king-sign-in 0.4s ease-out forwards;
}

/* Победа: знак победителя по центру короля с анимацией */
.square.king-winner::after {
  content: '✓';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 44px;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 0.9);
  z-index: 2;
  pointer-events: none;
  animation: king-sign-in 0.4s ease-out forwards;
}

@keyframes king-sign-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Фигуры: из pieces-inline.js (SVG из папки pieces/), иначе символы Unicode */
.piece {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: transform var(--transition-fast);
  font-size: calc(min(6.8vmin, 58px));
  line-height: 1;
  font-family: 'Segoe UI Symbol', 'DejaVu Sans', sans-serif;
}

.piece.white {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.piece.black {
  color: #1c1c1c;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

.square.selected .piece {
  z-index: 2;
}

/* Только background-color, чтобы не сбрасывать background-image у клона фигуры */
.piece-drag-ghost {
  transition: none;
  background-color: transparent !important;
  box-shadow: none;
  border: none;
  outline: none;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
  cursor: grabbing;
}

.coord {
  position: absolute;
  font-size: calc(1.875cqw - 0.5px);
  font-weight: bold;
  pointer-events: none;
}

/* Буквы (a–h) — в нижнем левом углу поля; цифры (1–8) — в верхнем правом углу поля */
.coord-file {
  left: calc(1cqw - 1px);
  right: auto;
  bottom: calc(0.5cqw - 1px);
  top: auto;
  color: var(--square-dark);
}

.square.dark .coord-file {
  color: var(--square-light);
}

.coord-rank {
  right: calc(1cqw - 1px);
  left: auto;
  top: calc(0.5cqw - 1px);
  bottom: auto;
  color: var(--square-dark);
}

.square.dark .coord-rank {
  color: var(--square-light);
}

/* Оверлей выбора превращения пешки */
.promotion-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.promotion-choice {
  display: flex;
  gap: 12px;
  padding: 20px;
  background: var(--bg-panel);
  border-radius: var(--radius-large);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.promotion-piece {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
  font-size: 48px;
  line-height: 1;
  background: transparent;
  border: none;
}

.promotion-piece:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.08);
}

.promotion-piece:active {
  transform: scale(0.98);
}

.promotion-piece img,
.promotion-piece .piece-char {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.promotion-piece .piece-char {
  font-family: 'Segoe UI Symbol', 'DejaVu Sans', sans-serif;
  font-size: 48px;
  line-height: 1;
}

/* Меню сворачивается в бургер при нехватке ширины */
@media (max-width: 1024px) {
  .burger-btn {
    display: flex;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 101;
    width: 100%;
    min-width: 100%;
    max-width: 100vw;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  .app.sidebar-open .app-sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  }

  .sidebar-overlay {
    display: block;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .app.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-mobile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    flex-shrink: 0;
  }
  .sidebar-close-btn {
    display: flex;
    margin-left: auto;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-small, 6px);
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
  }
  .sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
  }
  .sidebar-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
  }
  .sidebar-brand-name {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
  }
}

/* Чат под доской при узком окне */
@media (max-width: 960px) {
  .app-content {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    flex: 1;
    min-height: 0;
  }

  .board-wrapper {
    width: 100%;
    flex-shrink: 0;
  }

  .chat-panel {
    width: 100%;
    max-width: 400px;
    flex: 1;
    min-height: 220px;
    max-height: none;
    height: auto;
  }
}

@media (max-width: 768px) {
  .app {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
  }
  .top-bar .brand,
  .top-bar .status-panel {
    display: none !important;
  }
  .top-bar {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 12px 12px 8px;
    margin-bottom: 0;
    box-shadow: none;
  }
  .top-bar-debut-info {
    display: flex;
  }
  .top-bar-user-level {
    display: flex;
  }

  .app-sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
  }
  .sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 16px 0 24px;
  }
  .sidebar-mobile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 16px;
    margin-bottom: 8px;
    flex-shrink: 0;
  }
  .sidebar-close-btn {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-small, 6px);
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
  }
  .sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
  }
  .sidebar-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
  }
  .sidebar-logo .logo-knight-cap,
  .sidebar-logo-img {
    flex-shrink: 0;
    display: block;
  }
  .sidebar-logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 50%;
  }
  .sidebar-brand-name {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
  }
  .sidebar-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 16px 12px;
    font-size: 13px;
    color: #ffffff;
  }
  .sidebar-stats strong {
    color: #ffffff;
  }
  .sidebar-version {
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
  }
  .sidebar-divider {
    display: block;
    margin: 0 12px 12px;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
  }
  .sidebar-free-game {
    display: block;
  }
  .app-main {
    padding-left: 0;
    padding-right: 0;
    padding-top: 6px;
    padding-bottom: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .app-content {
    padding-left: 0;
    padding-right: 0;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .chat-panel {
    flex: 1;
    min-height: 220px;
    max-height: none;
    height: auto;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
  }
  .chat-panel .chat-messages {
    flex: 1;
    min-height: 0;
  }
  .chat-panel .chat-input-wrap {
    flex-shrink: 0;
  }
  .board-wrapper {
    width: 100%;
    max-width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    flex-shrink: 0;
  }
  .board-wrapper .eval-bar {
    order: -1;
    width: 100%;
    height: 17px;
    min-height: 17px;
    min-width: 0;
    margin-left: 0;
    margin-bottom: 0;
    border-radius: var(--radius-large) var(--radius-large) 0 0;
    flex-shrink: 0;
  }
  .board-wrapper .eval-bar .eval-bar-label {
    font-size: 11px;
  }
  .board-wrapper .eval-bar.eval-bar--horizontal {
    display: flex;
    flex-direction: row;
  }
  .board-wrapper .eval-bar.eval-bar--horizontal .eval-bar-fill {
    position: relative;
    height: 100%;
    top: 0;
    bottom: auto;
    transition: width 0.2s ease;
  }
  .board-wrapper .eval-bar.eval-bar--horizontal .eval-bar-white {
    left: 0;
    right: auto;
    order: 0;
  }
  .board-wrapper .eval-bar.eval-bar--horizontal .eval-bar-black {
    left: auto;
    right: 0;
    order: 1;
    flex: 1;
  }
  .board-wrapper .eval-bar.eval-bar--horizontal .eval-bar-label {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    order: 0;
  }
  .board-wrapper .board-frame {
    order: 0;
    width: 100%;
    max-width: 100%;
    padding: 0;
    border-radius: 0 0 var(--radius-large) var(--radius-large);
  }
  .board-wrapper .board {
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    aspect-ratio: 1;
  }
  .board-controls .btn-control-icon .btn-icon {
    display: inline;
    font-size: 1.35rem;
    line-height: 1;
    font-weight: 600;
  }
  .board-controls .btn-control-icon .btn-label {
    display: none;
  }
  .board-controls .btn-control {
    padding: 12px 14px;
    min-width: 48px;
    font-size: 1.25rem;
  }
}

.board-control-tooltip {
  position: fixed;
  z-index: 9999;
  padding: 6px 10px;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  max-width: 90vw;
  white-space: normal;
  text-align: center;
}

@media (max-width: 600px) {
  .top-bar {
    padding-inline: 12px;
  }

  .brand-title {
    font-size: 15px;
  }

  .status-panel {
    gap: 6px;
  }

  .pill {
    display: none;
  }

  .board-frame {
    padding: 10px;
  }

  .chat-panel {
    max-width: 100%;
  }
}

