/* —— Общий фон инструментов —— */
.tool-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.tool-backdrop .tool-particles {
  display: block;
  width: 100%;
  height: 100%;
}

.workspace__body.has-tool-backdrop {
  position: relative;
  overflow: hidden;
}

.workspace__body.has-tool-backdrop:has(.post-tool-root),
.workspace__body.has-tool-backdrop:has(.ternary-tool-root) {
  overflow-y: auto;
  overflow-x: hidden;
}

.workspace__body.has-tool-backdrop .tool-root {
  position: relative;
  z-index: 1;
}

.workspace__body.has-tool-backdrop .time-tool-root,
.workspace__body.has-tool-backdrop .hash-tool-root,
.workspace__body.has-tool-backdrop .post-tool-root,
.workspace__body.has-tool-backdrop .ternary-tool-root,
.workspace__body.has-tool-backdrop .p2p-room-tool-root,
.workspace__body.has-tool-backdrop .yg-images-tool-root {
  width: 100%;
  max-width: none;
}

.tool-backdrop--timestamp {
  background: radial-gradient(ellipse 70% 50% at 20% 0%, rgba(108, 182, 255, 0.08), transparent 55%);
}

.tool-backdrop--hash {
  background: radial-gradient(ellipse 70% 50% at 80% 10%, rgba(240, 240, 240, 0.06), transparent 55%);
}

.tool-backdrop--password {
  background: radial-gradient(ellipse 60% 45% at 15% 90%, rgba(108, 182, 255, 0.07), transparent 50%);
}

.tool-backdrop--text-case {
  background: radial-gradient(ellipse 55% 40% at 50% 0%, rgba(108, 182, 255, 0.08), transparent 50%);
}

.tool-backdrop--counter {
  background: radial-gradient(ellipse 50% 45% at 90% 50%, rgba(108, 182, 255, 0.07), transparent 52%);
}

.tool-backdrop--diff {
  background:
    radial-gradient(ellipse 40% 35% at 10% 50%, rgba(108, 182, 255, 0.05), transparent 50%),
    radial-gradient(ellipse 40% 35% at 90% 50%, rgba(240, 240, 240, 0.05), transparent 50%);
}

.tool-backdrop--post-machine {
  background: radial-gradient(ellipse 60% 45% at 40% 20%, rgba(108, 182, 255, 0.09), transparent 55%);
}

/* —— Сцена инструмента —— */
.tool-stage {
  width: min(920px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tool-stage--post-machine {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-sizing: border-box;
}

.post-machine__tape-sticky {
  position: fixed;
  top: var(--post-workspace-bar-h, 5.5rem);
  left: var(--sidebar-w);
  right: 0;
  z-index: 25;
  padding: 0.5rem 1.5rem 0.65rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  /* Пропускаем клики в пустые зоны — иначе таблица программы под блоком не получает фокус */
  pointer-events: none;
}

.post-machine__tape-sticky-inner {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: auto;
}

.post-machine__tape-row {
  display: flex;
  align-items: stretch;
  gap: 0.65rem;
}

.post-machine__tape-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.post-machine__tape-side .btn {
  white-space: nowrap;
}

.post-machine__tape-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

@media (max-width: 720px) {
  .post-machine__tape-row {
    flex-direction: column;
  }

  .post-machine__tape-side {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .post-machine__tape-side--right {
    order: 3;
  }
}

@media (max-width: 860px) {
  .post-machine__tape-sticky {
    left: 0;
    padding-left: 1rem;
    padding-right: 1rem;
  }

}

.post-machine__hero--compact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.85rem 1rem;
  margin-bottom: 0;
}

.post-machine__hero--compact .post-machine__meta {
  margin-bottom: 0.5rem;
}

.post-machine__hero--compact .post-machine__status {
  margin: 0;
  font-size: 0.78rem;
}

.post-machine__fold {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.15rem;
}

.post-machine__fold-label {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.post-machine__fold-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 0.45rem 0.65rem;
}

.post-machine__task-card .post-machine__task {
  min-height: 3.5rem;
}

.post-machine__program-card {
  position: relative;
  z-index: 2;
  margin-bottom: 0;
  overflow: visible;
}

.post-machine__program-host,
.post-program {
  overflow: visible;
}

.post-machine__program-card .post-program__toolbar {
  position: sticky;
  top: var(--post-tape-sticky-h, 12rem);
  z-index: 24;
  margin: 0 -1.25rem 0.5rem;
  padding: 0.45rem 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

.post-program__toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.post-program__scroll {
  overflow: visible;
}

.tool-hero {
  text-align: center;
  padding: 1.5rem 1.25rem;
  border-radius: 0;
  border: 1px solid var(--border);
  background: rgba(5, 5, 5, 0.82);
  backdrop-filter: blur(14px);
  box-shadow: none;
}

.tool-hero__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.65rem;
}

.tool-panel-grid {
  display: grid;
  gap: 1rem;
}

.tool-panel-grid--2 {
  grid-template-columns: 1fr 1fr;
}

/* В рядом стоящих колонках не добавляем верхний отступ второй карточке */
.tool-panel-grid--2 > .card + .card {
  margin-top: 0;
}

@media (max-width: 720px) {
  .tool-panel-grid--2 {
    grid-template-columns: 1fr;
  }

  .tool-panel-grid--2 > .card + .card {
    margin-top: 1rem;
  }
}

/* —— Регистр —— */
.case-hero__preview {
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent-2);
  word-break: break-all;
  min-height: 2.5rem;
}

/* —— Пароль —— */
.pw-hero__value {
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  word-break: break-all;
  min-height: 2.5rem;
  color: var(--text);
}

.pw-strength {
  margin-top: 1rem;
  height: 6px;
  border-radius: 0;
  background: var(--surface-active);
  overflow: hidden;
}

.pw-strength__bar {
  height: 100%;
  width: 0%;
  border-radius: 0;
  background: linear-gradient(90deg, var(--danger), var(--warning), var(--success));
  transition: width 0.45s var(--ease-flow-out);
}

.pw-strength__hint {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* —— Счётчик —— */
.counter-hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.counter-hero__item {
  padding: 1rem 0.5rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.6);
  border: 1px solid var(--border);
}

.counter-hero__item .card__title {
  margin-bottom: 0.35rem;
}

.counter-hero__item .stat {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}

@media (max-width: 640px) {
  .counter-hero {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* —— Машина Поста —— */
.post-machine__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.post-machine__state {
  color: var(--accent-2);
  font-weight: 600;
}

.post-machine__steps {
  color: var(--text-muted);
}

.post-machine__tape-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  width: 100%;
  max-width: 100%;
}

.post-machine__pan {
  flex-shrink: 0;
  align-self: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 0;
  border: 1px solid var(--border-strong);
  background: rgba(5, 5, 5, 0.55);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  transition: transform var(--dur-fast) var(--ease-out);
}

.post-machine__pan:hover:not(:disabled) {
  transform: scale(1.06);
}

.post-machine__pan:active:not(:disabled) {
  transform: scale(0.94);
}

.post-machine__tape-track {
  flex: 1;
  min-width: 0;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.35);
  border: 1px solid var(--border);
  overflow: hidden;
}

.post-machine__tape-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.4rem 0.35rem 0.55rem;
  scrollbar-width: thin;
}

.post-machine__cells {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  width: max-content;
  min-height: 4.5rem;
  align-items: flex-end;
}

.post-machine__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.post-machine__head-slot {
  width: 1.65rem;
  height: 1.35rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  line-height: 1;
  border-radius: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out);
}

.post-machine__head-slot:hover:not(:disabled) {
  transform: scale(1.08);
}

.post-machine__head-slot.is-active {
  color: rgba(108, 182, 255, 0.9);
  background: rgba(108, 182, 255, 0.14);
  border-color: rgba(108, 182, 255, 0.28);
  transform: scale(1.08);
}

.post-machine__col.is-head-col .post-machine__cell {
  border-color: rgba(108, 182, 255, 0.45);
}

.post-machine__cell {
  flex-shrink: 0;
  width: 2.35rem;
  padding: 0.35rem 0.15rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-family: var(--font-mono);
  border-radius: 0;
  border: 1px solid var(--border);
  background: rgba(5, 5, 5, 0.65);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 0.3s ease,
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.post-machine__cell:hover {
  border-color: rgba(108, 182, 255, 0.35);
  background: rgba(8, 8, 8, 0.85);
}

.post-machine__cell.is-under-head {
  border-color: rgba(108, 182, 255, 0.45);
  background: var(--accent-soft);
}

.post-machine__cell-val {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1;
}

.post-machine__cell-idx {
  font-size: 0.58rem;
  color: var(--text-faint);
  line-height: 1;
}

.post-machine__tape-hint {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: var(--text-faint);
  line-height: 1.4;
}

.post-machine__status {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.post-machine__task {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  line-height: 1.55;
}

.post-machine__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.post-machine__speed {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.post-machine__tape-side--right .post-machine__speed {
  margin-top: 0.15rem;
}

.post-machine__speed select {
  width: auto;
  min-width: 7rem;
}

.post-program__scroll {
  overflow-x: auto;
  border-radius: 0;
  border: 1px solid var(--border);
}

.post-program__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.post-program__table th,
.post-program__table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.post-program__table th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  background: rgba(5, 5, 5, 0.6);
}

.post-program__table tr.is-active td {
  background: rgba(240, 240, 240, 0.12);
}

.post-program__table tr.is-active .post-program__col-n {
  color: var(--success);
  font-weight: 700;
}

.post-program__col-drag {
  width: 1.75rem;
  padding-left: 0.35rem;
  padding-right: 0.15rem;
}

.post-program__drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  font-size: 0.7rem;
  letter-spacing: -0.12em;
  color: var(--text-faint);
  border-radius: 0;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: transform var(--dur-fast) var(--ease-out);
}

.post-program__drag:hover {
  transform: scale(1.12);
}

.post-program__drag:active {
  cursor: grabbing;
  transform: scale(0.95);
}

.post-program__col-n {
  width: 2.25rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.post-program__line-num {
  display: inline-block;
  min-width: 1.25rem;
  text-align: center;
}

.post-program__table tbody tr {
  transition:
    transform 0.38s var(--ease-flow-out),
    opacity 0.22s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.post-program__table tr.is-dragging {
  opacity: 0.42;
}

.post-program__table tr.is-dragging .post-program__drag {
  cursor: grabbing;
  color: var(--accent-2);
}

.post-program__table tr.is-drop-before td {
  box-shadow: none;
}

.post-program__table tr.is-drop-after td {
  box-shadow: none;
}

.post-program__drag-ghost {
  opacity: 0.92;
  background: rgba(5, 5, 5, 0.95);
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .post-program__table tbody tr {
    transition: background 0.2s ease, box-shadow 0.2s ease;
  }
}

.post-program__col-cmd {
  width: 11rem;
}

.post-program__cmd-picker,
.ternary-program__cmd-picker {
  position: relative;
  width: 100%;
}

.post-program__cmd-picker-btn,
.ternary-program__cmd-picker-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.55rem;
  font-size: 0.82rem;
  line-height: 1.3;
  border-radius: 0;
  border: 1px solid var(--border);
  background: rgba(5, 5, 5, 0.65);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.post-program__cmd-picker-btn::after,
.ternary-program__cmd-picker-btn::after {
  content: "▾";
  flex-shrink: 0;
  font-size: 0.75rem;
  opacity: 0.55;
}

.post-program__cmd-picker-btn:hover,
.ternary-program__cmd-picker-btn:hover {
  border-color: var(--border-strong);
  background: rgba(8, 8, 8, 0.85);
}

.post-program__cmd-picker.is-open .post-program__cmd-picker-btn,
.ternary-program__cmd-picker.is-open .ternary-program__cmd-picker-btn {
  border-color: rgba(108, 182, 255, 0.45);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.post-program__cmd-picker-menu,
.ternary-program__cmd-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 50;
  max-height: 15rem;
  overflow-y: auto;
  border-radius: 0;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  box-shadow: none;
}

.post-program__cmd-picker-option,
.ternary-program__cmd-picker-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.6rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.35;
  cursor: pointer;
}

.post-program__cmd-picker-option:hover,
.ternary-program__cmd-picker-option:hover {
  background: var(--accent-soft);
}

.post-program__cmd-picker-option.is-active,
.ternary-program__cmd-picker-option.is-active {
  color: var(--accent-2);
  font-weight: 600;
}

.post-machine__program-card,
.ternary-machine__program-card {
  overflow: visible;
}

.post-program__scroll,
.ternary-program__scroll {
  overflow-x: auto;
  overflow-y: visible;
}

.post-program__table td,
.ternary-program__table td {
  overflow: visible;
}

.post-program__col-jump {
  width: 9rem;
  white-space: nowrap;
}

.post-program__col-jump input {
  width: 3.5rem;
  min-width: 2.75rem;
  padding: 0.35rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  pointer-events: auto;
  cursor: text;
  -moz-appearance: textfield;
  appearance: textfield;
}

.post-program__col-jump input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.post-program__col-jump input::-webkit-outer-spin-button,
.post-program__col-jump input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.post-program__col-comment input {
  width: 100%;
  min-width: 8rem;
}

.post-program__col-actions {
  width: 2.5rem;
}

.post-program__cmd,
.post-program__comment {
  width: 100%;
}

.post-program__toolbar-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-right: 0.15rem;
}

.post-program__toolbar-hint {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-faint);
}

.post-program__row-btn {
  min-width: 2.35rem;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  background: rgba(5, 5, 5, 0.55);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  transition: transform var(--dur-fast) var(--ease-out);
}

.post-program__row-btn:hover {
  transform: scale(1.06);
}

.post-program__row-btn:active {
  transform: scale(0.94);
}

.post-program__table tr.is-selected td {
  background: rgba(108, 182, 255, 0.1);
  box-shadow: none;
}

.post-program__table tr.is-selected .post-program__col-n {
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.post-program__col-n {
  cursor: pointer;
  user-select: none;
}

.post-program__table tr.is-active.is-selected td {
  background: rgba(240, 240, 240, 0.14);
  box-shadow: none;
}

.post-program__del {
  min-width: 2.35rem;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  background: rgba(108, 182, 255, 0.18);
  border-color: rgba(108, 182, 255, 0.42);
  color: rgba(108, 182, 255, 0.98);
}

.post-program__del:hover {
  transform: scale(1.08);
}

.post-program__del:active {
  transform: scale(0.94);
}

.post-machine__cell-val.has-mark {
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
}

.post-machine__cell-val:not(.has-mark) {
  color: var(--text-faint);
  font-size: 1.1rem;
}

.post-machine__hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* —— Инструкции (двоичная / троичная машина) —— */
.machine-instructions-card {
  padding: 0;
  overflow: hidden;
}

.machine-instructions-card .machine-instructions {
  margin: 0;
}

/* —— Машина Поста: импорт решения от ИИ —— */
.post-machine__ai-card,
.ternary-machine__ai-card {
  padding: 0;
  overflow: hidden;
}

.machine-ai {
  border-radius: 0;
}

.machine-ai__summary {
  padding: 0.85rem 1rem;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  list-style: none;
  color: var(--accent-2);
}

.machine-ai__summary::-webkit-details-marker {
  display: none;
}

.machine-ai__body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

.machine-ai__steps {
  margin: 0.75rem 0 0.85rem;
  padding-left: 1.2rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.machine-ai__steps li + li {
  margin-top: 0.35rem;
}

.machine-ai__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.machine-ai__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-faint);
}

