/* Компоненты интерфейса. Все классы с префиксом pl- , чтобы не пересекаться
   со стилями перенесённого просмотрщика (assets/styles/viewer.css). */

/* --- Кнопки --- */

.pl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-md);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease);
}

/* Акцент закреплён за выбранным состоянием, а не за наведением: иначе на
   плотном экране половина строк подсвечивается «важным» цветом. */
.pl-btn:hover:not(:disabled) {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
}

/* Мышь не требует 44 px: на десктопе панель управления становится плотнее,
   на тач-экранах размер цели сохраняется. */
@media (pointer: fine) {
  .pl-btn { min-height: 32px; }
  .pl-btn-sm { min-height: 26px; }
  .pl-icon-btn { width: 32px; height: 32px; }
  .pl-input,
  .pl-select { min-height: 32px; }
  .pl-segmented button { min-height: 28px; }
}

.pl-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pl-btn.is-busy,
.pl-btn:disabled.is-busy {
  pointer-events: none;
  opacity: 1;
  cursor: wait;
}

.pl-btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: pl-spin calc(var(--motion-slow) * 2) linear infinite;
  flex-shrink: 0;
}

@keyframes pl-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .pl-btn-spinner {
    animation: none;
    border-right-color: currentColor;
    opacity: 0.5;
  }
}

.pl-btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-contrast);
  font-weight: 600;
}

.pl-btn-primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.pl-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-muted);
}

.pl-btn-ghost:hover:not(:disabled) {
  background: var(--color-surface-raised);
  color: var(--color-text);
}

.pl-btn-danger {
  border-color: var(--color-danger);
  color: var(--color-danger);
  background: transparent;
}

.pl-btn-danger:hover:not(:disabled) {
  background: var(--color-danger-soft);
}

.pl-btn-sm {
  min-height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
}

.pl-btn-block {
  width: 100%;
}

.pl-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

a.pl-icon-btn {
  text-decoration: none;
  color: inherit;
}

.pl-icon-btn:hover {
  background: var(--color-surface-raised);
  color: var(--color-text);
}

.pl-icon-btn.is-reviewed {
  color: var(--color-accent);
}

.pl-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pl-folder-menu {
  position: relative;
}

.pl-folder-menu .pl-popover {
  min-width: 280px;
  max-width: min(360px, calc(100vw - 2rem));
}

.pl-folder-menu .pl-icon-btn.is-on {
  color: var(--color-text);
}

.pl-folder-slot {
  padding: var(--space-2);
}

.pl-folder-slot + .pl-folder-slot {
  border-top: 1px solid var(--color-border);
}

.pl-folder-slot-label {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.pl-folder-slot-name {
  margin: 0 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  word-break: break-word;
}

.pl-folder-hint {
  margin: 0 0 var(--space-2);
  padding: 0 var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.pl-folder-manual {
  margin: 0;
  align-self: center;
  font-size: var(--text-sm);
}

/* --- Сегментированный контрол --- */

.pl-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
}

.pl-segmented button {
  min-height: 36px;
  padding: 0 var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}

.pl-segmented button.is-active {
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--color-border-strong);
}

.pl-segmented button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* --- Панели --- */

.pl-card {
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.pl-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.pl-card-title {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
}

/* Показатель — не карточка, а колонка сводки: вместо рамки его отделяет
   вертикальная линия. Так десяток метрик читается как одна таблица. */
.pl-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border-left: 1px solid var(--color-border);
}

.pl-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pl-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
}

.pl-stat-delta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.pl-stat-delta.is-up {
  color: var(--color-success);
}

.pl-stat-delta.is-down {
  color: var(--color-danger);
}

.pl-stat-value.is-up {
  color: var(--color-success);
}

.pl-stat-value.is-down {
  color: var(--color-danger);
}

.pl-stat.is-unreliable .pl-stat-value {
  opacity: 0.55;
}

/* --- Бейджи и чипы --- */

.pl-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
}

.pl-badge-success { background: var(--color-success-soft); color: var(--color-success); }
.pl-badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.pl-badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.pl-badge-accent { background: var(--color-accent-soft); color: var(--color-accent-text); }

/* --- Формы --- */

.pl-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.pl-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.pl-input,
.pl-select {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-md);
}

.pl-input:focus,
.pl-select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
  outline: none;
}

.pl-select,
select.pl-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: calc(var(--space-3) + 14px);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
    linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) calc(50% - 2px),
    calc(100% - 9px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.pl-input[type="search"],
.pl-input[type="number"] {
  appearance: none;
}

.pl-input[type="number"]::-webkit-inner-spin-button,
.pl-input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
}

.pl-input[type="search"]::-webkit-search-decoration,
.pl-input[type="search"]::-webkit-search-cancel-button,
.pl-input[type="search"]::-webkit-search-results-button {
  appearance: none;
}

.pl-input[type="date"],
.pl-input[type="time"] {
  font-variant-numeric: tabular-nums;
}

.pl-input[type="date"]::-webkit-calendar-picker-indicator,
.pl-input[type="time"]::-webkit-calendar-picker-indicator {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  opacity: 0.7;
  filter: invert(1) brightness(1.4);
}

[data-theme="light"] .pl-input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] .pl-input[type="time"]::-webkit-calendar-picker-indicator {
  filter: none;
  opacity: 0.55;
}

.pl-date {
  display: grid;
  gap: var(--space-2);
}

.pl-date-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.pl-date-trigger::after,
.pl-choice-trigger::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--color-text-muted);
  border-bottom: 1.5px solid var(--color-text-muted);
  transform: rotate(45deg);
  margin-top: -4px;
}

.pl-choice {
  position: relative;
  min-width: 0;
}

.pl-choice-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.pl-choice-pop {
  position: absolute;
  z-index: var(--z-sticky);
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 100%;
  padding: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
}

.pl-choice-option {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
}

.pl-choice-option:hover {
  background: var(--color-surface);
}

.pl-choice-option.is-on {
  background: var(--color-accent-soft);
  color: var(--color-text);
}

.pl-date-pop {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
}

.pl-date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.pl-date-month {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
}

.pl-date-nav .pl-icon-btn {
  width: 32px;
  height: 32px;
}

.pl-date-nav .pl-icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pl-date-week,
.pl-date-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}

.pl-date-week span,
.pl-date-day {
  display: grid;
  place-items: center;
  min-height: 32px;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}

.pl-date-week span {
  color: var(--color-text-faint);
}

.pl-date-day {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
}

.pl-date-day:hover {
  background: var(--color-surface);
  border-color: var(--color-border);
}

.pl-date-day.is-out {
  color: var(--color-text-faint);
}

.pl-date-day.is-on {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-text);
}

.pl-date-day.is-today:not(.is-on) {
  box-shadow: inset 0 0 0 1px var(--color-border-strong);
}

.pl-input-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.pl-input-row .pl-input {
  flex: 1 1 200px;
  width: auto;
}

.pl-textarea {
  width: 100%;
  min-height: 96px;
  padding: var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-md);
  resize: vertical;
}

.pl-textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
  outline: none;
}

.pl-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.pl-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pl-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
}

.pl-chip:has(input:checked),
.pl-chip.is-on {
  border-color: var(--color-accent);
  background: var(--color-surface);
  color: var(--color-text);
}

.pl-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.pl-coach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

.pl-coach-editor .pl-coach-tile {
  max-width: 960px;
}

.pl-coach-tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.pl-coach-tile.is-editable {
  padding: var(--space-5);
  gap: var(--space-5);
}

.pl-coach-tile-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.pl-coach-tile-avatar {
  width: 56px;
  height: 56px;
  font-size: var(--text-xl);
}

.pl-coach-tile-identity {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
}

.pl-coach-tile-name,
.pl-coach-inline-name {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: var(--line-tight);
}

.pl-coach-tile-headline,
.pl-coach-inline-headline {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.pl-chip.is-static {
  cursor: default;
  border-color: var(--color-border-strong);
  background: var(--color-surface-raised);
  color: var(--color-text);
}

.pl-chip.is-unreliable {
  color: var(--color-text-muted);
}

.pl-opp-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.pl-opp-pop {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
}

.pl-opp-pop-name {
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
}

.pl-coach-tile .pl-chip {
  position: relative;
}

.pl-coach-tile .pl-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.pl-coach-exp {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.pl-coach-inline-exp {
  width: 4ch;
  text-align: right;
}

.pl-coach-tile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.pl-coach-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  padding-left: var(--space-3);
  border-left: 1px solid var(--color-border);
}

.pl-coach-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.pl-coach-stat-value,
.pl-coach-inline-stat {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
}

.pl-coach-best {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pl-coach-best-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.pl-coach-best-figure {
  display: flex;
  align-items: baseline;
  gap: var(--space-1);
  min-width: 0;
}

.pl-coach-best-sign,
.pl-coach-best-amount,
.pl-coach-inline-amount {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
}

.pl-coach-inline-amount {
  width: 10ch;
}

.pl-coach-best-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pl-coach-best-caption,
.pl-coach-inline-event,
.pl-coach-inline-year {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.pl-coach-inline-event {
  flex: 1 1 160px;
}

.pl-coach-inline-year {
  width: 6ch;
}

.pl-coach-tile-bio,
.pl-coach-inline-bio {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  white-space: pre-wrap;
  line-height: var(--line-base);
}

.pl-coach-inline-bio {
  min-height: 4.5em;
  resize: none;
}

.pl-coach-tile-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.pl-coach-listed {
  flex: 1 1 100%;
  display: grid;
  gap: var(--space-1);
}

.pl-coach-tile-saved {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.pl-coach-inline {
  width: 100%;
  min-height: 0;
  margin: -2px -6px;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  transition: background var(--motion-fast) var(--motion-ease), border-color var(--motion-fast) var(--motion-ease);
}

.pl-coach-inline:hover {
  background: var(--color-surface-raised);
  border-color: var(--color-border);
}

.pl-coach-inline:focus {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
  outline: none;
}

.pl-coach-inline::placeholder {
  color: var(--color-text-faint);
}

.pl-coach-inline[aria-busy="true"] {
  opacity: 0.7;
}

.pl-coach-inline[type="number"] {
  appearance: textfield;
}

.pl-coach-inline[type="number"]::-webkit-inner-spin-button,
.pl-coach-inline[type="number"]::-webkit-outer-spin-button {
  appearance: none;
}

.pl-coach-tile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: auto;
}

.pl-select-compact {
  min-height: 32px;
  padding: 0 calc(var(--space-2) + 14px) 0 var(--space-2);
  font-size: var(--text-sm);
}

.pl-coach-schedule {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.pl-coach-schedule-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.pl-coach-schedule-title {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
}

.pl-coach-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--space-2);
}

.pl-coach-day {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
}

.pl-coach-day-title {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pl-coach-slot-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pl-coach-slot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-1);
}

.pl-coach-slot.is-editable {
  grid-template-columns: auto minmax(0, 1fr);
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.pl-coach-slot-time {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.pl-coach-slot-player {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text);
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-coach-slot-player.is-free {
  color: var(--color-text-faint);
}

.pl-coach-day-empty {
  margin: 0;
  color: var(--color-text-faint);
  font-size: var(--text-sm);
}

.pl-coach-slot-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1);
  margin-top: auto;
}

.pl-coach-slot-add .pl-btn {
  min-height: 32px;
}

.pl-coach-slot-remove {
  min-width: 28px;
  padding-inline: var(--space-1);
}

@media (max-width: 768px) {
  .pl-coach-tile-stats {
    grid-template-columns: 1fr;
  }

  .pl-coach-tile-head {
    gap: var(--space-3);
  }

  .pl-coach-week {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: var(--space-1);
  }

  .pl-coach-day {
    flex: 0 0 148px;
    scroll-snap-align: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pl-coach-inline {
    transition: none;
  }
}

@media (max-width: 640px) {
  .pl-form-grid {
    grid-template-columns: 1fr;
  }
}

.pl-switch {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  cursor: pointer;
}

.pl-switch input,
.pl-check input,
.pl-book-slot input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-sunken);
  cursor: pointer;
}

.pl-switch input,
.pl-check input {
  border-radius: var(--radius-sm);
}

.pl-book-slot input[type="radio"] {
  border-radius: var(--radius-full);
}

.pl-switch input:checked,
.pl-check input:checked,
.pl-book-slot input[type="radio"]:checked {
  border-color: var(--color-accent);
  background: var(--color-accent);
}

.pl-switch input:checked::after,
.pl-check input:checked::after {
  content: "";
  width: 4px;
  height: 8px;
  margin-bottom: 2px;
  border: solid var(--color-accent-contrast);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.pl-book-slot input[type="radio"]:checked::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-accent-contrast);
}

.pl-switch input:focus-visible,
.pl-check input:focus-visible,
.pl-book-slot input[type="radio"]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.pl-switch input:disabled,
.pl-check input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pl-look {
  display: grid;
  gap: var(--space-4);
}