.machine-ai__json {
  width: 100%;
  min-height: 7rem;
  padding: 0.65rem 0.75rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  line-height: 1.45;
  border-radius: 0;
  border: 1px solid var(--border-strong);
  background: rgba(5, 5, 5, 0.65);
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}

.machine-ai__json:focus {
  outline: 2px solid rgba(108, 182, 255, 0.45);
  border-color: rgba(108, 182, 255, 0.5);
}

.machine-ai__hint {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-faint);
}

.machine-ai__hint code {
  font-size: 0.72rem;
}

.machine-instructions {
  border-radius: 0;
  border: 1px solid var(--border);
  background: rgba(5, 5, 5, 0.55);
}

.machine-instructions__summary {
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.machine-instructions__summary::-webkit-details-marker {
  display: none;
}

.machine-instructions__summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.2s ease;
}

.machine-instructions[open] .machine-instructions__summary::before {
  transform: rotate(90deg);
}

.machine-instructions__body {
  padding: 0 1rem 1rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.machine-instructions__intro {
  margin: 0 0 0.85rem;
  color: var(--text);
}

.machine-instructions__section + .machine-instructions__section {
  margin-top: 0.75rem;
}

.machine-instructions__heading {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.machine-instructions__list {
  margin: 0;
  padding-left: 1.15rem;
}

.machine-instructions__list li + li {
  margin-top: 0.25rem;
}

.machine-instructions__cmds {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
}

.machine-instructions__cmds dt {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-2);
}

.machine-instructions__cmds dd {
  margin: 0;
}

/* —— Diff —— */
.tool-stage--diff .tool-panel-grid--2 {
  align-items: stretch;
}

.tool-stage--diff .tool-panel-grid--2 > .card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.tool-stage--diff .tool-panel-grid--2 .field {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
  min-height: 0;
}

.tool-stage--diff .diff-input {
  flex: 1;
  width: 100%;
  min-height: 220px;
  height: 100%;
  resize: none;
}

.diff-stage .diff-output {
  max-height: min(40vh, 360px);
  overflow-y: auto;
  padding: 0.5rem 0;
  border-radius: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.diff-stage .diff-line,
.tool-stage--diff .diff-line {
  padding: 0.2rem 0.75rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ternary machine */
}

.tool-stage--ternary-machine {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-sizing: border-box;
}

.ternary-machine__tape-sticky {
  position: fixed;
  top: var(--ternary-workspace-bar-h, 5.5rem);
  left: var(--sidebar-w);
  right: 0;
  z-index: 25;
  padding: 0.5rem 1.5rem 0.65rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  /* Пропускаем клики в пустые зоны — иначе таблица программы под блоком не получает фокус */
  pointer-events: none;
}

.ternary-machine__tape-sticky-inner {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: auto;
}

.ternary-machine__tape-row {
  display: flex;
  align-items: stretch;
  gap: 0.65rem;
}

.ternary-machine__tape-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.ternary-machine__tape-side .btn {
  white-space: nowrap;
}

.ternary-machine__tape-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

@media (max-width: 720px) {
  .ternary-machine__tape-row {
    flex-direction: column;
  }

  .ternary-machine__tape-side {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .ternary-machine__tape-side--right {
    order: 3;
  }
}

@media (max-width: 860px) {
  .ternary-machine__tape-sticky {
    left: 0;
    padding-left: 1rem;
    padding-right: 1rem;
  }

}

.ternary-machine__hero--compact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.85rem 1rem;
  margin-bottom: 0;
}

.ternary-machine__hero--compact .ternary-machine__meta {
  margin-bottom: 0.5rem;
}

.ternary-machine__hero--compact .ternary-machine__status {
  margin: 0;
  font-size: 0.78rem;
}

.ternary-machine__fold {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.15rem;
}

.ternary-machine__fold-label {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.ternary-machine__fold-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 0.45rem 0.65rem;
}

.ternary-machine__task-card .ternary-machine__task {
  min-height: 3.5rem;
}

.ternary-machine__program-card {
  position: relative;
  z-index: 2;
  margin-bottom: 0;
  overflow: visible;
}

.ternary-machine__program-host,
.ternary-program {
  overflow: visible;
}

.ternary-machine__program-card .ternary-program__toolbar {
  position: sticky;
  top: var(--ternary-tape-sticky-h, 12rem);
  z-index: 24;
  margin: 0 -1.25rem 0.5rem;
  padding: 0.45rem 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

.ternary-program__toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.ternary-program__scroll {
  overflow: visible;
}

.tool-hero {
  text-align: center;
  padding: 1.5rem 1.25rem;
  border-radius: 0;
  border: 1px solid var(--border);
  background: rgba(5, 5, 5, 0.82);
  backdrop-filter: blur(14px);
  box-shadow: none;
}

.tool-hero__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.65rem;
}

.tool-panel-grid {
  display: grid;
  gap: 1rem;
}

.tool-panel-grid--2 {
  grid-template-columns: 1fr 1fr;
}

/* В рядом стоящих колонках не добавляем верхний отступ второй карточке */
.tool-panel-grid--2 > .card + .card {
  margin-top: 0;
}

@media (max-width: 720px) {
  .tool-panel-grid--2 {
    grid-template-columns: 1fr;
  }

  .tool-panel-grid--2 > .card + .card {
    margin-top: 1rem;
  }
}

/* —— Регистр —— */
.case-hero__preview {
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent-2);
  word-break: break-all;
  min-height: 2.5rem;
}

/* —— Пароль —— */
.pw-hero__value {
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  word-break: break-all;
  min-height: 2.5rem;
  color: var(--text);
}

.pw-strength {
  margin-top: 1rem;
  height: 6px;
  border-radius: 0;
  background: var(--surface-active);
  overflow: hidden;
}

.pw-strength__bar {
  height: 100%;
  width: 0%;
  border-radius: 0;
  background: linear-gradient(90deg, var(--danger), var(--warning), var(--success));
  transition: width 0.45s var(--ease-flow-out);
}

.pw-strength__hint {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* —— Счётчик —— */
.counter-hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.counter-hero__item {
  padding: 1rem 0.5rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.6);
  border: 1px solid var(--border);
}

.counter-hero__item .card__title {
  margin-bottom: 0.35rem;
}

.counter-hero__item .stat {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}

@media (max-width: 640px) {
  .counter-hero {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* —— Машина Поста —— */
.ternary-machine__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.ternary-machine__state {
  color: var(--accent-2);
  font-weight: 600;
}

.ternary-machine__steps {
  color: var(--text-muted);
}

.ternary-machine__tape-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  width: 100%;
  max-width: 100%;
}

.ternary-machine__pan {
  flex-shrink: 0;
  align-self: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 0;
  border: 1px solid var(--border-strong);
  background: rgba(5, 5, 5, 0.55);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  transition: transform var(--dur-fast) var(--ease-out);
}

.ternary-machine__pan:hover:not(:disabled) {
  transform: scale(1.06);
}

.ternary-machine__pan:active:not(:disabled) {
  transform: scale(0.94);
}

.ternary-machine__tape-track {
  flex: 1;
  min-width: 0;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.35);
  border: 1px solid var(--border);
  overflow: hidden;
}

.ternary-machine__tape-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.4rem 0.35rem 0.55rem;
  scrollbar-width: thin;
}

.ternary-machine__cells {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  width: max-content;
  min-height: 4.5rem;
  align-items: flex-end;
}

.ternary-machine__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.ternary-machine__head-slot {
  width: 1.65rem;
  height: 1.35rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  line-height: 1;
  border-radius: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out);
}

.ternary-machine__head-slot:hover:not(:disabled) {
  transform: scale(1.08);
}

.ternary-machine__head-slot.is-active {
  color: rgba(108, 182, 255, 0.9);
  background: rgba(108, 182, 255, 0.14);
  border-color: rgba(108, 182, 255, 0.28);
  transform: scale(1.08);
}

.ternary-machine__col.is-head-col .ternary-machine__cell {
  border-color: rgba(108, 182, 255, 0.45);
}

.ternary-machine__cell {
  flex-shrink: 0;
  width: 2.35rem;
  padding: 0.35rem 0.15rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-family: var(--font-mono);
  border-radius: 0;
  border: 1px solid var(--border);
  background: rgba(5, 5, 5, 0.65);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 0.3s ease,
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.ternary-machine__cell:hover {
  border-color: rgba(108, 182, 255, 0.35);
  background: rgba(8, 8, 8, 0.85);
}

.ternary-machine__cell.is-under-head {
  border-color: rgba(108, 182, 255, 0.45);
  background: var(--accent-soft);
}

.ternary-machine__cell-val {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1;
}

.ternary-machine__cell-idx {
  font-size: 0.58rem;
  color: var(--text-faint);
  line-height: 1;
}

.ternary-machine__tape-hint {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: var(--text-faint);
  line-height: 1.4;
}

.ternary-machine__status {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ternary-machine__task {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  line-height: 1.55;
}

.ternary-machine__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.ternary-machine__speed {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ternary-machine__tape-side--right .ternary-machine__speed {
  margin-top: 0.15rem;
}

.ternary-machine__speed select {
  width: auto;
  min-width: 7rem;
}

.ternary-program__scroll {
  overflow-x: auto;
  border-radius: 0;
  border: 1px solid var(--border);
}

.ternary-program__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.ternary-program__table th,
.ternary-program__table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.ternary-program__table th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  background: rgba(5, 5, 5, 0.6);
}

.ternary-program__table tr.is-active td {
  background: rgba(240, 240, 240, 0.12);
}

.ternary-program__table tr.is-active .ternary-program__col-n {
  color: var(--success);
  font-weight: 700;
}

.ternary-program__col-drag {
  width: 1.75rem;
  padding-left: 0.35rem;
  padding-right: 0.15rem;
}

.ternary-program__drag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  font-size: 0.7rem;
  letter-spacing: -0.12em;
  color: var(--text-faint);
  border-radius: 0;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: transform var(--dur-fast) var(--ease-out);
}

.ternary-program__drag:hover {
  transform: scale(1.12);
}

.ternary-program__drag:active {
  cursor: grabbing;
  transform: scale(0.95);
}

.ternary-program__col-n {
  width: 2.25rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.ternary-program__line-num {
  display: inline-block;
  min-width: 1.25rem;
  text-align: center;
}

.ternary-program__table tbody tr {
  transition:
    transform 0.38s var(--ease-flow-out),
    opacity 0.22s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.ternary-program__table tr.is-dragging {
  opacity: 0.42;
}

.ternary-program__table tr.is-dragging .ternary-program__drag {
  cursor: grabbing;
  color: var(--accent-2);
}

.ternary-program__table tr.is-drop-before td {
  box-shadow: none;
}

.ternary-program__table tr.is-drop-after td {
  box-shadow: none;
}

.ternary-program__drag-ghost {
  opacity: 0.92;
  background: rgba(5, 5, 5, 0.95);
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .ternary-program__table tbody tr {
    transition: background 0.2s ease, box-shadow 0.2s ease;
  }
}

.ternary-program__col-cmd {
  width: 11rem;
}

.ternary-program__col-jump {
  width: 9rem;
  white-space: nowrap;
}

.ternary-program__col-jump input {
  width: 3.5rem;
  min-width: 2.75rem;
  padding: 0.35rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  pointer-events: auto;
  cursor: text;
  -moz-appearance: textfield;
  appearance: textfield;
}

.ternary-program__col-jump input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ternary-program__col-jump input::-webkit-outer-spin-button,
.ternary-program__col-jump input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ternary-program__col-comment input {
  width: 100%;
  min-width: 8rem;
}

.ternary-program__col-actions {
  width: 2.5rem;
}

.ternary-program__cmd,
.ternary-program__comment {
  width: 100%;
}

.ternary-program__toolbar-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-right: 0.15rem;
}

.ternary-program__toolbar-hint {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-faint);
}

.ternary-program__row-btn {
  min-width: 2.35rem;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  background: rgba(5, 5, 5, 0.55);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  transition: transform var(--dur-fast) var(--ease-out);
}

.ternary-program__row-btn:hover {
  transform: scale(1.06);
}

.ternary-program__row-btn:active {
  transform: scale(0.94);
}

.ternary-program__table tr.is-selected td {
  background: rgba(108, 182, 255, 0.1);
  box-shadow: none;
}

.ternary-program__table tr.is-selected .ternary-program__col-n {
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.ternary-program__col-n {
  cursor: pointer;
  user-select: none;
}

.ternary-program__table tr.is-active.is-selected td {
  background: rgba(240, 240, 240, 0.14);
  box-shadow: none;
}

.ternary-program__del {
  min-width: 2.35rem;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  background: rgba(108, 182, 255, 0.18);
  border-color: rgba(108, 182, 255, 0.42);
  color: rgba(108, 182, 255, 0.98);
}

.ternary-program__del:hover {
  transform: scale(1.08);
}

.ternary-program__del:active {
  transform: scale(0.94);
}

.ternary-machine__cell-val.has-mark {
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
}

.ternary-machine__cell-val:not(.has-mark) {
  color: var(--text-faint);
  font-size: 1.1rem;
}

.ternary-machine__hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.tool-backdrop--ternary-machine {
  background: radial-gradient(ellipse 60% 45% at 60% 20%, rgba(108, 182, 255, 0.08), transparent 55%);
}

.ternary-program__col-jump {
  width: 13rem;
}

.ternary-program__col-jump input {
  width: 3rem;
  min-width: 2.5rem;
}

.ternary-machine__cell-val.tone-zero {
  color: var(--accent-2);
  font-size: 1.35rem;
}

.ternary-machine__cell-val.tone-one {
  color: var(--text);
  font-size: 1.35rem;
}

.ternary-machine__cell-val:not(.has-mark) {
  color: var(--text-faint);
  font-size: 1.1rem;
}

/* —— Синтез счётчика —— */
.tool-backdrop--counter-synthesis-jk {
  background: radial-gradient(ellipse 55% 45% at 30% 15%, rgba(240, 240, 240, 0.08), transparent 55%);
}

.tool-backdrop--counter-synthesis-d {
  background: radial-gradient(ellipse 55% 45% at 70% 20%, rgba(108, 182, 255, 0.1), transparent 55%);
}

.tool-stage--synthesis {
  width: min(960px, 100%);
}

/* —— Electronic Workbench (beta) —— */
.tool-backdrop--electronic-workbench {
  background:
    radial-gradient(ellipse 60% 50% at 20% 12%, rgba(108, 182, 255, 0.12), transparent 58%),
    radial-gradient(ellipse 45% 40% at 85% 15%, rgba(240, 240, 240, 0.08), transparent 62%);
}

.tool-stage--ewb {
  width: 100%;
  max-width: none;
}

.ewb {
  border: 1px solid var(--border-strong);
  border-radius: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(8, 8, 8, 0.7), rgba(5, 5, 5, 0.95));
  box-shadow: none;
  min-height: calc(100vh - 8.5rem);
}

.ewb__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 5, 5, 0.5);
  align-items: flex-start;
  justify-content: space-between;
}