.pl-look-group {
  display: grid;
  gap: var(--space-2);
}

.pl-look-title {
  margin: 0;
  padding: 0 var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.pl-look-block {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-sunken);
}

.pl-look-play .pl-look-block {
  gap: var(--space-2);
}

.pl-look-label {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.pl-swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pl-swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-full);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.pl-swatch.is-active {
  outline: 2px solid var(--color-accent-text);
  outline-offset: 2px;
}

.pl-swatch-none {
  width: 36px;
  height: 28px;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(135deg, transparent 46%, var(--color-danger) 46%, var(--color-danger) 54%, transparent 54%),
    var(--color-surface-raised);
}

.pl-look-slider {
  display: grid;
  gap: 8px;
}

.pl-look-slider-caption {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.pl-look-slider input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  margin: 0;
  border-radius: var(--radius-full);
  background: var(--color-border);
}

.pl-look-slider input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  cursor: pointer;
}

.pl-look-slider input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  cursor: pointer;
}

.pl-card-style-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pl-card-back-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.pl-card-back-pick {
  min-height: 0;
  padding: 6px 2px;
}

.mini-card.back.pl-card-back-swatch {
  width: 22px;
  height: 30px;
}

.pl-card-style {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 72px;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
}

.pl-card-style.is-active {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
  color: var(--color-text);
  outline: none;
}

.pl-card-style-name {
  font-size: 10px;
  line-height: var(--line-tight);
  text-align: center;
}

.pl-card-face {
  display: grid;
  place-items: center;
  width: 22px;
  height: 30px;
  border-radius: 3px;
  border: 1px solid #d4d0c8;
  background: #f4f1ea;
  color: #c42b32;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.pl-card-face[data-cards-preview="fourcolor"] {
  border-color: #a42329;
  background: #c42b32;
  color: #fff;
}

.pl-card-face[data-cards-preview="midnight"] {
  border-color: #5a5a64;
  background: #1c1c22;
  color: #ff6b73;
}

.pl-look-reset {
  justify-self: start;
  padding: 0;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
}

.pl-look-reset:hover {
  color: var(--color-text);
}

.pl-table-look {
  margin-top: var(--space-4);
}

/* --- Таблицы --- */

.pl-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.pl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.pl-table th,
.pl-table td {
  padding: var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.pl-table th {
  position: sticky;
  top: 0;
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pl-table tbody tr:last-child td {
  border-bottom: none;
}

.pl-table tbody tr.is-clickable {
  cursor: pointer;
}

.pl-table tbody tr.is-clickable:hover {
  background: var(--color-surface-sunken);
}

/* Числа в таблицах и метриках — моноширинные: колонки выравниваются по разряду,
   и разница между 12.4 и 124 видна без чтения. */
.pl-table td.pl-num {
  font-family: var(--font-mono);
}

.pl-table td.pl-num,
.pl-table th.pl-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- Списки-карточки (мобильный режим таблиц) --- */

.pl-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pl-list-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pl-list-row:hover {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
}

.pl-list-row.is-active {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

/* Список раздач турнира соседствует со столом, поэтому прокручивается сам,
   а не растягивает боковую панель на всю высоту турнира. */
.pl-hand-rail {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.pl-hand-rail .pl-card-title {
  margin: 0;
}

.pl-review-skip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.pl-review-skip .pl-check {
  gap: 4px;
  min-height: 28px;
  font-size: var(--text-xs);
}

.pl-review-skip-count {
  margin: 0;
  font-size: var(--text-xs);
}

.pl-hand-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.pl-hand-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.pl-hand-row {
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-2);
}

.pl-hand-index {
  flex: 0 0 auto;
  min-width: 3.4em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.pl-hand-cards {
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 3px;
}

.pl-hand-row .mini-card {
  width: 26px;
  height: 36px;
  font-size: 11px;
}

.pl-hand-marks {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  flex: 0 0 auto;
}

.pl-hand-delta {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.pl-hand-row.is-even .pl-hand-delta {
  color: var(--color-text-muted);
  font-weight: 500;
}

.pl-hand-row.is-win .pl-hand-delta {
  color: var(--color-success);
}

.pl-hand-row.is-win-big {
  background: var(--color-success-soft);
}

.pl-hand-row.is-win-big .pl-hand-delta {
  color: var(--color-success);
  font-weight: 700;
}

.pl-hand-row.is-loss .pl-hand-delta {
  color: var(--color-danger);
}

.pl-hand-row.is-loss-big {
  background: var(--color-danger-soft);
}

.pl-hand-row.is-loss-big .pl-hand-delta {
  color: var(--color-danger);
  font-weight: 700;
}

.pl-list-row.pl-hand-row.is-active {
  background: var(--color-accent-soft);
}

.pl-list-main {
  flex: 1 1 auto;
  min-width: 0;
}

.pl-list-title {
  font-size: var(--text-md);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-list-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Состояния --- */

.pl-empty,
.pl-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-7) var(--space-4);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  text-align: center;
  color: var(--color-text-muted);
}

.pl-empty-title {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

.pl-error {
  border-style: solid;
  border-color: var(--color-danger);
}

.pl-skeleton {
  height: 64px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--color-surface) 25%, var(--color-surface-raised) 50%, var(--color-surface) 75%);
  background-size: 400% 100%;
  animation: pl-shimmer 1.4s ease-in-out infinite;
}

@keyframes pl-shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

.pl-inline-alert {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-sunken);
  font-size: var(--text-sm);
}

.pl-inline-alert.is-warning {
  border-color: var(--color-warning);
  background: var(--color-warning-soft);
}

.pl-inline-alert.is-danger {
  border-color: var(--color-danger);
  background: var(--color-danger-soft);
}

/* --- Тосты --- */

.pl-toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(420px, calc(100vw - 2 * var(--space-4)));
  transform: translateX(-50%);
  pointer-events: none;
}

.pl-toast {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-popover);
  font-size: var(--text-sm);
  animation: pl-toast-in var(--motion-base) var(--motion-ease);
}

.pl-toast.is-error {
  border-color: var(--color-danger);
}

.pl-toast.is-success {
  border-color: var(--color-success);
}

@keyframes pl-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Поповер и модалка --- */

.pl-popover {
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2));
  z-index: var(--z-modal);
  min-width: 220px;
  padding: var(--space-2);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-popover);
}

.pl-popover-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 40px;
  padding: 0 var(--space-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.pl-popover-item:hover {
  background: var(--color-surface);
}

.pl-popover-info {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  word-break: break-all;
}

.pl-modal-host:empty {
  display: none;
}

.pl-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: var(--color-overlay);
}

.pl-modal {
  width: min(480px, 100%);
  max-height: min(90vh, 100%);
  overflow: auto;
  padding: var(--space-5);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-popover);
  animation: pl-modal-in var(--motion-base) var(--motion-ease);
}

.pl-modal-backdrop.is-top {
  align-items: start;
  justify-items: center;
}

.pl-modal.is-wide {
  width: min(720px, 100%);
}

@keyframes pl-modal-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.pl-modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-3);
}

.pl-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

/* --- Панель фильтров и период --- */

.pl-filters {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.pl-tourney-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pl-structure-report {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.pl-structure-cast {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.pl-structure-cast h3 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 500;
}

.pl-structure-cast h3 span {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 400;
}

.pl-structure-cast-name {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.pl-structure-cast-name.is-active {
  color: var(--accent);
}

.pl-structure-bands {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pl-structure-band {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  padding: 3px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.pl-structure-band span:last-child {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.pl-structure-band.is-active {
  border-color: var(--accent);
}

.pl-main:has(.pl-train-viewer) {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--topbar-height));
}

.pl-screen:has(.pl-train-viewer) {
  flex: 1 1 auto;
  min-height: 0;
}

.pl-viewer.pl-train-viewer {
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
  height: auto;
  min-height: 520px;
  overflow: hidden;
}

.pl-viewer.pl-train-viewer .pl-viewer-main {
  height: 100%;
  overflow: hidden;
}

.pl-viewer.pl-train-viewer .pl-viewer-stage {
  position: relative;
  height: 100%;
  min-height: 0;
}

.pl-train-dock {
  position: absolute;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
  width: min(420px, calc(100% - 32px));
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-bg) 92%, transparent);
  box-shadow: var(--shadow-popover);
}

.pl-train-dock-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.pl-train-dock-head [data-score] {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

.pl-train-size {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.pl-train-size input {
  width: 100%;
}

.pl-train-buttons {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.pl-poker-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 0 var(--space-2);
  color: white;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
}

.pl-poker-btn:disabled {
  cursor: default;
}

.pl-poker-btn.is-chart {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.pl-poker-btn.is-miss {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

.pl-train-next {
  align-self: flex-end;
}

.pl-train-note {
  margin-top: var(--space-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.pl-train-note p {
  margin: 6px 0 0;
}

.pl-train-note.is-hit {
  border-color: var(--accent);
}

@media (max-width: 767px) {
  .pl-main:has(.pl-train-viewer) {
    min-height: calc(100dvh - var(--topbar-height) - var(--tabbar-height));
  }

  .pl-train-dock {
    right: var(--space-3);
    left: var(--space-3);
    width: auto;
  }
}

.pl-period {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

/* --- Графики --- */

.pl-chart {
  width: 100%;
}

.pl-chart svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 168px;
  stroke: none;
}

.pl-chart-plot {
  position: relative;
}

.pl-chart-plot svg {
  max-height: none;
}

.pl-chart-tip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  min-width: 7rem;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-sm, 0 4px 16px rgb(0 0 0 / 0.18));
  color: var(--color-text);
  font-size: var(--text-xs);
  line-height: 1.35;
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap;
}

.pl-chart-tip-name {
  display: block;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-muted);
}

.pl-chart-tip strong {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
}

.pl-chart-tip strong.is-up {
  color: var(--color-success);
}

.pl-chart-tip strong.is-down {
  color: var(--color-danger);
}

.pl-chart-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.pl-chart-meta strong {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--color-text);
}

.pl-chart-line {
  fill: none;
  stroke: var(--color-accent-text);
  stroke-width: 1.5;
}

.pl-chart-area {
  fill: var(--color-accent-soft);
  stroke: none;
}

.pl-chart-axis {
  stroke: var(--color-border);
  stroke-width: 1;
}

.pl-chart-grid {
  stroke: var(--color-border);
  stroke-width: 1;
}

.pl-chart-zero {
  stroke: var(--color-border-strong);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.pl-chart-dot {
  fill: var(--color-accent-text);
}

.pl-chart-mark {
  fill: var(--color-accent-text);
  opacity: 0.85;
}

.pl-chart-hit {
  fill: transparent;
}

.pl-chart-bar {
  fill: var(--color-text-muted);
}

.pl-chart-bar.is-up {
  fill: var(--color-success);
}

.pl-chart-bar.is-down {
  fill: var(--color-danger);
}

.pl-chart-label {
  fill: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  stroke: none;
}

.pl-chart-label.is-up {
  fill: var(--color-success);
}

.pl-chart-label.is-down {
  fill: var(--color-danger);
}

.pl-grid-hero {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.pl-in-hands {
  margin-top: var(--space-4);
}

.pl-in-hands .pl-section-title {
  margin-bottom: var(--space-2);
}

.pl-check-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
}

.pl-check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
}

.pl-check input {
  width: 16px;
  height: 16px;
}

.pl-details {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-3);
}

.pl-details summary {
  list-style: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
}

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

.pl-details summary::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: var(--space-2);
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  vertical-align: 2px;
}

.pl-details[open] summary::before {
  transform: rotate(45deg);
  vertical-align: 3px;
}

.pl-coverage {
  margin: 0;
}

.pl-day-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pl-day-label {
  margin: var(--space-3) 0 0;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.pl-tournament-card.is-win,
.pl-tourney-card.is-win {
  border-color: color-mix(in srgb, var(--color-success) 28%, var(--color-border));
}

.pl-tournament-card.is-loss,
.pl-tourney-card.is-loss {
  border-color: color-mix(in srgb, var(--color-danger) 28%, var(--color-border));
}

.pl-tourney-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-3);
}

.pl-tourney-grid-compact {
  grid-template-columns: 1fr;
}

.pl-tourney-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 168px;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.pl-tourney-card:hover {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
}

.pl-tourney-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.pl-tourney-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.pl-tourney-card-head-aside {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
}

.pl-tourney-card-title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: 1.3;
}

.pl-tourney-card-result-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.pl-tourney-card-result {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1;
}