.ewb__toolbar--row .ewb__mode-note {
  flex: 1 1 14rem;
  margin-right: 0.75rem;
}

.ewb__toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

/* Невидимый широкий контур для клика по проводу */
.ewb__wire-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  pointer-events: stroke;
}

.ewb__wire-group {
  pointer-events: bounding-box;
}

.ewb__wire-group.is-selected .ewb__wire-hit {
  stroke: rgba(108, 182, 255, 0.12);
}

.ewb__wire--selected {
  stroke: var(--accent, #94a3b8);
  stroke-width: 2.35;
  filter: none;
}

.ewb__mode-note {
  font-size: 0.75rem;
  color: var(--text-faint);
  line-height: 1.4;
}

.ewb__workspace {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr) 22rem;
  height: calc(100vh - 13rem);
  min-height: 32rem;
}

.ewb__canvas-wrap {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: #d4d4d4;
  overflow: hidden;
  cursor: grab;
}

.ewb__canvas-wrap:active {
  cursor: grabbing;
}

.ewb__canvas {
  width: 100%;
  height: 100%;
  min-height: 32rem;
  display: block;
  background: linear-gradient(180deg, #d4d4d4, #d4d4d4);
  touch-action: none;
}

.ewb__node-body {
  fill: #9ca3af;
  stroke: #94a3b8;
  stroke-width: 1.6;
  filter: none;
  pointer-events: none;
}

/* Зона захвата курсора над корпусом; пины ниже по порядку рисования получают клик первыми. */
.ewb__node-hit {
  /* fill задаётся в SVG для надёжного hit-test во всех движках */
  stroke: none;
  cursor: grab;
  pointer-events: auto;
}

.ewb__node-hit:active {
  cursor: grabbing;
}

.ewb__node-body--gate {
  fill: #9ca3af;
}

.ewb__node-body--ff {
  fill: #9ca3af;
  stroke: #94a3b8;
}

.ewb__node-body--clock {
  fill: #9ca3af;
  stroke: #5ba32b;
}

.ewb__node-invert-bubble {
  fill: #9ca3af;
  stroke: #94a3b8;
  stroke-width: 1.2;
  pointer-events: none;
}

.ewb__node.is-active .ewb__node-body {
  stroke: #94a3b8;
  stroke-width: 2;
}

.ewb__node-text {
  fill: #94a3b8;
  font: 700 10.5px var(--font-mono);
  pointer-events: none;
  letter-spacing: 0.02em;
}

.ewb__node-state {
  fill: #94a3b8;
  font: 700 8.2px var(--font-mono);
  pointer-events: none;
}

.ewb__wire {
  stroke: #94a3b8;
  stroke-width: 1.85;
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0.94;
}

.ewb__wire--high {
  stroke: #e94142;
  stroke-width: 2.25;
  opacity: 1;
}

.ewb__wire--low {
  stroke: #94a3b8;
  stroke-width: 2;
  opacity: 1;
}

.ewb__wire-group.is-selected .ewb__wire--high,
.ewb__wire-group.is-selected .ewb__wire--low {
  filter: none;
}

.ewb__7seg-frame {
  fill: #94a3b8;
  stroke: #94a3b8;
  stroke-width: 1.4;
  pointer-events: none;
}

.ewb__7seg-seg {
  fill: none;
  stroke-linecap: round;
  pointer-events: none;
}

.ewb__7seg-seg--on {
  stroke: #e94142;
  stroke-width: 3.6;
  filter: none;
}

.ewb__7seg-seg--off {
  stroke: #94a3b8;
  stroke-width: 2.2;
  opacity: 0.45;
}

.ewb__wire--preview {
  stroke: #94a3b8;
  stroke-dasharray: 6 4;
  opacity: 0.9;
}

.ewb__pin {
  fill: #9ca3af;
  stroke: #94a3b8;
  stroke-width: 1.3;
  cursor: crosshair;
  transition: transform 0.12s ease, fill 0.12s ease;
  transform-box: fill-box;
  transform-origin: center;
}

.ewb__pin--out {
  fill: #9ca3af;
  stroke: #5ba32b;
}

.ewb__pin--in {
  fill: #9ca3af;
  stroke: #94a3b8;
}

.ewb__pin:hover {
  transform: scale(1.2);
  fill: #9ca3af;
}

.ewb__palette {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ewb__palette-item {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 0;
  background: rgba(5, 5, 5, 0.44);
  color: var(--text);
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  cursor: grab;
}

.ewb__palette-item:active {
  cursor: grabbing;
}

.ewb__eq-input {
  width: 100%;
  resize: vertical;
  min-height: 8.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.45;
}

.ewb__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.65rem 0;
}

.ewb__eq-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 12rem;
  overflow: auto;
}

.ewb__eq-item {
  border: 1px solid var(--border);
  border-radius: 0;
  background: rgba(5, 5, 5, 0.5);
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.ewb__eq-item--warn {
  border-color: rgba(108, 182, 255, 0.45);
  color: #94a3b8;
}

.ewb__hint {
  margin: 0 0 0.6rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.ewb__status {
  border-top: 1px solid var(--border);
  padding: 0.3rem 0.65rem;
  min-height: 1.8rem;
  display: flex;
  align-items: center;
  background: rgba(5, 5, 5, 0.2);
}

.ewb__status-text {
  font-size: 0.76rem;
  color: var(--text-faint);
}

@media (max-width: 1080px) {
  .ewb__workspace {
    grid-template-columns: 1fr;
  }
  .ewb__canvas-wrap {
    border-left: 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

.synthesis__steps-list {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.synthesis__params {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: flex-end;
  margin-bottom: 0.5rem;
}

.synthesis__params .field {
  margin: 0;
  min-width: 0;
}

.synthesis__params .field:first-child {
  flex: 0 0 auto;
}

.synthesis__params .field:last-child {
  flex: 1 1 10rem;
  max-width: 14rem;
}

.synthesis__params--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
}

.synthesis__params--stack .field {
  width: 100%;
}

.synthesis__params--stack .field:last-child {
  flex: 0 0 auto;
  max-width: none;
}

.synthesis__k-input {
  width: 5.5rem;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: 1.1rem;
}

.synthesis__seq-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.synthesis__seq-item {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.synthesis__seq-item:not(:last-child)::after {
  content: "×";
  position: absolute;
  right: -0.55rem;
  top: 50%;
  transform: translate(100%, -52%);
  color: var(--text-faint);
  font-size: 0.8rem;
  line-height: 1;
  pointer-events: none;
}

.synthesis__order-select {
  width: 100%;
  min-width: 9.5rem;
  max-width: 14rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.synthesis__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.25rem;
}

.synthesis__hint--save {
  margin-top: 0.65rem;
  margin-bottom: 0;
  font-size: 0.82rem;
  color: var(--text-faint);
}

.synthesis__out {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.synthesis__text,
.synthesis__hint {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.synthesis__formula {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--accent-2);
}

/* Таблицы синтеза — в теме панели */
.tool-stage--synthesis .synth-table-wrap {
  overflow-x: auto;
  margin: 0.75rem 0 0.25rem;
  border-radius: 0;
  border: 1px solid var(--border);
  background: rgba(5, 5, 5, 0.5);
  box-shadow: none;
}

.tool-stage--synthesis .synth-table-wrap--reference {
  max-width: 22rem;
}

.tool-stage--synthesis .synth-table--reference .synth-table__ref-val {
  font-weight: 700;
}

.tool-stage--synthesis .synth-table {
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  line-height: 1.3;
  width: 100%;
  min-width: max-content;
  color: var(--text);
}

.tool-stage--synthesis .synth-table th,
.tool-stage--synthesis .synth-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.55rem;
  text-align: center;
  vertical-align: middle;
  font-weight: normal;
}

.tool-stage--synthesis .synth-table thead th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  background: rgba(5, 5, 5, 0.85);
}

.tool-stage--synthesis .synth-table--transition thead tr:first-child th {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: rgba(240, 240, 240, 0.1);
  border-color: rgba(91, 163, 43, 0.18);
}

.tool-stage--synthesis .synth-table__caption {
  caption-side: top;
  text-align: center;
  padding: 0.65rem 0.75rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: transparent;
}

.tool-stage--synthesis .synth-table tbody tr:hover td {
  background: var(--surface-hover);
}

.tool-stage--synthesis .synth-table__next,
.tool-stage--synthesis .synth-table__next-head {
  background: var(--accent-soft);
}

.tool-stage--synthesis .synth-table__next-head {
  color: var(--accent);
}

.tool-stage--synthesis .synth-table__row--unused td {
  opacity: 0.42;
}

.tool-stage--synthesis .synth-table__dontcare,
.tool-stage--synthesis .synth-table--excitation td.synth-table__dontcare,
.tool-stage--synthesis .synth-table--reference .synth-table__dontcare {
  color: #e94142;
  font-weight: 700;
}

.tool-stage--synthesis .synth-table--excitation {
  width: max-content;
  min-width: 100%;
}

.tool-stage--synthesis .synth-table--excitation th,
.tool-stage--synthesis .synth-table--excitation td {
  min-width: 2.25rem;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: nowrap;
}

.tool-stage--synthesis .synth-table--excitation td[data-jk="k"]:not(.synth-table__dontcare) {
  font-weight: 600;
}

.tool-stage--synthesis .synth-kmap-block {
  margin-top: 0.75rem;
  text-align: center;
}

.tool-stage--synthesis .synth-kmap-block__title {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
  color: var(--text-faint);
}

.tool-stage--synthesis .synth-kmap-block__subtitle {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tool-stage--synthesis .synth-kmap-block__dc-note {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-faint);
}

.synth-kmap-wrap {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  padding: 0.25rem 0 0.5rem;
}

.synth-kmap__frame {
  position: relative;
  display: inline-block;
  padding: 0.15rem;
}

.synth-kmap__chart {
  position: relative;
  display: inline-block;
  padding: 1.35rem 1.5rem 1.35rem 1.35rem;
  box-sizing: border-box;
}

.synth-kmap__chart-body {
  position: relative;
  z-index: 1;
}

.synth-kmap__varbars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 3;
}

.synth-kmap__cells {
  position: relative;
  display: inline-block;
  --kmap-gutter-w: 3.35rem;
  --kmap-gutter-h: 2.5rem;
}

.synth-kmap__loops {
  position: absolute;
  left: calc(var(--kmap-gutter-w) + 1px);
  top: calc(var(--kmap-gutter-h) + 1px);
  pointer-events: none;
  overflow: visible;
  z-index: 2;
}

.synth-kmap__varbar-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  fill: var(--accent-2);
  pointer-events: none;
}

.synth-kmap__varbar-line {
  pointer-events: none;
}

.synth-kmap__grid {
  --kmap-cell: 4.5rem;
  --kmap-gutter-w: 3.35rem;
  --kmap-gutter-h: 2.5rem;
  display: grid;
  grid-template-columns: var(--kmap-gutter-w) repeat(var(--kmap-cols), var(--kmap-cell));
  grid-template-rows: var(--kmap-gutter-h) repeat(var(--kmap-rows), var(--kmap-cell));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border-strong);
  border-radius: 0;
  overflow: hidden;
}

.synth-kmap__corner {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  padding: 0.28rem 0.32rem;
  background: var(--surface-active);
  min-width: var(--kmap-gutter-w);
  min-height: var(--kmap-gutter-h);
  overflow: hidden;
  box-sizing: border-box;
}

.synth-kmap__corner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top right,
    transparent calc(50% - 0.5px),
    var(--border-strong) calc(50% - 0.5px),
    var(--border-strong) calc(50% + 0.5px),
    transparent calc(50% + 0.5px)
  );
  pointer-events: none;
  z-index: 0;
}

.synth-kmap__corner-col,
.synth-kmap__corner-row,
.synth-kmap__corner-single {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  line-height: 1.15;
  white-space: nowrap;
}

.synth-kmap__corner-col {
  align-self: flex-end;
  text-align: right;
}

.synth-kmap__corner-row {
  align-self: flex-start;
  text-align: left;
}

.synth-kmap__corner-single {
  margin: auto;
  text-align: center;
}

.synth-kmap__axis {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-active);
}

.synth-kmap__axis--col {
  letter-spacing: 0.06em;
}

.synth-kmap__axis--row {
  letter-spacing: 0.04em;
}

.synth-kmap__cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  min-height: var(--kmap-cell);
  min-width: var(--kmap-cell);
}

.synth-kmap__idx {
  position: absolute;
  top: 0.35rem;
  left: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-faint);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.synth-kmap__val {
  font-family: var(--font-mono);
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-muted);
}

.synth-kmap__val--one {
  color: var(--success);
}

.synth-kmap__val--dc {
  color: #e94142;
  font-weight: 600;
}

.synth-kmap__val--zero {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 1.25rem;
  opacity: 0.55;
}

.synth-kmap__loop {
  pointer-events: none;
  opacity: 0.38;
}

.synth-kmap__loop--open {
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-color-scheme: light) {
  :root.auto-theme .tool-stage--synthesis .synth-table-wrap {
    background: var(--surface-hover);
  }

  :root.auto-theme .tool-stage--synthesis .synth-table thead th {
    background: var(--surface-active);
  }

  :root.auto-theme .tool-stage--synthesis .synth-table--transition thead tr:first-child th {
    background: rgba(240, 240, 240, 0.14);
  }
}

.synth-kmap-guide {
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-hover);
}

.synth-kmap-guide summary {
  cursor: pointer;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-2);
  list-style: none;
}

.synth-kmap-guide summary::-webkit-details-marker {
  display: none;
}

.synth-kmap-guide__body {
  padding: 0 0.85rem 0.85rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.synth-kmap-guide__body p {
  margin: 0 0 0.55rem;
}

.synth-kmap-guide__steps {
  margin: 0 0 0.55rem;
  padding-left: 1.2rem;
}

.synth-kmap-guide__steps li {
  margin-bottom: 0.45rem;
}

.synth-kmap-guide__example {
  margin: 0;
  padding: 0.5rem 0.65rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0;
}

.synth-kmap__legend {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: left;
}

.synth-kmap__legend-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.68rem;
}