.pl-tourney-card-bb {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.pl-tourney-card-result.is-win {
  color: var(--color-success);
}

.pl-tourney-card-result.is-loss {
  color: var(--color-danger);
}

.pl-tourney-card-result.is-even {
  color: var(--color-text-muted);
  font-weight: 500;
}

.pl-tourney-card-meta {
  display: grid;
  grid-template-columns: auto minmax(4.5rem, 1fr) auto;
  column-gap: var(--space-4);
  row-gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.pl-tourney-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pl-tourney-meta.is-duration {
  min-width: 4.5rem;
  padding-inline: var(--space-1);
}

.pl-tourney-meta-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.pl-tourney-meta-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 550;
  line-height: 1.25;
}

@media (max-width: 479px) {
  .pl-tourney-grid {
    grid-template-columns: 1fr;
  }
}

.pl-upload-queue {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pl-upload-item {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.pl-upload-item.is-done {
  border-color: color-mix(in srgb, var(--color-success) 35%, var(--color-border));
}

.pl-upload-item.is-error {
  border-color: color-mix(in srgb, var(--color-danger) 35%, var(--color-border));
}

.pl-upload-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-upload-stage {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.pl-heat {
  display: grid;
  gap: 2px;
  font-size: var(--text-xs);
}

.pl-heat-cell {
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  background: var(--color-surface-sunken);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.pl-heat-head {
  color: var(--color-text-muted);
  background: transparent;
}

/* --- Просмотрщик: контейнеры для перенесённых узлов --- */

/* Стол — тёмная сцена в любой теме, как холст в редакторах: карты, фишки и
   подсветка действий рассчитаны на тёмный фон, а на светлом теряются. То же
   касается технической панели GTO-провайдера: её разметка досталась от
   просмотрщика и держит собственные тёмные цвета. Оба блока переопределяют
   токены локально, вместо того чтобы притворяться светлыми наполовину. */
[data-theme="light"] .pl-viewer,
[data-theme="light"] #gtoAdvancedSection,
[data-theme="light"] #authModalBackdrop {
  --color-bg: #0b0b0d;
  --color-surface: #121215;
  --color-surface-raised: #191a1e;
  --color-surface-sunken: #08080a;
  --color-border: #23242a;
  --color-border-strong: #35363e;
  --color-text: #ededf0;
  --color-text-muted: #9a9aa5;
  --color-text-faint: #6b6b76;
  --color-accent-text: #8b93ff;
  --color-accent-soft: rgba(89, 100, 214, 0.18);
  --color-success: #35c07a;
  --color-warning: #d99a2b;
  --color-danger: #f2555a;

  /* Псевдонимы просмотрщика объявлены в :root и подставляются его значениями,
     поэтому одного переопределения --color-* мало: без этих строк текст
     унаследованных кнопок остаётся тёмным на тёмном. */
  --bg: var(--color-bg);
  --panel: var(--color-surface);
  --muted: var(--color-text-muted);
  --accent: var(--color-accent-text);
  --hero: var(--color-success);
  --danger: var(--color-danger);
  --border: var(--color-border);
  --text: var(--color-text);

  color-scheme: dark;
  color: var(--color-text);
}

/* Модалка входа — оверлей со своей подложкой, рамка и отступы ей не нужны. */
[data-theme="light"] .pl-viewer,
[data-theme="light"] #gtoAdvancedSection {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.pl-app[data-chrome="play"] .pl-screen {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.pl-viewer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-4);
  align-items: stretch;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.pl-viewer-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  display: flex;
  justify-content: center;
}

.pl-viewer-main {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.pl-viewer-main,
.pl-viewer-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.pl-viewer-side {
  position: relative;
  top: auto;
  max-height: none;
  height: 100%;
  align-self: stretch;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  background: var(--color-surface);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.pl-viewer-side::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.pl-viewer-stage {
  container-type: inline-size;
  min-width: 0;
}

.pl-viewer #sideTabPlay {
  display: none;
}

.pl-hand-log {
  flex: 0 1 112px;
  min-height: 0;
  max-height: 112px;
  overflow: auto;
}

.pl-hand-log #sideTabPlayContent {
  margin: 0;
  padding: 0;
  height: 100%;
  max-height: none;
  background: transparent;
  border: none;
}

.pl-hand-log .action-label,
.pl-hand-log #playerFilters {
  display: none;
}

.pl-viewer-controls {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.pl-viewer-nav,
.pl-viewer-extra {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.pl-viewer-streets {
  flex: 0 1 auto;
}

.pl-street-short {
  display: none;
}

.pl-viewer-panes {
  display: none;
  width: 100%;
}

.pl-viewer-panes button {
  flex: 1 1 0;
}

.pl-viewer-step {
  min-width: 92px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

@media (max-width: 1023px) {
  .pl-viewer {
    grid-template-columns: minmax(0, 1fr);
  }

  .pl-viewer-side {
    position: static;
    max-height: none;
  }

  .pl-app[data-chrome="play"] .pl-viewer-controls {
    position: sticky;
    top: var(--topbar-height);
    bottom: auto;
    z-index: 3;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .pl-app[data-chrome="play"] .pl-viewer-panes {
    display: flex;
  }

  .pl-app[data-chrome="play"] .pl-viewer[data-dock="log"] .pl-hand-rail {
    display: none;
  }

  .pl-app[data-chrome="play"] .pl-viewer[data-dock="hands"] .pl-hand-log,
  .pl-app[data-chrome="play"] .pl-viewer[data-dock="hands"] .pl-hand-note {
    display: none;
  }

  .pl-app[data-chrome="play"] .pl-viewer[data-dock="log"] .pl-viewer-side:not(:has([data-equity-root]:not([hidden]))) {
    display: none;
  }

  .pl-app[data-chrome="play"] .pl-hand-log,
  .pl-app[data-chrome="play"] .pl-hand-log #sideTabPlayContent,
  .pl-app[data-chrome="play"] .pl-viewer .actions-list.hand-log,
  .pl-app[data-chrome="play"] .pl-viewer .hand-log-col {
    max-height: min(50vh, calc(100dvh - var(--topbar-height) - 12rem));
  }

  .pl-app[data-chrome="play"] .pl-viewer[data-dock="hands"] .pl-hand-list {
    max-height: min(60vh, calc(100dvh - var(--topbar-height) - 10rem));
  }
}

/* --- Переопределения перенесённого просмотрщика --- */

/* Настройки GTO-провайдера переехали на экран настроек, кнопка в панели лишняя.
   Библиотека стала отдельным экраном — третья вкладка панели тоже не нужна. */
#gtoAdvancedToggle,
#sideTabLibrary {
  display: none;
}

/* Панели просмотрщика внутри новых экранов не должны задавать свои отступы страницы. */
.pl-viewer .panel {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  backdrop-filter: none;
}

.pl-viewer .table-wrap {
  margin: 0 auto;
  min-height: 0;
  height: 100%;
  padding: 0;
  background-color: transparent;
  background-image: none;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.pl-viewer .table-wrap.is-compact {
  min-height: 0;
  padding: 24px 16px 32px;
}

.pl-app[data-chrome="play"] .pl-viewer-controls {
  position: static;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
}

.pl-app[data-chrome="play"] .pl-viewer-streets,
.pl-app[data-chrome="play"] .pl-stamp-bar {
  flex-wrap: nowrap;
}

.pl-app[data-chrome="play"] .pl-stamp-bar {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  overflow-x: auto;
}

.pl-viewer .table-wrap.is-compact .table-center {
  top: 40%;
  gap: 5px;
}

.pl-viewer .table-center {
  transform: translate(-50%, -50%) scale(var(--seat-scale, 1));
}

.pl-viewer .table-wrap.is-compact .seat-south {
  transform: translate(-50%, -50%) scale(var(--seat-scale, 1));
}

.pl-viewer .table-wrap.is-compact .seat-south .bet-pile {
  bottom: calc(100% + 4px);
}

.pl-viewer .pot {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.pl-viewer .seat {
  width: 112px;
  height: auto;
  overflow: visible;
  background: transparent;
  border: none;
  box-shadow: none;
  transform: translate(-50%, -50%) scale(var(--seat-scale, 1));
}

.pl-viewer .seat.empty {
  width: 88px;
  height: auto;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: none;
}

.pl-viewer .seat.hero,
.pl-viewer .seat.button-seat,
.pl-viewer .seat.active,
.pl-viewer .seat.winner {
  background: transparent;
  border: none;
  box-shadow: none;
  transform: translate(-50%, -50%) scale(var(--seat-scale, 1));
}

.pl-viewer .dealer-button-chip {
  width: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  right: -8px;
  top: -8px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: #1a1408;
  border: 1px solid #d4a84b;
  background: #d4a84b;
  box-shadow: none;
}

.pl-viewer .dealer-button-chip.is-pos {
  color: #f4f4f6;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(12, 12, 14, 0.88);
}

.pl-viewer .seat-hud {
  gap: 2px;
  padding: 4px 7px 5px;
}

.pl-viewer .seat .name {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: var(--tracking-tight);
}

.pl-viewer .seat-hud .hud-action .action-badge {
  border-radius: var(--radius-sm);
  font-weight: 500;
  padding: 1px 6px;
}

.pl-viewer .seat .showdown-result {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pl-viewer .seat .chips {
  color: #6ec8ff;
}

.pl-viewer .seat .badge {
  font-family: var(--font-mono);
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: none;
}

.pl-viewer .mini-card,
.pl-viewer .card {
  font-family: var(--font-mono);
  font-weight: 500;
  border-radius: var(--radius-sm);
}

html[data-cards="fourcolor"] .mini-card.suit-clubs,
html[data-cards="fourcolor"] .card.suit-clubs {
  border-color: #146230;
  background: #1a7a3a;
  color: #fff;
}

html[data-cards="fourcolor"] .mini-card.suit-diamonds,
html[data-cards="fourcolor"] .card.suit-diamonds {
  border-color: #154db0;
  background: #1a5fd4;
  color: #fff;
}

html[data-cards="fourcolor"] .mini-card.suit-hearts,
html[data-cards="fourcolor"] .card.suit-hearts {
  border-color: #a42329;
  background: #c42b32;
  color: #fff;
}

html[data-cards="fourcolor"] .mini-card.suit-spades,
html[data-cards="fourcolor"] .card.suit-spades {
  border-color: #111114;
  background: #1c1c22;
  color: #fff;
}

html[data-cards="midnight"] .mini-card,
html[data-cards="midnight"] .card {
  border-color: #5a5a64;
  background: #1c1c22;
  color: #f0f0f4;
}

html[data-cards="midnight"] .mini-card.suit-hearts,
html[data-cards="midnight"] .mini-card.suit-diamonds,
html[data-cards="midnight"] .card.suit-hearts,
html[data-cards="midnight"] .card.suit-diamonds {
  background: #1c1c22;
  color: #ff6b73;
}

html[data-cards="midnight"] .mini-card.suit-clubs,
html[data-cards="midnight"] .mini-card.suit-spades,
html[data-cards="midnight"] .card.suit-clubs,
html[data-cards="midnight"] .card.suit-spades {
  background: #1c1c22;
  color: #f0f0f4;
}


.pl-viewer .hero-gto,
.pl-viewer .hero-gto-title {
  color: var(--color-text-muted);
  font-weight: 500;
}

.pl-viewer .hero-gto-chip,
.pl-viewer .gto-chip,
.pl-viewer .action-badge {
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 500;
  box-shadow: none;
}

.pl-viewer .gto-chip.selected,
.pl-viewer .hero-gto-chip.selected {
  box-shadow: inset 0 0 0 1px var(--color-warning);
}

.pl-viewer .meta,
.pl-viewer .gto-box {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.pl-viewer .gto-box {
  margin-top: 0;
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-3);
}

.pl-viewer .meta h3,
.pl-viewer .gto-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

.pl-viewer .meta-row,
.pl-viewer .gto-row {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-1);
}

.pl-viewer #streetIndicator {
  display: none;
}

.pl-viewer .progress-wrap {
  height: 3px;
  border: none;
  border-radius: 0;
  background: var(--color-border);
}

.pl-viewer .side-tabs {
  gap: var(--space-1);
  margin: 0;
  padding: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
}

.pl-viewer .side-tab-btn {
  min-height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-weight: 500;
}

.pl-viewer .side-tab-btn.primary,
.pl-viewer #sideTabPlay.primary,
.pl-viewer #sideTabGto.primary {
  background: var(--color-surface-raised);
  color: var(--color-text);
  box-shadow: inset 0 0 0 1px var(--color-border-strong);
}

.pl-viewer .action-label {
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.pl-viewer .actions-toolbar {
  gap: var(--space-1);
}

.pl-viewer .player-btn,
.pl-viewer .actions-list button.primary {
  min-height: 28px;
  padding: 2px 8px;
  font-size: var(--text-xs);
}

.pl-viewer button.primary {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.pl-viewer .actions-list:not(.hand-log) {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pl-hand-log .actions-list.hand-log,
.pl-viewer .actions-list.hand-log {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-flow: column;
  align-items: start;
  height: 100%;
  max-height: none;
  overflow: auto;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.pl-viewer .actions-list button {
  border-radius: var(--radius-sm);
  text-align: left;
}

.pl-viewer .actions-list button.hero-action {
  border-left: 2px solid var(--color-success);
}

.pl-viewer .hand-log-col {
  height: auto;
  max-height: 28vh;
  border-right-color: var(--color-border);
}

.pl-viewer .hand-log-head {
  border-bottom-color: var(--color-border);
  padding-bottom: var(--space-2);
}

.pl-viewer .hand-log-street {
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 500;
}

.pl-viewer .hand-log-who {
  grid-template-columns: 1fr;
}

.pl-viewer .hand-log-who .avatar {
  display: none;
}

.pl-viewer .hand-log-name {
  grid-column: 1;
  grid-row: 1;
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: 500;
}

.pl-viewer .hand-log-pos {
  grid-column: 1;
  grid-row: 2;
}

.pl-viewer .hand-log-ante,
.pl-viewer .hand-log-bubble {
  background: var(--color-surface-raised);
  color: var(--color-text);
  border-radius: var(--radius-sm);
}

.pl-viewer .hand-log-ante {
  padding: var(--space-2);
  font-weight: 500;
  color: var(--color-text-muted);
}

.pl-viewer .hand-log-bubble {
  padding: 5px 7px;
}

.pl-viewer .hand-log-bubble::before {
  border-right-color: var(--color-surface-raised);
}

.pl-viewer .hand-log-verb,
.pl-viewer .hand-log-amt {
  font-size: var(--text-sm);
  font-weight: 500;
}

.pl-viewer .hand-log-amt {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.pl-viewer details.pl-card {
  padding: var(--space-3);
}

.pl-viewer-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pl-tournament-report {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.pl-stat-strip {
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
}

.pl-stat-strip.is-dense {
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
}

.pl-stat-strip .pl-stat-value {
  font-size: var(--text-xl);
}

.pl-stat-strip.is-dense .pl-stat-value {
  font-size: var(--text-lg);
}

.pl-table .pl-input {
  min-height: 36px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.pl-stat-strip .pl-stat {
  padding: var(--space-2) var(--space-3);
}

.pl-tournament-hands {
  padding: var(--space-3);
}

.pl-hand-table-wrap {
  overflow-x: auto;
}

.pl-hand-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.pl-hand-table th,
.pl-hand-table td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border);
}

.pl-hand-table th {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pl-hand-table td.pl-hand-cards,
.pl-hand-table td.pl-hand-board {
  white-space: normal;
}

.pl-hand-table .pl-hand-cards {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
}

.pl-hand-table .mini-card {
  width: 24px;
  height: 34px;
  font-size: 11px;
}

.pl-hand-acts {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.pl-act {
  color: var(--color-text-muted);
}

.pl-act.is-raise,
.pl-act.is-bet {
  color: var(--color-warning);
}

.pl-act.is-call {
  color: var(--color-success);
}

.pl-act.is-fold {
  color: var(--color-text-muted);
}

.pl-act.is-hero {
  font-weight: 700;
}

.pl-hand-table .is-win .pl-hand-delta,
.pl-hand-table .is-win-big .pl-hand-delta {
  color: var(--color-success);
}

.pl-hand-table .is-loss .pl-hand-delta,
.pl-hand-table .is-loss-big .pl-hand-delta {
  color: var(--color-danger);
}

.pl-hand-table .is-win-big {
  background: var(--color-success-soft);
}

.pl-hand-table .is-loss-big {
  background: var(--color-danger-soft);
}

.pl-hand-stakes {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

.pl-hand-play {
  text-align: right;
}

.pl-hand-table tr.is-reviewed td.pl-hand-index {
  color: var(--color-accent);
}

.pl-hand-filters {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-3) 0;
}

.pl-hand-count {
  margin: 0;
  font-size: var(--text-xs);
}

.pl-hand-empty {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4) 0;
  color: var(--color-text-muted);
}

.pl-hand-empty[hidden] {
  display: none;
}

.pl-hand-empty p {
  margin: 0;
}

.pl-hand-flag {
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.pl-star-btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.pl-star-btn.is-on {
  color: var(--color-accent-text);
}

.pl-star-btn.is-on svg {
  fill: currentColor;
}

.pl-hand-table .pl-hand-star {
  width: 2.25rem;
  padding-right: 0;
}

.pl-note-field {
  display: grid;
  gap: var(--space-2);
}

.pl-note-label,
.pl-note-text {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.pl-note-text {
  margin: 0;
  white-space: pre-wrap;
  color: var(--color-text);
}

.pl-note-input {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
  color: var(--color-text);
  font: inherit;
}

.pl-note-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.pl-note-input[readonly] {
  cursor: default;
}

.pl-hand-note {
  margin-top: 0;
}

.pl-note-field.is-compact {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.pl-note-field.is-compact .pl-note-label {
  flex: 0 0 auto;
}

.pl-note-field.is-compact .pl-note-input {
  min-height: 2.5rem;
  resize: none;
  padding: var(--space-2) var(--space-3);
}

.pl-eq-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.pl-eq-hero-label {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.pl-eq-hero-card {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.pl-eq-hero-card .pl-choice {
  width: 4.2rem;
}

.pl-eq-hero-suit .pl-choice {
  width: 3.4rem;
}

.pl-eq-hero-card .pl-choice-pop {
  max-height: 16rem;
  overflow-y: auto;
}

.pl-eq-hero-card [data-choice-pick="h"],
.pl-eq-hero-card [data-choice-pick="d"],
.pl-eq-hero-suit[data-eq-suit="h"] [data-choice-label],
.pl-eq-hero-suit[data-eq-suit="d"] [data-choice-label] {
  color: #c42b32;
}

.pl-eq-spot {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.pl-eq-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.pl-eq-panel[hidden] {
  display: none;
}

.pl-eq-odds {
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.pl-eq-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-2);
}

.pl-eq-progress[hidden] {
  display: none;
}

.pl-eq-progress-track {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-sunken);
  overflow: hidden;
}

.pl-eq-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--color-accent);
}

.pl-eq-progress-pct {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.pl-eq-villains {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.pl-eq-villains .pl-segmented {
  flex: 0 1 auto;
}

.pl-eq-villains .pl-segmented button.is-set:not(.is-active) {
  color: var(--color-text);
}

.pl-eq-panel [data-eq-heat].is-on {
  border-color: var(--color-accent);
  color: var(--color-text);
}

.pl-eq-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 0;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}

.pl-eq-cell {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--color-surface-sunken);
  color: var(--color-text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}

.pl-eq-cell.is-50 {
  background: var(--color-accent-soft);
  color: var(--color-text-muted);
}

.pl-eq-cell.is-100 {
  background: var(--color-accent);
  color: var(--color-accent-contrast);
}

.pl-eq-cell.is-dead {
  opacity: 0.38;
}

.pl-eq-cell.is-blocked::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-style: solid;
  border-width: 0 6px 6px 0;
  border-color: transparent var(--color-text-muted) transparent transparent;
  pointer-events: none;
}

.pl-eq-cell.is-heat {
  background: color-mix(
    in srgb,
    var(--color-danger-strong) calc(var(--heat-max) * var(--eq-heat)),
    var(--color-surface-sunken)
  );
  color: var(--color-text);
}

.pl-hand-row.is-reviewed .pl-hand-index {
  color: var(--color-accent);
}

.pl-tournament-hands .pl-card-title {
  margin: 0;
}

.pl-review-head {
  display: grid;
  gap: var(--space-2);
  min-width: min(100%, 240px);
  flex: 1 1 200px;
}

.pl-review-meter {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-3);
}

.pl-review-track {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-sunken);
  overflow: hidden;
}

.pl-review-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-accent);
}

.pl-review-track.is-complete .pl-review-fill {
  background: var(--color-success);
}

.pl-review-pct {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.pl-review-meter-slot {
  padding: 0 var(--space-3) var(--space-2);
}

/* --- Утилиты --- */

.pl-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.pl-spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.pl-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.pl-stack.is-drop-target {
  outline: 2px dashed var(--color-accent);
  outline-offset: 6px;
  border-radius: var(--radius-md);
  background: var(--color-accent-soft);
}

.pl-auth-screen {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--topbar-height) - var(--space-8));
}

.pl-auth-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.pl-role-options {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.pl-role-option {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-sunken);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pl-role-option.is-active {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.pl-role-option strong {
  font-size: var(--text-md);
}

.pl-role-option span {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.pl-trainers-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
}

.pl-trainers-toolbar .pl-field {
  flex: 1 1 12rem;
  min-width: 0;
}

.pl-trainers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--space-4);
}

@media (max-width: 767px) {
  .pl-trainers-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
  }

  a.pl-trainers-card {
    padding: var(--space-3);
    gap: var(--space-3);
  }

  a.pl-trainers-card .pl-coach-tile-head {
    flex-direction: column;
    gap: var(--space-2);
  }
}

a.pl-trainers-card {
  color: inherit;
  text-decoration: none;
}

a.pl-trainers-card .pl-coach-tile-name {
  font-size: var(--text-lg);
}

a.pl-trainers-card .pl-coach-tile-avatar {
  width: 40px;
  height: 40px;
  font-size: var(--text-md);
}

a.pl-trainers-card:hover {
  border-color: var(--color-border-strong);
}

a.pl-trainers-card:hover .pl-coach-tile-name {
  color: var(--color-accent-text);
}

a.pl-trainers-card:active {
  transform: scale(0.98);
}

.pl-trainers-card.is-skeleton {
  min-height: 8.5rem;
  pointer-events: none;
  background: linear-gradient(90deg, var(--color-surface) 25%, var(--color-surface-raised) 50%, var(--color-surface) 75%);
  background-size: 400% 100%;
  animation: pl-shimmer 1.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  a.pl-trainers-card:active {
    transform: none;
  }

  .pl-trainers-card.is-skeleton {
    animation: none;
  }
}

.pl-text-link {
  color: var(--color-accent-text);
  text-decoration: none;
}

.pl-text-link:hover {
  text-decoration: underline;
}

.pl-trainer-bio {
  margin: var(--space-3) 0 0;
  max-width: 65ch;
  white-space: pre-wrap;
}

.pl-coach-offers {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
}

.pl-offer-add {
  display: grid;
  grid-template-columns: minmax(10rem, 1.4fr) minmax(7rem, 0.7fr) 6rem 6rem 5.5rem auto;
  align-items: end;
  gap: var(--space-2);
  overflow: visible;
}

.pl-offer-add .pl-field {
  min-width: 0;
}

@media (max-width: 768px) {
  .pl-offer-add {
    grid-template-columns: 1fr 1fr;
  }

  .pl-offer-add button {
    grid-column: 1 / -1;
  }
}

.pl-book-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.pl-book-slots {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.pl-book-slot {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 32px;
  font-size: var(--text-sm);
}

.pl-lesson-head .pl-switch {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pl-lesson-timer {
  font-variant-numeric: tabular-nums;
}

.pl-lesson-room {
  margin-top: var(--space-3);
}

.pl-lesson-pick {
  min-width: 220px;
}

.pl-lesson-presence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.pl-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-border);
}

.pl-dot.is-on {
  background: var(--color-success, #3d9a5b);
}

.pl-lesson-soon {
  margin-bottom: var(--space-3);
}

.pl-lesson-call {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.pl-lesson-call-frame {
  min-height: 220px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface-sunken);
}

.pl-lesson-call-iframe,
.pl-lesson-call-frame iframe {
  display: block;
  width: 100%;
  height: 240px;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .pl-lesson-call-frame {
    scroll-behavior: auto;
  }
}

@media (max-width: 1023px) {
  .pl-lesson-room.pl-viewer {
    display: flex;
    flex-direction: column;
  }

  .pl-lesson-room .pl-viewer-main {
    order: 1;
  }

  .pl-lesson-room .pl-lesson-pick {
    order: 2;
    max-height: 42vh;
    overflow: auto;
  }

  .pl-lesson-call-frame,
  .pl-lesson-call-iframe,
  .pl-lesson-call-frame iframe {
    min-height: 220px;
    height: 220px;
  }
}

.pl-hand-table tr.is-clickable {
  cursor: pointer;
}

.pl-stamp-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  width: 100%;
}

.pl-matrix-wrap {
  overflow-x: auto;
}

.pl-matrix {
  border-collapse: collapse;
  font-size: 11px;
}

.pl-matrix th,
.pl-matrix td {
  width: 36px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--color-border);
  text-align: center;
  vertical-align: middle;
}

.pl-matrix td.is-high { background: #3a4578; color: #eef0ff; cursor: pointer; }
.pl-matrix td.is-mid { background: #2a2d3a; color: #e7e8ee; cursor: pointer; }
.pl-matrix td.is-low { background: #34303a; color: #e7e8ee; cursor: pointer; }
.pl-matrix td.is-unknown { background: #23242b; color: #9a9aa8; cursor: pointer; }
.pl-matrix td.is-empty { background: transparent; color: transparent; pointer-events: none; cursor: default; }
.pl-matrix-eq { display: block; font-weight: 650; }
.pl-matrix-n { display: block; opacity: 0.8; }

.pl-hand-stamps {
  display: block;
  color: var(--color-accent-text);
  font-size: var(--text-xs);
  white-space: nowrap;
}