.synth-kmap__groups {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.synth-kmap__groups li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.synth-kmap__groups code {
  font-family: var(--font-mono);
  color: var(--accent-2);
}

.synth-kmap__group-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 0;
  flex-shrink: 0;
  border: 2.5px solid currentColor;
  background: transparent;
}

.synthesis__wiring-guide {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.synthesis__wiring-guide .synthesis__text {
  margin-bottom: 0.6rem;
}

.synthesis__wiring-guide ol {
  margin: 0.35rem 0 0;
  padding-left: 1.35rem;
  line-height: 1.55;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.synthesis__wiring-guide li {
  margin-bottom: 0.45rem;
}

.synthesis__kmaps {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.synthesis__ff-block {
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}

.synthesis__ff-block:first-child {
  border-top: none;
  padding-top: 0;
}

/* —— P2P-комната (WebRTC + чат в стиле Telegram) —— */
.p2p-room-root .card {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}


.workspace__body.has-tool-backdrop:has(.p2p-room-root) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.workspace__body.has-tool-backdrop:has(.p2p-room-root) .tool-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.p2p-room-tool-root,
.p2p-room-root {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.p2p-room-root > .card {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  border-radius: 0;
}

.p2p-room__stack {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 0;
  margin: 0;
  align-self: stretch;
}

.p2p-room__workspace {
  position: relative;
  display: flex;
  flex: 1;
  align-items: stretch;
  align-self: stretch;
  gap: 0;
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(12, 12, 12, 0.1), transparent 55%),
    #0d1117;
  border: 1px solid rgba(128, 128, 128, 0.06);
  box-shadow: none;
}

.p2p-room__workspace::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(108, 182, 255, 0.35) 50%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}

.p2p-room__messenger-layout {
  display: flex;
  flex: 1;
  align-items: stretch;
  min-height: 0;
  min-width: 0;
  width: 100%;
}

.p2p-room__messenger-layout > .p2p-room__messenger {
  flex: 1;
  min-width: 0;
}

.p2p-room__history-panel {
  flex: 0 0 clamp(240px, 24vw, 320px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 0;
  background: linear-gradient(165deg, #161b22 0%, #0d1117 48%, #0d1117 100%);
  border: none;
  border-right: 1px solid rgba(128, 128, 128, 0.08);
  box-shadow: none;
  overflow: hidden;
}

.p2p-room__history-head {
  flex-shrink: 0;
  padding: 0.85rem 1rem 0.8rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.07);
  background: linear-gradient(180deg, rgba(108, 182, 255, 0.08) 0%, transparent 100%);
}

.p2p-room__history-head-inner {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.p2p-room__history-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #d4d4d4;
}

.p2p-room__history-sub {
  font-size: 0.74rem;
  color: #94a3b8;
}

.p2p-room__history-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0.55rem 0.65rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(108, 182, 255, 0.35) transparent;
}

.p2p-room__history-list::-webkit-scrollbar {
  width: 6px;
}

.p2p-room__history-list::-webkit-scrollbar-thumb {
  border-radius: 0;
  background: rgba(108, 182, 255, 0.28);
}

.p2p-room__history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.45rem;
  margin: 1.5rem 0.75rem 1rem;
  padding: 1.1rem 0.85rem;
  border-radius: 0;
  border: 1px dashed rgba(108, 182, 255, 0.2);
  background: rgba(240, 240, 240, 0.03);
}

.p2p-room__history-empty-icon {
  font-size: 1.75rem;
  line-height: 1;
  opacity: 0.55;
}

.p2p-room__history-empty-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: #d4d4d4;
}

.p2p-room__history-empty-text {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #94a3b8;
  max-width: 14rem;
}

.p2p-room__history-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  width: 100%;
  margin-bottom: 0.4rem;
  padding: 0.62rem 0.65rem 0.62rem 0.58rem;
  border: none;
  border-radius: 0;
  background: rgba(240, 240, 240, 0.035);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background var(--dur-fast),
    transform var(--dur-fast),
    box-shadow var(--dur-fast);
}

.p2p-room__history-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  bottom: 0.45rem;
  width: 3px;
  border-radius: 0;
  background: transparent;
  transition: background var(--dur-fast);
}

.p2p-room__history-item:hover {
  background: rgba(240, 240, 240, 0.07);
  transform: translateX(1px);
}

.p2p-room__history-item.is-active {
  background: linear-gradient(
    90deg,
    rgba(108, 182, 255, 0.22) 0%,
    rgba(108, 182, 255, 0.08) 100%
  );
  box-shadow: none;
}

.p2p-room__history-item.is-active::before {
  background: #94a3b8;
}

.p2p-room__history-item.is-live:not(.is-active) {
  background: rgba(91, 163, 43, 0.08);
  box-shadow: none;
}

.p2p-room__history-avatar {
  position: relative;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--nick-color, #94a3b8) 28%, #161b22);
  box-shadow: none;
}

.p2p-room__history-avatar-letter {
  font-size: 0.92rem;
  font-weight: 700;
  color: #d4d4d4;
  text-transform: uppercase;
}

.p2p-room__history-live {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 0;
  background: #5ba32b;
  border: 2px solid #94a3b8;
  box-shadow: none;
}

.p2p-room__history-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
  flex: 1;
}

.p2p-room__history-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
  width: 100%;
}

.p2p-room__history-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #d4d4d4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.p2p-room__history-item-top-end {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.p2p-room__history-time {
  font-size: 0.68rem;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.p2p-room__history-msg-count {
  min-width: 1.15rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: #d4d4d4;
  background: rgba(108, 182, 255, 0.28);
}

.p2p-room__history-item.is-active .p2p-room__history-msg-count {
  background: rgba(108, 182, 255, 0.45);
}

.p2p-room__history-room {
  font-size: 0.9rem;
  font-weight: 600;
  color: #d4d4d4;
  word-break: break-word;
}

.p2p-room__history-label {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
}

.p2p-room__history-id {
  font-size: 0.68rem;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.p2p-room__room-id-locked {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 0;
  background: #161b22;
  color: #94a3b8;
  font-family: ui-monospace, monospace;
  font-size: 0.88rem;
  word-break: break-all;
  user-select: all;
}

.p2p-room__history-preview {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.p2p-room__history-item.is-active .p2p-room__history-preview {
  color: #d4d4d4;
}

.p2p-room__history-meta {
  font-size: 0.72rem;
  color: #94a3b8;
}

.p2p-room__archive-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 0.55rem 0.85rem;
  background: rgba(108, 182, 255, 0.1);
  border-bottom: 1px solid rgba(108, 182, 255, 0.18);
}

.p2p-room__archive-bar[hidden] {
  display: none;
}

.p2p-room__archive-hint {
  font-size: 0.78rem;
  line-height: 1.35;
  color: #94a3b8;
}

.p2p-room__archive-reconnect {
  flex-shrink: 0;
  padding: 0.45rem 0.9rem;
  border: none;
  border-radius: 0;
  background: linear-gradient(180deg, #94a3b8 0%, #94a3b8 100%);
  color: #d4d4d4;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition:
    filter var(--dur-fast),
    transform var(--dur-fast);
}

.p2p-room__archive-reconnect:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.p2p-room__stage {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  align-self: stretch;
}

.p2p-room__main-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.p2p-room__tabs-root {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: none;
  min-height: 0;
  min-width: 0;
  align-self: stretch;
}

.p2p-room__room-tabs {
  display: none;
}

.p2p-room__room-tab {
  flex-shrink: 0;
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: rgba(240, 240, 240, 0.65);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    color var(--dur-fast),
    background var(--dur-fast);
}

.p2p-room__room-tab:hover {
  color: #d4d4d4;
  background: rgba(240, 240, 240, 0.05);
}

.p2p-room__room-tab.is-active {
  color: #94a3b8;
  background: rgba(108, 182, 255, 0.12);
  box-shadow: none;
}

.p2p-room__tab-panels {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.p2p-room__tab-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.p2p-room__tab-panel.is-active {
  display: flex !important;
  width: 100%;
  max-width: none;
  align-self: stretch;
}

.p2p-room__tab-panel[hidden] {
  display: none !important;
}

.p2p-room__tab-panel-inner {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.p2p-room__tab-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 2rem 1.5rem;
  text-align: center;
  min-height: 12rem;
}

.p2p-room__tab-placeholder-icon {
  font-size: 2.5rem;
  line-height: 1;
  opacity: 0.85;
}

.p2p-room__tab-placeholder-title {
  margin: 0;
  font-size: 1.05rem;
  color: #d4d4d4;
}

.p2p-room__tab-placeholder-text {
  margin: 0;
  max-width: 22rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(240, 240, 240, 0.72);
}

/* —— P2P: общая доска —— */
.p2p-room__tabs-root[data-active-tab="board"] {
  flex: 1;
  min-height: 0;
}

.p2p-room__tab-panel#p2p-panel-board.is-active {
  flex: 1;
  min-height: 0;
}

.p2p-room-root:has(.p2p-room__tabs-root[data-active-tab="board"]) .p2p-room__workspace {
  min-height: 0;
  border: none;
  box-shadow: none;
}

.p2p-room-root:has(.p2p-room__tabs-root[data-active-tab="board"]) > .card {
  border: none;
  box-shadow: none;
}

.p2p-board {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: #161b22;
}

.p2p-board__body {
  flex: 1;
  display: flex;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  contain: layout style;
}

.p2p-board__toolbar {
  --p2p-board-bar-h: 2.5rem;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.07);
  background:
    linear-gradient(180deg, rgba(108, 182, 255, 0.07) 0%, transparent 42%),
    linear-gradient(165deg, #0d1117 0%, #0d1117 55%, #0d1117 100%);
  box-shadow: none;
}

.p2p-board__toolbar-main,
.p2p-board__toolbar-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.p2p-board__toolbar-end {
  margin-left: auto;
  padding-left: 0.55rem;
  border-left: 1px solid rgba(128, 128, 128, 0.08);
  flex-shrink: 0;
}

.p2p-board__tool-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  min-height: var(--p2p-board-bar-h);
  padding: 0.2rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.22);
  border: 1px solid rgba(128, 128, 128, 0.07);
  box-shadow: none;
}

.p2p-board__tool-group--colors {
  gap: 0.35rem;
  padding: 0.28rem 0.38rem;
}

.p2p-board__tool-group--actions {
  gap: 0.25rem;
  padding: 0.2rem 0.28rem;
}

.p2p-board__tool-btn,
.p2p-board__size-btn,
.p2p-board__action-btn {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.p2p-board__tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--p2p-board-bar-h);
  height: var(--p2p-board-bar-h);
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: rgba(240, 240, 240, 0.88);
  cursor: pointer;
  transition:
    background var(--dur-fast, 0.12s) ease,
    border-color var(--dur-fast, 0.12s) ease,
    color var(--dur-fast, 0.12s) ease,
    box-shadow var(--dur-fast, 0.12s) ease,
    transform var(--dur-fast, 0.12s) ease;
}

.p2p-board__tool-btn:hover {
  background: rgba(240, 240, 240, 0.09);
  border-color: rgba(128, 128, 128, 0.1);
}

.p2p-board__tool-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.p2p-board__tool-btn.is-active,
.p2p-board__tool-btn[aria-pressed="true"] {
  background: linear-gradient(165deg, rgba(108, 182, 255, 0.28) 0%, rgba(108, 182, 255, 0.12) 100%);
  border-color: rgba(108, 182, 255, 0.5);
  color: #d4d4d4;
  box-shadow: none;
}

.p2p-board__settings-toggle.is-active {
  background: linear-gradient(165deg, rgba(108, 182, 255, 0.28) 0%, rgba(108, 182, 255, 0.12) 100%);
  border-color: rgba(108, 182, 255, 0.5);
}

.p2p-board__tool-group--sizes {
  align-items: flex-end;
  gap: 0.3rem;
  padding: 0.28rem 0.42rem 0.32rem;
}

.p2p-board__size-btn {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 1.85rem;
  height: calc(var(--p2p-board-bar-h) - 0.15rem);
  padding: 0 0 0.12rem;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  transition:
    background var(--dur-fast, 0.12s) ease,
    border-color var(--dur-fast, 0.12s) ease;
}

.p2p-board__size-btn:hover {
  background: rgba(240, 240, 240, 0.08);
  border-color: rgba(128, 128, 128, 0.08);
}

.p2p-board__size-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.p2p-board__size-btn.is-active,
.p2p-board__size-btn[aria-pressed="true"] {
  background: rgba(108, 182, 255, 0.14);
  border-color: rgba(108, 182, 255, 0.35);
}

.p2p-board__size-dot {
  display: block;
  width: var(--dot, 10px);
  height: var(--dot, 10px);
  border-radius: 0;
  background: rgba(240, 240, 240, 0.92);
  box-shadow: none;
  transition:
    transform var(--dur-fast, 0.12s) ease,
    background var(--dur-fast, 0.12s) ease,
    box-shadow var(--dur-fast, 0.12s) ease;
}

.p2p-board__size-btn:hover .p2p-board__size-dot {
  transform: scale(1.06);
}

.p2p-board__size-btn.is-active .p2p-board__size-dot,
.p2p-board__size-btn[aria-pressed="true"] .p2p-board__size-dot {
  background: #94a3b8;
  box-shadow: none;
}

.p2p-board__brush-cursor {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 0;
  border: 2px solid rgba(128, 128, 128, 0.85);
  background: rgba(240, 240, 240, 0.08);
  pointer-events: none;
  z-index: 4;
  box-sizing: border-box;
  transition:
    width 0.08s ease-out,
    height 0.08s ease-out,
    border-color 0.12s;
}

.p2p-board__brush-cursor.is-hidden {
  display: none;
}

.p2p-board__tool-icon {
  font-size: 1.05rem;
  line-height: 1;
  filter: none;
}

.p2p-board__color-btn {
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border-radius: 0;
  border: 2px solid rgba(128, 128, 128, 0.18);
  background: var(--swatch, #d4d4d4);
  cursor: pointer;
  box-shadow: none;
  transition:
    transform var(--dur-fast, 0.12s) ease,
    border-color var(--dur-fast, 0.12s) ease,
    box-shadow var(--dur-fast, 0.12s) ease;
}

.p2p-board__color-btn:hover {
  transform: scale(1.1);
  border-color: rgba(128, 128, 128, 0.45);
}

.p2p-board__color-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.p2p-board__color-btn.is-active,
.p2p-board__color-btn[aria-pressed="true"] {
  border-color: #94a3b8;
  transform: scale(1.12);
  box-shadow: none;
}

.p2p-board__action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(128, 128, 128, 0.1);
  border-radius: 0;
  background: rgba(240, 240, 240, 0.04);
  color: rgba(240, 240, 240, 0.9);
  cursor: pointer;
  transition:
    background var(--dur-fast, 0.12s) ease,
    border-color var(--dur-fast, 0.12s) ease,
    color var(--dur-fast, 0.12s) ease,
    box-shadow var(--dur-fast, 0.12s) ease;
}

.p2p-board__action-btn--icon {
  width: var(--p2p-board-bar-h);
  height: var(--p2p-board-bar-h);
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
}

.p2p-board__action-btn--text {
  min-height: var(--p2p-board-bar-h);
  padding: 0 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.p2p-board__action-btn:hover {
  background: rgba(240, 240, 240, 0.1);
  border-color: rgba(128, 128, 128, 0.16);
  color: #d4d4d4;
}

.p2p-board__action-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.p2p-board__action-btn--text:hover {
  background: rgba(108, 182, 255, 0.12);
  border-color: rgba(108, 182, 255, 0.35);
  color: #e94142;
}

.p2p-board__status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--p2p-board-bar-h);
  min-width: 12.5ch;
  padding: 0 0.65rem;
  border-radius: 0;
  border: 1px solid rgba(128, 128, 128, 0.08);
  background: rgba(5, 5, 5, 0.2);
  font-size: 0.72rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: rgba(240, 240, 240, 0.62);
  white-space: nowrap;
  flex-shrink: 0;
}

.p2p-board__canvas-wrap {
  flex: 1;
  min-height: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
  touch-action: none;
  background: #161b22;
}

.p2p-board__canvas-wrap,
.p2p-board__canvas {
  -webkit-user-select: none;
  user-select: none;
}

.p2p-board__settings {
  position: relative;
  z-index: 5;
  flex: 0 0 0;
  width: 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-left: 1px solid transparent;
  background: linear-gradient(165deg, #0d1117 0%, #0d1117 100%);
  transition:
    width 0.2s ease,
    flex-basis 0.2s ease,
    border-color 0.2s ease;
}

.p2p-board--settings-open .p2p-board__settings {
  flex: 0 0 min(17.5rem, 100%);
  width: min(17.5rem, 100%);
  border-left-color: rgba(128, 128, 128, 0.08);
}

.p2p-board__settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.08);
  flex-shrink: 0;
}

.p2p-board__settings-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #d4d4d4;
}

.p2p-board__settings-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: rgba(240, 240, 240, 0.75);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.p2p-board__settings-close:hover {
  background: rgba(240, 240, 240, 0.08);
  color: #d4d4d4;
}

.p2p-board__settings-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.p2p-board__settings-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(240, 240, 240, 0.62);
}

.p2p-board__settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.p2p-board__settings-field--row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.p2p-board__settings-range {
  width: 100%;
  accent-color: #94a3b8;
}

.p2p-board__settings-check {
  width: 1rem;
  height: 1rem;
  accent-color: #94a3b8;
}

.p2p-board__settings-label {
  font-size: 0.75rem;
  color: rgba(240, 240, 240, 0.7);
}

.p2p-board__settings-input {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 0;
  border: 1px solid rgba(128, 128, 128, 0.12);
  background: rgba(5, 5, 5, 0.25);
  color: #d4d4d4;
  font-size: 0.9rem;
}

.p2p-board__settings-input:focus {
  outline: none;
  border-color: rgba(108, 182, 255, 0.55);
  box-shadow: none;
}

.p2p-board__settings-summary {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: #94a3b8;
}

.p2p-board__settings-aspect {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(240, 240, 240, 0.5);
}

.p2p-board__settings-subhead {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: rgba(240, 240, 240, 0.65);
}

.p2p-board__settings-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.p2p-board__preset-btn {
  min-height: 2rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
}

.p2p-board__settings-apply {
  width: 100%;
  margin-top: 0.25rem;
}

.p2p-board__settings-fit {
  width: 100%;
}

.p2p-board__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 900px) {
  .p2p-board__toolbar {
    padding: 0.45rem 0.5rem;
  }

  .p2p-board__toolbar-main,
  .p2p-board__toolbar-end {
    width: 100%;
  }

  .p2p-board__toolbar-end {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    padding-top: 0.15rem;
    border-top: 1px solid rgba(128, 128, 128, 0.07);
    justify-content: space-between;
  }

  .p2p-board__status {
    flex: 1;
    justify-content: center;
    max-width: none;
  }
}

/* Закладки для фильмов */
.p2p-room__movie-bookmarks {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(165deg, #0d1117 0%, #0d1117 48%, #0d1117 100%);
}

.p2p-room__movie-bookmarks.is-info-open::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(5, 5, 5, 0.42);
  pointer-events: none;
  transition: opacity var(--dur-flow);
}

.p2p-room__movie-layout {
  display: flex;
  flex: 1;
  align-items: stretch;
  min-height: 0;
  min-width: 0;
  gap: 0;
  width: 100%;
}

.p2p-room__movie-collections {
  /* Жёстко держим ширину — иначе длинные безпробельные строки расширяют колонку и съезжает основная панель */
  --movie-cols-w: clamp(168px, 21vw, 236px);
  flex: 0 0 var(--movie-cols-w);
  width: var(--movie-cols-w);
  max-width: var(--movie-cols-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  border-right: 1px solid rgba(108, 182, 255, 0.1);
  background: linear-gradient(180deg, rgba(5, 5, 5, 0.22) 0%, rgba(5, 5, 5, 0.55) 100%);
}

.p2p-room__movie-collections-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.75rem 0.6rem 0.55rem;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(128, 128, 128, 0.06);
}

.p2p-room__movie-collections-head-text {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.p2p-room__movie-collections-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #d4d4d4;
}

.p2p-room__movie-collections-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 0;
  font-size: 0.65rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(240, 240, 240, 0.75);
  background: rgba(240, 240, 240, 0.08);
}

.p2p-room__movie-collections-count:empty {
  display: none;
}

.p2p-room__movie-add--col {
  padding: 0.25rem 0.45rem;
  font-size: 0.72rem;
}

.p2p-room__movie-collections-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.4rem 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(108, 182, 255, 0.35) transparent;
}

.p2p-room__movie-collection {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  border-radius: 0;
  border: 1px solid transparent;
  transition:
    background var(--dur-fast),
    border-color var(--dur-fast),
    box-shadow var(--dur-fast);
}

.p2p-room__movie-collection.is-active {
  background: rgba(108, 182, 255, 0.14);
  border-color: rgba(108, 182, 255, 0.28);
  box-shadow: none;
}

.p2p-room__movie-collection.is-info-open:not(.is-active) {
  border-color: rgba(108, 182, 255, 0.2);
  background: rgba(108, 182, 255, 0.06);
}

.p2p-room__movie-collection.is-favorite:not(.is-active) {
  background: rgba(240, 240, 240, 0.07);
  border-color: rgba(108, 182, 255, 0.12);
}

.p2p-room__movie-collection-fav {
  flex-shrink: 0;
  width: 1.65rem;
  align-self: center;
  border: none;
  border-radius: 0;
  background: transparent;
  color: rgba(240, 240, 240, 0.3);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition:
    color var(--dur-fast),
    background var(--dur-fast);
}

.p2p-room__movie-collection-fav.is-on {
  color: #d4d4d4;
}

.p2p-room__movie-collection-fav:hover {
  background: rgba(240, 240, 240, 0.06);
}

.p2p-room__movie-collection__select {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.45rem 0.5rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #d4d4d4;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast);
}

.p2p-room__movie-collection__text {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
  flex: 1;
}

.p2p-room__movie-collection__author {
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.25;
  color: rgba(240, 240, 240, 0.45);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.p2p-room__movie-collection.is-active .p2p-room__movie-collection__author {
  color: rgba(108, 182, 255, 0.65);
}

.p2p-room__movie-collection__select:hover {
  background: rgba(240, 240, 240, 0.05);
}

.p2p-room__movie-collection.is-active .p2p-room__movie-collection__select {
  color: #94a3b8;
}

.p2p-room__movie-collection__name {
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
}

.p2p-room__movie-collection__count-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.28);
  border: 1px solid rgba(128, 128, 128, 0.08);
}

.p2p-room__movie-collection.is-active .p2p-room__movie-collection__count-badge {
  background: rgba(108, 182, 255, 0.18);
  border-color: rgba(108, 182, 255, 0.25);
}

.p2p-room__movie-collection__count {
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(240, 240, 240, 0.55);
  font-variant-numeric: tabular-nums;
}

.p2p-room__movie-collection.is-active .p2p-room__movie-collection__count {
  color: #94a3b8;
}

.p2p-room__movie-collection__rename {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.p2p-room__movie-collection__del {
  flex-shrink: 0;
  width: 1.5rem;
  align-self: center;
  border: none;
  border-radius: 0;
  background: rgba(108, 182, 255, 0.12);
  color: #e94142;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.85;
  transition:
    opacity var(--dur-fast),
    background var(--dur-fast),
    color var(--dur-fast);
}

.p2p-room__movie-collection:hover .p2p-room__movie-collection__del {
  opacity: 1;
}

.p2p-room__movie-collection__del:hover {
  color: #d4d4d4;
  background: #e94142;
}

.p2p-room__movie-collection.is-pending-delete {
  flex-wrap: wrap;
  background: rgba(108, 182, 255, 0.12);
  border: 1px solid rgba(108, 182, 255, 0.35);
}

.p2p-room__movie-collection__confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
  width: 100%;
  padding: 0.2rem 0.35rem 0.35rem;
}

.p2p-room__movie-collection__skip-cb {
  flex-shrink: 0;
  margin: 0;
  accent-color: #e94142;
}

.p2p-room__movie-collection__skip-label {
  font-size: 0.68rem;
  color: rgba(240, 240, 240, 0.65);
  cursor: pointer;
  user-select: none;
}

.p2p-room__movie-collection__confirm-yes {
  padding: 0.25rem 0.55rem;
  border: none;
  border-radius: 0;
  background: #e94142;
  color: #d4d4d4;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.p2p-room__movie-collection__confirm-yes:hover {
  filter: brightness(1.08);
}

.p2p-room__movie-collection__confirm-no {
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  border-radius: 0;
  background: rgba(240, 240, 240, 0.08);
  color: #d4d4d4;
  font-size: 1rem;
  cursor: pointer;
}

.p2p-room__movie-collection__confirm-no:hover {
  color: #d4d4d4;
  background: rgba(240, 240, 240, 0.14);
}

.p2p-room__movie-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.p2p-room__movie-head-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.p2p-room__movie-head-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.p2p-room__movie-head-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.2rem;
  border-radius: 0;
  background: rgba(108, 182, 255, 0.12);
  border: 1px solid rgba(108, 182, 255, 0.22);
  box-shadow: none;
}

.p2p-room__movie-eyebrow {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(240, 240, 240, 0.9);
}

.p2p-room__movie-eyebrow-sep {
  opacity: 0.55;
}

.p2p-room__movie-participants {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  color: rgba(240, 240, 240, 0.95);
  background: rgba(108, 182, 255, 0.14);
  border: 1px solid rgba(108, 182, 255, 0.28);
  font-variant-numeric: tabular-nums;
}

.p2p-room__movie-bookmarks.is-sync-live .p2p-room__movie-participants {
  color: rgba(240, 240, 240, 0.95);
  background: rgba(91, 163, 43, 0.14);
  border-color: rgba(91, 163, 43, 0.32);
}

.p2p-room__movie-main-title {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 600;
  line-height: 1.3;
  color: #d4d4d4;
  letter-spacing: -0.01em;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.p2p-room__movie-stats {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(108, 182, 255, 0.75);
  font-variant-numeric: tabular-nums;
}

.p2p-room__movie-head-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.p2p-room__movie-sync {
  display: inline-flex;
  align-items: center;
  max-width: 11rem;
  padding: 0.3rem 0.55rem;
  border-radius: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(240, 240, 240, 0.55);
  background: rgba(240, 240, 240, 0.06);
  border: 1px solid rgba(128, 128, 128, 0.08);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p2p-room__movie-bookmarks.is-sync-pending .p2p-room__movie-sync {
  color: rgba(108, 182, 255, 0.85);
  border-color: rgba(108, 182, 255, 0.25);
  background: rgba(108, 182, 255, 0.1);
}

.p2p-room__movie-bookmarks.is-sync-live .p2p-room__movie-sync {
  color: #d4d4d4;
  border-color: rgba(91, 163, 43, 0.35);
  background: rgba(240, 240, 240, 0.1);
}

.p2p-room__movie-bookmarks.is-sync-offline .p2p-room__movie-sync {
  color: rgba(240, 240, 240, 0.45);
}

.p2p-room__movie-collection__menu {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: rgba(240, 240, 240, 0.5);
  line-height: 0;
  cursor: pointer;
  transition:
    color var(--dur-fast),
    background var(--dur-fast);
}

.p2p-room__movie-collection__menu:hover,
.p2p-room__movie-collection.is-info-open .p2p-room__movie-collection__menu {
  color: #94a3b8;
  background: rgba(108, 182, 255, 0.12);
}

.p2p-room__menu-icon {
  display: block;
}

.p2p-room__movie-collection-fav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.p2p-room__movie-rows-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
  padding: 0.85rem 1rem 1rem;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(108, 182, 255, 0.3) transparent;
}

.p2p-room__movie-info-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 34vw);
  display: flex;
  flex-direction: column;
  z-index: 4;
  min-height: 0;
  border-radius: 0;
  background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
  border: none;
  border-left: 1px solid rgba(108, 182, 255, 0.14);
  box-shadow: none;
  overflow: hidden;
  opacity: 0;
  transform: translate3d(104%, 0, 0);
  pointer-events: none;
  transition:
    transform var(--dur-flow) var(--ease-flow-out),
    opacity var(--dur-flow) var(--ease-flow-out);
}

.p2p-room__movie-bookmarks.is-info-open .p2p-room__movie-info-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.p2p-room__movie-info-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem;
  scrollbar-width: thin;
}

.p2p-room__movie-info-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.72);
  border: 1px solid rgba(128, 128, 128, 0.08);
  box-shadow: none;
}

.p2p-room__movie-info-badge {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 0;
  background: rgba(240, 240, 240, 0.08);
  color: rgba(240, 240, 240, 0.55);
}

.p2p-room__movie-info-badge--edit {
  background: rgba(108, 182, 255, 0.15);
  color: #94a3b8;
}

.p2p-room__movie-info-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.p2p-room__movie-info-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #d4d4d4;
}

.p2p-room__movie-info-value {
  font-size: 0.88rem;
  color: #d4d4d4;
  padding: 0.45rem 0.55rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.2);
  border: 1px solid rgba(128, 128, 128, 0.06);
}

.p2p-room__movie-info-textarea {
  resize: vertical;
  min-height: 4.5rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.p2p-room__movie-info-inner .p2p-room__setup-input {
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.p2p-room__movie-info-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.25rem;
}

.p2p-room__movie-info-save {
  padding: 0.5rem 1.1rem;
  border: none;
  border-radius: 0;
  background: rgba(108, 182, 255, 0.25);
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.p2p-room__movie-info-save:hover {
  filter: brightness(1.08);
}

.p2p-room__movie-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  flex-shrink: 0;
  min-width: 0;
  padding: 0.9rem 1rem 0.85rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.06);
  background: rgba(5, 5, 5, 0.12);
}

.p2p-room__movie-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.p2p-room__movie-toolbar-hint {
  flex: 1;
  min-width: 8rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: rgba(240, 240, 240, 0.42);
}

.p2p-room__movie-filter {
  padding: 0.35rem 0.7rem;
  border-radius: 0;
  border: 1px solid rgba(128, 128, 128, 0.1);
  background: rgba(5, 5, 5, 0.2);
  color: rgba(240, 240, 240, 0.75);
  font-size: 0.78rem;
  cursor: pointer;
  transition:
    background var(--dur-fast),
    border-color var(--dur-fast),
    color var(--dur-fast);
}

.p2p-room__movie-filter.is-on {
  border-color: rgba(108, 182, 255, 0.45);
  background: rgba(240, 240, 240, 0.12);
  color: #d4d4d4;
}

.p2p-room__movie-add {
  flex-shrink: 0;
  padding: 0.45rem 0.9rem;
  border: none;
  border-radius: 0;
  background: rgba(108, 182, 255, 0.2);
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    filter var(--dur-fast),
    transform var(--dur-fast),
    box-shadow var(--dur-fast);
}

.p2p-room__movie-add:hover {
  filter: brightness(1.08);
}

.p2p-room__movie-add--primary {
  background: linear-gradient(135deg, rgba(108, 182, 255, 0.45) 0%, rgba(108, 182, 255, 0.35) 100%);
  color: #d4d4d4;
  box-shadow: none;
}

.p2p-room__movie-add--primary:hover {
  transform: translateY(-1px);
  box-shadow: none;
}

.p2p-room__movie-add--ghost {
  width: 100%;
  background: rgba(240, 240, 240, 0.06);
  border: 1px dashed rgba(128, 128, 128, 0.14);
  color: rgba(240, 240, 240, 0.88);
}

.p2p-room__movie-add--ghost:hover {
  background: rgba(108, 182, 255, 0.1);
  border-color: rgba(108, 182, 255, 0.25);
  color: #94a3b8;
}

.p2p-room__movie-foot {
  flex-shrink: 0;
  padding-top: 0.25rem;
}

.p2p-room__movie-rows {
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
}

.p2p-room__movie-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.5rem 0 0;
  padding: 2rem 1.25rem;
  text-align: center;
  border-radius: 0;
  border: 1px dashed rgba(108, 182, 255, 0.2);
  background: rgba(5, 5, 5, 0.18);
}

.p2p-room__movie-empty-icon {
  font-size: 2rem;
  line-height: 1;
  opacity: 0.9;
}

.p2p-room__movie-empty-title {
  margin: 0.15rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #d4d4d4;
}

.p2p-room__movie-empty-text {
  margin: 0;
  max-width: 22rem;
  font-size: 0.82rem;
  color: rgba(240, 240, 240, 0.58);
  line-height: 1.5;
}

.p2p-room__movie-row {
  content-visibility: auto;
  contain-intrinsic-size: auto 4.25rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(8.75rem, 10.5rem);
  gap: 0.65rem 0.85rem;
  align-items: start;
  padding: 0.7rem 0.85rem;
  border-radius: 0;
  background:
    linear-gradient(145deg, rgba(240, 240, 240, 0.04) 0%, transparent 42%),
    rgba(5, 5, 5, 0.72);
  border: 1px solid rgba(128, 128, 128, 0.07);
  border-left: 3px solid rgba(128, 128, 128, 0.55);
  box-shadow: none;
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast),
    box-shadow var(--dur-fast),
    transform var(--dur-fast);
}

.p2p-room__movie-row:hover {
  background:
    linear-gradient(145deg, rgba(240, 240, 240, 0.055) 0%, transparent 45%),
    rgba(8, 8, 8, 0.88);
  border-color: rgba(128, 128, 128, 0.11);
  box-shadow: none;
}

.p2p-room__movie-row:focus-within {
  border-color: rgba(108, 182, 255, 0.22);
  box-shadow: none;
}

.p2p-room__movie-row--planned {
  border-left-color: #9ca3af;
}

.p2p-room__movie-row--watching {
  border-left-color: #94a3b8;
}

.p2p-room__movie-row--watched {
  border-left-color: #5ba32b;
}

.p2p-room__movie-row--dropped {
  border-left-color: #e94142;
}

.p2p-room__movie-row__title-read {
  padding: 0.42rem 0.55rem;
  border-radius: 0;
  border: 1px solid rgba(128, 128, 128, 0.06);
  background: rgba(5, 5, 5, 0.18);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  color: #d4d4d4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.p2p-room__movie-row__url-read {
  display: block;
  padding: 0.38rem 0.55rem;
  border-radius: 0;
  border: 1px solid rgba(128, 128, 128, 0.05);
  background: rgba(5, 5, 5, 0.12);
  font-size: 0.78rem;
  line-height: 1.35;
  color: #94a3b8;
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.p2p-room__movie-row__url-read:hover {
  text-decoration: underline;
}

.p2p-room__movie-row__url-read.is-empty {
  color: rgba(240, 240, 240, 0.42);
  font-style: italic;
  cursor: default;
}

.p2p-room__movie-bookmarks.is-foreign-collection .p2p-room__movie-add--primary {
  display: none;
}

.p2p-room__movie-bookmarks.is-foreign-collection .p2p-room__movie-foot {
  display: none;
}

.p2p-room__movie-fav {
  flex-shrink: 0;
  width: 2.15rem;
  height: 2.15rem;
  margin-top: 0.2rem;
  border: none;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.2);
  color: rgba(240, 240, 240, 0.35);
  font-size: 1.08rem;
  line-height: 1;
  cursor: pointer;
  transition:
    color var(--dur-fast),
    background var(--dur-fast),
    transform var(--dur-fast);
}

.p2p-room__movie-fav.is-on {
  color: #d4d4d4;
  background: rgba(240, 240, 240, 0.1);
}

.p2p-room__movie-fav:hover {
  background: rgba(240, 240, 240, 0.08);
  transform: scale(1.04);
}

.p2p-room__movie-row--compact {
  grid-template-columns: minmax(0, 1fr) auto;
  contain-intrinsic-size: auto 2.75rem;
  padding: 0.45rem 0.65rem;
  gap: 0.45rem 0.55rem;
}

.p2p-room__movie-row__fields--compact {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}

.p2p-room__movie-row__fields--compact .p2p-room__movie-row__title,
.p2p-room__movie-row__fields--compact .p2p-room__movie-row__url {
  flex: 1 1 0;
  min-width: 0;
}

.p2p-room__movie-row__actions--compact {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.p2p-room__movie-row__fields {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.p2p-room__movie-row__primary {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  min-width: 0;
}

.p2p-room__movie-row__episodes-field {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  align-self: flex-start;
  margin-top: 0.1rem;
  padding: 0.34rem 0.42rem 0.34rem 0.62rem;
  border-radius: 0;
  background:
    linear-gradient(145deg, rgba(108, 182, 255, 0.1) 0%, rgba(108, 182, 255, 0.03) 100%),
    rgba(5, 5, 5, 0.24);
  border: 1px solid rgba(108, 182, 255, 0.16);
  box-shadow: none;
  cursor: text;
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast),
    box-shadow var(--dur-fast);
}

.p2p-room__movie-row__episodes-field:hover {
  border-color: rgba(108, 182, 255, 0.28);
}

.p2p-room__movie-row__episodes-field:focus-within {
  border-color: rgba(108, 182, 255, 0.42);
  box-shadow: none;
}

.p2p-room__movie-row__episodes-copy {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
  line-height: 1.1;
  user-select: none;
}

.p2p-room__movie-row__episodes-kicker {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(108, 182, 255, 0.92);
}

.p2p-room__movie-row__episodes-hint {
  font-size: 0.68rem;
  color: rgba(240, 240, 240, 0.48);
}

.p2p-room__movie-row__episodes-input {
  flex: 0 0 3.35rem;
  width: 3.35rem;
  min-width: 0;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(128, 128, 128, 0.12);
  border-radius: 0;
  background: rgba(5, 5, 5, 0.72);
  color: #d4d4d4;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 1;
  box-sizing: border-box;
  appearance: textfield;
  -moz-appearance: textfield;
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast);
}

.p2p-room__movie-row__episodes-input::-webkit-outer-spin-button,
.p2p-room__movie-row__episodes-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.p2p-room__movie-row__episodes-input:focus {
  outline: none;
  border-color: rgba(108, 182, 255, 0.55);
  background: rgba(5, 5, 5, 0.92);
}

.p2p-room__movie-row__actions {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  min-width: 0;
  width: 100%;
}

.p2p-room__movie-row__actions-tail {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.p2p-room__movie-row__status:focus {
  outline: none;
  border-color: rgba(108, 182, 255, 0.5);
  box-shadow: none;
}

.p2p-room__movie-row__status {
  width: 100%;
  min-width: 0;
  padding: 0.45rem 0.5rem;
  border-radius: 0;
  border: 1px solid rgba(128, 128, 128, 0.1);
  background: rgba(5, 5, 5, 0.32);
  color: #d4d4d4;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur-fast);
}

.p2p-room__movie-row__open {
  flex: 1;
  min-width: 0;
  padding: 0.42rem 0.55rem;
  border: 1px solid rgba(108, 182, 255, 0.38);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(108, 182, 255, 0.16) 0%, rgba(108, 182, 255, 0.07) 100%);
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition:
    filter var(--dur-fast),
    border-color var(--dur-fast);
}

.p2p-room__movie-row__open:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: none;
}

.p2p-room__movie-row__open:not(:disabled):hover {
  filter: brightness(1.12);
  border-color: rgba(108, 182, 255, 0.55);
}

.p2p-room__movie-row__del {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: 1px solid transparent;
  border-radius: 0;
  background: rgba(108, 182, 255, 0.08);
  color: rgba(108, 182, 255, 0.85);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition:
    color var(--dur-fast),
    background var(--dur-fast),
    border-color var(--dur-fast);
}

.p2p-room__movie-row__del:hover {
  color: #d4d4d4;
  background: rgba(108, 182, 255, 0.55);
  border-color: rgba(128, 128, 128, 0.12);
}

@media (max-width: 720px) {
  .p2p-room__movie-info-panel {
    left: 0;
    width: 100%;
    max-width: none;
    height: min(46vh, 420px);
    top: auto;
    border-left: none;
    border-top: 1px solid rgba(108, 182, 255, 0.14);
    transform: translate3d(0, 108%, 0);
  }

  .p2p-room__movie-bookmarks.is-info-open .p2p-room__movie-info-panel {
    transform: none;
  }

  .p2p-room__movie-layout {
    flex-direction: column;
  }

  .p2p-room__movie-collections {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
    max-height: min(32vh, 200px);
    border-right: none;
    border-bottom: 1px solid rgba(128, 128, 128, 0.07);
  }

  .p2p-room__movie-row {
    grid-template-columns: auto 1fr;
    gap: 0.55rem 0.65rem;
  }

  .p2p-room__movie-fav {
    margin-top: 0.08rem;
  }

  .p2p-room__movie-row__actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
    gap: 0.4rem;
    padding-top: 0.05rem;
    border-top: 1px solid rgba(128, 128, 128, 0.06);
    margin-top: 0.05rem;
  }

  .p2p-room__movie-row__status {
    flex: 1 1 min(180px, 100%);
    min-width: 0;
  }

  .p2p-room__movie-row__actions-tail {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
  }

  .p2p-room__movie-row__open {
    flex: 0 1 auto;
    min-width: 4rem;
  }

  .p2p-room__movie-row__episodes-field {
    width: 100%;
    justify-content: space-between;
  }
}

.p2p-room__chat-body {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* аватарки */
.p2p-room__avatar {
  flex-shrink: 0;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--nick-color, #94a3b8), #1c2128);
  box-shadow: none;
}

.p2p-room__avatar--sm {
  width: 2rem;
  height: 2rem;
  font-size: 0.72rem;
}

.p2p-room__avatar--md {
  width: 2.5rem;
  height: 2.5rem;
  font-size: 0.82rem;
}

.p2p-room__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.p2p-room__avatar-letter {
  font-weight: 700;
  color: #d4d4d4;
  letter-spacing: 0.02em;
  user-select: none;
}

.p2p-room__tg-header-identity {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.p2p-room__tg-header-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.p2p-room__avatar-settings {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 0.85rem 0.35rem;
}

.p2p-room__avatar-preview {
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--nick-color, #94a3b8), #1c2128);
  box-shadow: none;
}

.p2p-room__avatar-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.p2p-room__avatar-preview-letter {
  font-size: 1.35rem;
  font-weight: 700;
  color: #d4d4d4;
}

.p2p-room__avatar-settings-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
}

.p2p-room__avatar-btn {
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: 0;
  background: rgba(108, 182, 255, 0.22);
  color: #d4d4d4;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast);
}

.p2p-room__avatar-btn:hover {
  background: rgba(108, 182, 255, 0.34);
}

.p2p-room__avatar-btn--ghost {
  background: rgba(240, 240, 240, 0.06);
  color: #d4d4d4;
}

.p2p-room__avatar-btn--ghost:hover {
  background: rgba(240, 240, 240, 0.12);
  color: #d4d4d4;
}

.p2p-room__setup-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

.p2p-room__setup-hero--panel .p2p-room__setup-avatar {
  overflow: hidden;
}

.p2p-room__setup-hero--panel {
  flex-shrink: 0;
  margin: 0 0.85rem 0.65rem;
  padding: 1rem 0.85rem;
  text-align: center;
  border-radius: 0;
  background: linear-gradient(
    165deg,
    rgba(108, 182, 255, 0.22) 0%,
    rgba(8, 8, 8, 0.55) 55%,
    rgba(5, 5, 5, 0.35) 100%
  );
  border: 1px solid rgba(108, 182, 255, 0.14);
  box-shadow: none;
}

.p2p-room__setup-hero--panel .p2p-room__setup-avatar {
  width: 3.5rem;
  height: 3.5rem;
  font-size: 1.5rem;
  margin-bottom: 0.6rem;
}

.p2p-room__settings-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 34vw);
  display: flex;
  flex-direction: column;
  z-index: 3;
  min-height: 0;
  border-radius: 0;
  background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
  border: none;
  border-left: 1px solid rgba(108, 182, 255, 0.14);
  box-shadow: none;
  overflow: hidden;
  opacity: 0;
  transform: translate3d(104%, 0, 0);
  pointer-events: none;
  transition:
    transform var(--dur-flow) var(--ease-flow-out),
    opacity var(--dur-flow) var(--ease-flow-out);
}

.p2p-room__stage.is-open .p2p-room__settings-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.p2p-room__settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 0.9rem 1rem 0.7rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.06);
  background: rgba(5, 5, 5, 0.12);
}

.p2p-room__settings-title {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #d4d4d4;
}

.p2p-room__panel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: none;
  border-radius: 0;
  background: rgba(240, 240, 240, 0.08);
  color: #d4d4d4;
  cursor: pointer;
  transition: background var(--dur-fast);
}

.p2p-room__panel-btn:hover {
  background: rgba(240, 240, 240, 0.14);
}

.p2p-room__settings-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem 0 0;
  scrollbar-width: thin;
}

.p2p-room__settings-pane {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 0.35rem;
}

.p2p-room__settings-pane[hidden] {
  display: none;
}

.p2p-room__settings-card {
  flex-shrink: 0;
  margin: 0 0.85rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.72);
  border: 1px solid rgba(128, 128, 128, 0.07);
  overflow: visible;
  box-shadow: none;
}

.p2p-room__settings-card.p2p-room__setup-list {
  padding: 0;
}

.p2p-room__settings-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0 0.85rem 0.75rem;
  padding: 0.28rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.28);
  border: 1px solid rgba(128, 128, 128, 0.05);
}

.p2p-room__settings-tab {
  flex: 1;
  padding: 0.55rem 0.5rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #d4d4d4;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition:
    background var(--dur-fast),
    color var(--dur-fast),
    box-shadow var(--dur-fast);
}

.p2p-room__settings-tab:hover {
  color: #d4d4d4;
}

.p2p-room__settings-tab.is-active {
  background: rgba(108, 182, 255, 0.22);
  color: #d4d4d4;
  box-shadow: none;
}

.p2p-room__settings-hint {
  margin: 0.5rem 1rem 0.85rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #d4d4d4;
  border-radius: 0;
  background: rgba(108, 182, 255, 0.08);
  border: 1px solid rgba(108, 182, 255, 0.1);
}

.p2p-room__landing-actions,
.p2p-room__settings-footer {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex-shrink: 0;
  padding: 0.85rem;
  border-top: 1px solid rgba(128, 128, 128, 0.06);
  background: rgba(5, 5, 5, 0.18);
}

.p2p-room__settings-footer[hidden] {
  display: none;
}

.p2p-room__settings-footer .p2p-room__setup-cta,
.p2p-room__settings-footer .p2p-room__setup-secondary {
  width: 100%;
  margin: 0;
}

.p2p-room__tg-head-btn--settings.is-active {
  background: rgba(108, 182, 255, 0.28);
  color: #94a3b8;
}

@media (max-width: 920px) {
  .p2p-room__messenger-layout {
    flex-direction: column;
  }

  .p2p-room__messenger-layout .p2p-room__history-panel {
    flex: 0 0 auto;
    width: 100%;
    max-height: min(32vh, 240px);
    min-height: 0;
    border-right: none;
    border-bottom: 1px solid rgba(128, 128, 128, 0.08);
  }

  .p2p-room__history-item {
    padding: 0.55rem 0.55rem 0.55rem 0.5rem;
  }

  .p2p-room__history-avatar {
    width: 2.25rem;
    height: 2.25rem;
  }

  .p2p-room__stage {
    flex: 1;
    min-height: 0;
  }

  .p2p-room__main-wrap {
    flex: 1;
    min-height: 0;
  }

  .p2p-room__settings-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    height: min(46vh, 420px);
    padding-left: 0;
    border-left: none;
    border-top: 1px solid rgba(108, 182, 255, 0.14);
    transform: translate3d(0, 108%, 0);
  }

  .p2p-room__stage.is-open .p2p-room__settings-panel {
    transform: none;
  }
}

/* Экран входа (Telegram) */
.p2p-room__setup-tg {
  padding: 0 0 0.5rem;
}

.p2p-room__setup-hero {
  text-align: center;
  padding: 1.35rem 1.25rem 1.1rem;
  background: linear-gradient(180deg, #161b22 0%, #161b22 100%);
  border-bottom: 1px solid rgba(128, 128, 128, 0.05);
}

.p2p-room__setup-avatar {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 0.75rem;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  background: linear-gradient(145deg, #94a3b8, #94a3b8);
  box-shadow: none;
}

.p2p-room__setup-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #d4d4d4;
}

.p2p-room__setup-sub {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: #d4d4d4;
}

.p2p-room__setup-list {
  padding: 0.35rem 0;
}

.p2p-room__setup-row {
  display: grid;
  gap: 0.35rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.04);
}

.p2p-room__setup-row:last-child {
  border-bottom: none;
}

.p2p-room__setup-row--stacked {
  gap: 0.45rem;
}

.p2p-room__setup-sublabel {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #94a3b8;
}

.p2p-room__registered-name {
  color: #d4d4d4;
  font-weight: 600;
}

.p2p-room__apply-nick.is-muted,
.p2p-room__apply-nick:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.p2p-room__setup-label {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.p2p-room__setup-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 0;
  background: #161b22;
  color: #d4d4d4;
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.p2p-room__setup-input::placeholder {
  color: #94a3b8;
}

.p2p-room__setup-input:focus {
  outline: 2px solid rgba(108, 182, 255, 0.35);
}

.p2p-room__movie-row .p2p-room__movie-row__title.p2p-room__setup-input,
.p2p-room__movie-row .p2p-room__movie-row__url.p2p-room__setup-input {
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  padding: 0.42rem 0.55rem;
  border-radius: 0;
  border: 1px solid rgba(128, 128, 128, 0.09);
  background: rgba(5, 5, 5, 0.32);
  outline: none;
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast);
}

.p2p-room__movie-row .p2p-room__movie-row__title.p2p-room__setup-input {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.p2p-room__movie-row .p2p-room__movie-row__url.p2p-room__setup-input {
  font-size: 0.8rem;
  color: rgba(240, 240, 240, 0.88);
}

.p2p-room__movie-row .p2p-room__movie-row__title.p2p-room__setup-input::placeholder,
.p2p-room__movie-row .p2p-room__movie-row__url.p2p-room__setup-input::placeholder {
  color: rgba(240, 240, 240, 0.55);
  font-weight: 400;
}

.p2p-room__movie-row .p2p-room__movie-row__title.p2p-room__setup-input:focus,
.p2p-room__movie-row .p2p-room__movie-row__url.p2p-room__setup-input:focus {
  outline: none;
  border-color: rgba(108, 182, 255, 0.5);
  box-shadow: none;
}

.p2p-room__setup-input--pass {
  min-height: 2.65rem;
}

.p2p-room__setup-input-group {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
}

.p2p-room__setup-input-group .p2p-room__setup-input {
  flex: 1;
  min-width: 0;
}

.p2p-room__setup-icon-btn {
  flex-shrink: 0;
  width: 2.5rem;
  border: none;
  border-radius: 0;
  background: #1c2128;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: background var(--dur-fast);
}

.p2p-room__setup-icon-btn:hover {
  background: #94a3b8;
}

.p2p-room__setup-row--switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  user-select: none;
}

.p2p-room__setup-switch-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.92rem;
  color: #d4d4d4;
}

.p2p-room__setup-switch-text small {
  font-size: 0.75rem;
  color: #d4d4d4;
  font-weight: 400;
}

.p2p-room__setup-switch {
  position: relative;
  width: 2.75rem;
  height: 1.55rem;
  flex-shrink: 0;
  border-radius: 0;
  background: #1c2128;
  transition: background var(--dur-fast);
}

.p2p-room__setup-toggle-input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.p2p-room__setup-switch:has(.p2p-room__setup-toggle-input:checked) {
  background: #94a3b8;
}

.p2p-room__setup-switch::after {
  content: "";
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 0;
  background: #d4d4d4;
  box-shadow: none;
  transition: transform var(--dur-fast);
}

.p2p-room__setup-switch:has(.p2p-room__setup-toggle-input:checked)::after {
  transform: translateX(1.2rem);
}

.p2p-room__setup-toggle-input {
  z-index: 1;
}

.p2p-room__blocked {
  margin: 0 1rem 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0;
  border: 1px solid rgba(108, 182, 255, 0.35);
  background: rgba(108, 182, 255, 0.1);
  font-size: 0.8rem;
  line-height: 1.45;
  color: #e94142;
}

.p2p-room__blocked p {
  margin: 0;
}

.p2p-room__setup-cta {
  display: block;
  width: calc(100% - 2rem);
  margin: 0.75rem auto 0.5rem;
  padding: 0.8rem 1rem;
  border: none;
  border-radius: 0;
  background: linear-gradient(180deg, #94a3b8 0%, #94a3b8 55%, #94a3b8 100%);
  color: #d4d4d4;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition:
    filter var(--dur-fast),
    transform var(--dur-fast),
    box-shadow var(--dur-fast),
    opacity var(--dur-fast);
}


.p2p-room__setup-cta:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: none;
}

.p2p-room__setup-cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.p2p-room__setup-secondary {
  display: block;
  width: calc(100% - 2rem);
  margin: 0 auto 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(108, 182, 255, 0.2);
  border-radius: 0;
  background: rgba(108, 182, 255, 0.08);
  color: #94a3b8;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}

.p2p-room__setup-secondary:hover:not(:disabled) {
  background: rgba(108, 182, 255, 0.1);
}

.p2p-room__setup-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Мессенджер — на всю высоту колонки, скролл только в ленте */
.p2p-room__messenger {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  border-radius: 0;
  overflow: hidden;
  background: #0d1117;
  border: none;
  box-shadow: none;
}

.p2p-room__tg-header-wrap {
  position: relative;
  flex-shrink: 0;
  z-index: 12;
}

.p2p-room__tg-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: linear-gradient(180deg, #161b22 0%, #161b22 100%);
  border-bottom: 1px solid rgba(128, 128, 128, 0.06);
}

.p2p-room__tg-header-identity-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  width: 100%;
  padding: 0.15rem 0.25rem;
  margin: -0.15rem -0.25rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: background var(--dur-fast);
}

.p2p-room__tg-header-identity-btn:hover {
  background: rgba(240, 240, 240, 0.06);
}

.p2p-room__tg-header-identity-btn[aria-expanded="true"] {
  background: rgba(108, 182, 255, 0.12);
}

.p2p-room__members-panel {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  top: 100%;
  z-index: 30;
  max-height: min(52vh, 340px);
  overflow: auto;
  background: #161b22;
  border: 1px solid rgba(108, 182, 255, 0.28);
  border-top: none;
  border-radius: 0;
  box-shadow: none;
}

.p2p-room__members-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.06);
  position: sticky;
  top: 0;
  background: #161b22;
  z-index: 1;
}

.p2p-room__members-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #94a3b8;
}

.p2p-room__members-close {
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: 0;
  background: rgba(240, 240, 240, 0.08);
  color: #d4d4d4;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.p2p-room__members-close:hover {
  background: rgba(240, 240, 240, 0.14);
}

.p2p-room__members-body {
  padding: 0.35rem 0 0.5rem;
}

.p2p-room__members-section-title {
  margin: 0;
  padding: 0.45rem 0.65rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.p2p-room__members-section-title--left {
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(128, 128, 128, 0.06);
  color: #94a3b8;
}

.p2p-room__members-list {
  display: flex;
  flex-direction: column;
}

.p2p-room__members-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
}

.p2p-room__members-item-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.p2p-room__members-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #d4d4d4;
}

.p2p-room__members-you {
  font-weight: 500;
  color: #94a3b8;
}

.p2p-room__members-item-sub {
  font-size: 0.74rem;
  color: #94a3b8;
}

.p2p-room__members-section-title--left + .p2p-room__members-list .p2p-room__members-item-sub {
  color: #94a3b8;
}

.p2p-room__members-empty {
  margin: 0;
  padding: 0.35rem 0.65rem 0.5rem;
  font-size: 0.78rem;
  color: #94a3b8;
}

.p2p-room__tg-header-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 8rem;
  padding-top: 0.1rem;
}

.p2p-room__tg-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  flex: 1 1 12rem;
}

.p2p-room__tg-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.p2p-room__tg-toolbar-group + .p2p-room__tg-toolbar-group {
  padding-left: 0.45rem;
  border-left: 1px solid rgba(128, 128, 128, 0.08);
}

.p2p-room__tg-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #d4d4d4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p2p-room__tg-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.35rem;
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.35;
  max-width: 100%;
}

.p2p-room__tg-sub-part {
  white-space: nowrap;
}

.p2p-room__tg-sub-sep {
  color: rgba(240, 240, 240, 0.95);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
  padding: 0 0.1rem;
  user-select: none;
}

.p2p-room__tg-head-btn {
  width: 2.1rem;
  height: 2.1rem;
  border: none;
  border-radius: 0;
  background: rgba(240, 240, 240, 0.08);
  color: #d4d4d4;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  transition: background var(--dur-fast);
}

.p2p-room__tg-head-btn:hover {
  background: rgba(240, 240, 240, 0.14);
}

.p2p-room__tg-head-btn--settings {
  width: auto;
  min-height: 2.1rem;
  padding: 0.35rem 0.65rem;
  border-radius: 0;
  font-size: 0.78rem;
  font-weight: 600;
}

.p2p-room__tg-head-btn--exit {
  width: auto;
  min-height: 2.1rem;
  padding: 0.35rem 0.75rem;
  border-radius: 0;
  background: rgba(108, 182, 255, 0.22);
  color: #e94142;
  font-size: 0.78rem;
  font-weight: 600;
}

.p2p-room__tg-head-btn--exit:hover:not(:disabled) {
  background: rgba(108, 182, 255, 0.38);
  color: #e94142;
}

.p2p-room__tg-head-btn:disabled,
.p2p-room__tg-rename-btn.is-muted {
  opacity: 0.5;
  cursor: not-allowed;
}

.p2p-room__tg-rename-btn {
  flex-shrink: 0;
  min-height: 2.1rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(108, 182, 255, 0.22);
  border-radius: 0;
  background: rgba(108, 182, 255, 0.12);
  color: #94a3b8;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--dur-fast),
    border-color var(--dur-fast),
    color var(--dur-fast);
}

.p2p-room__tg-rename-btn:hover:not(.is-muted) {
  background: rgba(108, 182, 255, 0.24);
  border-color: rgba(108, 182, 255, 0.35);
  color: #d4d4d4;
}

@media (max-width: 640px) {
  .p2p-room__tg-toolbar {
    width: 100%;
    flex-basis: 100%;
    justify-content: flex-start;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(128, 128, 128, 0.05);
  }

  .p2p-room__tg-toolbar-group + .p2p-room__tg-toolbar-group {
    padding-left: 0;
    border-left: none;
  }

  .p2p-room__tg-rename-btn,
  .p2p-room__tg-head-btn--settings,
  .p2p-room__tg-head-btn--exit {
    font-size: 0.72rem;
    padding: 0.32rem 0.55rem;
  }
}

.p2p-room__tg-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 240, 240, 0.22) transparent;
  padding: 0.75rem 0.65rem 0.5rem;
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, rgba(12, 12, 12, 0.12), transparent 55%),
    #0d1117;
}

.p2p-room__tg-viewport {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  box-sizing: border-box;
}

.p2p-room__chat-row.p2p-room__system {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin: 0.5rem 0;
  text-align: center;
}

.p2p-room__tg-messages::-webkit-scrollbar {
  width: 6px;
}

.p2p-room__tg-messages::-webkit-scrollbar-thumb {
  background: rgba(240, 240, 240, 0.2);
  border-radius: 0;
}

.p2p-room__bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  width: 100%;
}

.p2p-room__bubble-row--in {
  justify-content: flex-start;
}

.p2p-room__bubble-row--out {
  justify-content: flex-end;
}

.p2p-room__bubble-row--in .p2p-room__bubble {
  max-width: min(78%, 420px);
}

.p2p-room__bubble-row--out .p2p-room__bubble {
  max-width: min(78%, 420px);
}

.p2p-room__bubble {
  max-width: min(82%, 420px);
  padding: 0.45rem 0.65rem 0.35rem;
  border-radius: 0;
  font-size: 0.92rem;
  line-height: 1.4;
  word-break: break-word;
  box-shadow: none;
}

.p2p-room__bubble--in {
  background: #161b22;
  border-bottom-left-radius: 4px;
  color: #d4d4d4;
}

.p2p-room__bubble--out {
  background: #1c2128;
  border-bottom-right-radius: 4px;
  color: #d4d4d4;
}

.p2p-room__bubble-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--nick-color, #94a3b8);
  margin-bottom: 0.15rem;
}

.p2p-room__system {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin: 0.5rem 0;
  text-align: center;
}

.p2p-room__system-text {
  max-width: 92%;
  padding: 0.35rem 0.75rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.28);
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--nick-color, #d4d4d4);
}

.p2p-room__system-time {
  font-size: 0.65rem;
  color: rgba(240, 240, 240, 0.75);
}

.p2p-room__bubble-text {
  white-space: pre-wrap;
}

/* Сообщение с фото — без двойной рамки, как в Telegram */
.p2p-room__bubble--has-media {
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(128, 128, 128, 0.08);
}

.p2p-room__bubble--has-media.p2p-room__bubble--out {
  border-color: rgba(128, 128, 128, 0.1);
}

.p2p-room__bubble--has-media .p2p-room__bubble-name {
  padding: 0.4rem 0.65rem 0.2rem;
  margin: 0;
}

.p2p-room__bubble-media {
  position: relative;
  margin: 0;
  line-height: 0;
  background: rgba(5, 5, 5, 0.15);
}

.p2p-room__bubble-img {
  display: block;
  width: 100%;
  max-width: min(300px, 72vw);
  max-height: 360px;
  height: auto;
  object-fit: cover;
  cursor: zoom-in;
  vertical-align: top;
}

.p2p-room__bubble--has-media .p2p-room__bubble-text {
  margin: 0;
  padding: 0.4rem 0.65rem 0.2rem;
  border-top: 1px solid rgba(128, 128, 128, 0.06);
}

.p2p-room__bubble--has-media:not(.p2p-room__bubble--media-only) .p2p-room__bubble-meta {
  margin: 0;
  padding: 0.1rem 0.65rem 0.35rem;
}

.p2p-room__bubble--media-only .p2p-room__bubble-meta {
  position: absolute;
  right: 0.4rem;
  bottom: 0.35rem;
  z-index: 1;
  margin: 0;
  padding: 0.15rem 0.45rem;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.48);
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.p2p-room__bubble--media-only .p2p-room__bubble-time {
  color: rgba(240, 240, 240, 0.92);
  opacity: 1;
  text-shadow: none;
}

.p2p-room__bubble--media-only.p2p-room__bubble--in {
  border-bottom-left-radius: 4px;
}

.p2p-room__bubble--media-only.p2p-room__bubble--out {
  border-bottom-right-radius: 4px;
}

.p2p-room__scroll-end {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 4;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0;
  background: rgba(12, 12, 12, 0.92);
  color: #d4d4d4;
  box-shadow: none;
  cursor: pointer;
  transition: transform var(--dur-fast), background var(--dur-fast), opacity var(--dur-fast);
}

.p2p-room__scroll-end:hover {
  background: #94a3b8;
  transform: translateY(2px);
}

.p2p-room__scroll-end[hidden] {
  display: none;
}

.p2p-room__bubble-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.15rem;
}

.p2p-room__bubble-time {
  font-size: 0.68rem;
  opacity: 0.65;
}

.p2p-room__bubble-late {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: #d4d4d4;
  opacity: 0.95;
  margin-bottom: 0.1rem;
}

.p2p-room__composer-wrap {
  flex-shrink: 0;
  background: #161b22;
  border-top: 1px solid rgba(128, 128, 128, 0.06);
}

.p2p-room__bubble-row--reply-target .p2p-room__bubble {
  box-shadow: none;
}

.p2p-room__reply-compose {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
  padding: 0.42rem 0.55rem 0.38rem 0.65rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.06);
  background: #161b22;
  animation: p2p-reply-compose-in 0.18s ease-out;
}

.p2p-room__reply-compose[hidden] {
  display: none;
}

@keyframes p2p-reply-compose-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.p2p-room__reply-compose-accent {
  width: 3px;
  border-radius: 0;
  flex-shrink: 0;
  background: var(--nick-color, #94a3b8);
}

.p2p-room__reply-compose-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.p2p-room__reply-compose-name {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
}

.p2p-room__reply-compose-preview {
  font-size: 0.78rem;
  line-height: 1.25;
  color: rgba(240, 240, 240, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p2p-room__reply-compose-preview--media {
  color: rgba(240, 240, 240, 0.68);
}

.p2p-room__reply-compose-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  margin: -0.1rem -0.15rem 0 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #d4d4d4;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.p2p-room__reply-compose-close:hover {
  color: #d4d4d4;
  background: rgba(240, 240, 240, 0.08);
}

.p2p-room__voice-rec {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.06);
  background: rgba(108, 182, 255, 0.12);
}

.p2p-room__voice-rec[hidden] {
  display: none;
}

.p2p-room__voice-rec-label {
  font-size: 0.82rem;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.p2p-room__voice-rec-cancel {
  border: none;
  border-radius: 0;
  padding: 0.28rem 0.55rem;
  background: rgba(240, 240, 240, 0.08);
  color: #d4d4d4;
  font-size: 0.78rem;
  cursor: pointer;
}

.p2p-room__voice-rec-cancel:hover {
  background: rgba(240, 240, 240, 0.14);
}

.p2p-room__bubble--has-voice:not(.p2p-room__bubble--has-media) {
  padding: 0.38rem 0.55rem 0.32rem;
}

.p2p-room__bubble--has-voice {
  min-width: min(100%, 248px);
}

.p2p-room__bubble--has-voice .p2p-room__bubble-reply {
  margin-top: 0;
}

.p2p-room__bubble--has-voice.p2p-room__bubble--has-reply {
  min-width: min(100%, 260px);
}

.p2p-room__bubble-voice-host {
  margin: 0.05rem 0 0.1rem;
}

.p2p-room__voice-msg {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 200px;
  max-width: min(280px, 72vw);
  padding: 0.15rem 0.1rem 0.1rem 0;
}

.p2p-room__voice-msg--pending {
  opacity: 0.75;
}

.p2p-room__voice-play {
  flex-shrink: 0;
  width: 2.65rem;
  height: 2.65rem;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform var(--dur-fast),
    background var(--dur-fast),
    color var(--dur-fast);
}

.p2p-room__voice-msg--in .p2p-room__voice-play {
  background: rgba(108, 182, 255, 0.22);
  color: #94a3b8;
}

.p2p-room__voice-msg--out .p2p-room__voice-play {
  background: rgba(240, 240, 240, 0.2);
  color: #d4d4d4;
}

.p2p-room__voice-msg.is-playing .p2p-room__voice-play {
  transform: scale(1.04);
}

.p2p-room__voice-msg--in.is-playing .p2p-room__voice-play {
  background: #94a3b8;
  color: #d4d4d4;
}

.p2p-room__voice-msg--out.is-playing .p2p-room__voice-play {
  background: rgba(240, 240, 240, 0.92);
  color: #d4d4d4;
}

.p2p-room__voice-play--stub {
  pointer-events: none;
  opacity: 0.45;
}

.p2p-room__voice-play-icon {
  display: flex;
  line-height: 0;
}

.p2p-room__voice-track {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-top: 0.15rem;
}

.p2p-room__voice-wave {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 1.35rem;
}

.p2p-room__voice-bar {
  flex: 1;
  min-width: 2px;
  max-width: 4px;
  height: calc(var(--h, 0.5) * 100%);
  border-radius: 0;
  background: currentColor;
  opacity: 0.28;
  transition: opacity 0.08s linear;
}

.p2p-room__voice-msg--in .p2p-room__voice-wave {
  color: #94a3b8;
}

.p2p-room__voice-msg--out .p2p-room__voice-wave {
  color: rgba(240, 240, 240, 0.92);
}

.p2p-room__voice-bar.is-on {
  opacity: 1;
}

.p2p-room__voice-wave--skeleton .p2p-room__voice-bar,
.p2p-room__voice-wave--skeleton {
  animation: p2p-voice-skel 1.1s ease-in-out infinite alternate;
}

@keyframes p2p-voice-skel {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 0.7;
  }
}

.p2p-room__voice-time {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.72;
  align-self: flex-end;
}

.p2p-room__voice-audio {
  display: none;
}

.p2p-room__bubble--has-voice.p2p-room__bubble--media-only {
  position: relative;
  padding-bottom: 1.35rem;
}

.p2p-room__bubble--has-voice.p2p-room__bubble--media-only .p2p-room__bubble-meta {
  position: absolute;
  right: 0.45rem;
  bottom: 0.28rem;
  margin: 0;
}

.p2p-room__ctx-menu {
  position: fixed;
  z-index: 12000;
  min-width: 11.5rem;
  padding: 0.3rem;
  border-radius: 0;
  background: #161b22;
  border: 1px solid rgba(128, 128, 128, 0.1);
  box-shadow: none;
}

.p2p-room__ctx-menu[hidden] {
  display: none;
}

.p2p-room__ctx-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #d4d4d4;
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}

.p2p-room__ctx-item:hover {
  background: rgba(108, 182, 255, 0.18);
}

.p2p-room__ctx-item[hidden] {
  display: none;
}

.p2p-room__bubble-reply {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  width: 100%;
  margin: 0 0 0.38rem;
  padding: 0.32rem 0.5rem 0.32rem 0.42rem;
  border: none;
  border-radius: 0;
  background: rgba(5, 5, 5, 0.16);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast);
}

.p2p-room__bubble-reply:hover {
  background: rgba(5, 5, 5, 0.24);
}

.p2p-room__bubble--has-reply.p2p-room__bubble--out .p2p-room__bubble-reply {
  background: rgba(5, 5, 5, 0.12);
}

.p2p-room__bubble--has-reply.p2p-room__bubble--out .p2p-room__bubble-reply:hover {
  background: rgba(5, 5, 5, 0.2);
}

.p2p-room__bubble-reply-accent {
  width: 3px;
  border-radius: 0;
  flex-shrink: 0;
  background: var(--nick-color, #94a3b8);
}

.p2p-room__bubble-reply-inner {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.p2p-room__bubble-reply-name {
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--nick-color, #94a3b8);
}

.p2p-room__bubble-reply-line {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

.p2p-room__bubble-reply-kind-icon {
  flex-shrink: 0;
  display: flex;
  color: rgba(240, 240, 240, 0.7);
  line-height: 0;
}

.p2p-room__bubble-reply-text {
  font-size: 0.78rem;
  line-height: 1.3;
  color: rgba(240, 240, 240, 0.82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p2p-room__tg-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  padding: 0.5rem 0.65rem 0.65rem;
  background: transparent;
  flex-shrink: 0;
}

.p2p-room__tg-attach {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #d4d4d4;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur-fast), background var(--dur-fast);
}

.p2p-room__tg-attach:hover:not(:disabled) {
  color: #d4d4d4;
  background: rgba(240, 240, 240, 0.06);
}

.p2p-room__tg-attach:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.p2p-room__tg-mic {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #d4d4d4;
  font-size: 1.05rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur-fast), background var(--dur-fast);
}

.p2p-room__tg-mic:hover:not(:disabled) {
  color: #d4d4d4;
  background: rgba(240, 240, 240, 0.06);
}

.p2p-room__tg-mic.is-recording {
  color: #d4d4d4;
  background: #e94142;
  animation: p2p-mic-pulse 1.1s ease-in-out infinite;
}

.page-hidden .p2p-room__tg-mic.is-recording {
  animation-play-state: paused;
}

.p2p-room__tg-mic:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@keyframes p2p-mic-pulse {
  0%,
  100% {
    box-shadow: none;
  }
  50% {
    box-shadow: none;
  }
}

.p2p-room__tg-input {
  flex: 1;
  min-height: 2.35rem;
  max-height: 120px;
  padding: 0.5rem 0.85rem;
  border: none;
  border-radius: 0;
  background: #161b22;
  color: #d4d4d4;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  line-height: 1.35;
  resize: none;
}

.p2p-room__tg-input::placeholder {
  color: #94a3b8;
}

.p2p-room__tg-input:focus {
  outline: 2px solid rgba(108, 182, 255, 0.35);
}

.p2p-room__tg-send {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 0;
  background: #94a3b8;
  color: #d4d4d4;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast), opacity var(--dur-fast);
}

.p2p-room__tg-send:hover:not(:disabled) {
  background: #94a3b8;
}

.p2p-room__tg-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.p2p-room__tg-send-icon {
  font-size: 1rem;
  margin-left: 0.1rem;
}

.synthesis__ff-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--accent-2);
}

.synthesis__eq {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

.synthesis__eq code {
  font-family: var(--font-mono);
  color: var(--text);
}

.synthesis__eq-hint {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.synthesis__eq-hint code {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.synth-kmap-guide__h {
  margin: 1rem 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.synth-kmap-guide__lead {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.synth-kmap-guide__body ul {
  margin: 0 0 0.5rem;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  line-height: 1.55;
}

.synthesis__gates {
  margin: 0.5rem 0 1rem;
  padding-left: 1.2rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}
