/* Декодер online (server room) screens. Game Theme layer: colours come from dc-theme.css tokens
   (palette atlas COMMON/roomplay-palettes.html / decoder): team A red, team B blue, intercept green,
   miscommunication red, ✓/✕ from answer-marks.css. */
.dco-screen { gap: 12px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.dco-screen .title { margin-bottom: 0; }
.dco-screen .subtitle { margin: 0; max-width: 360px; text-align: center; }
.dco-online .team-A { --dco-team: var(--team-a); --dco-team-soft: rgba(182, 47, 53, .1); }
.dco-online .team-B { --dco-team: var(--team-b); --dco-team-soft: rgba(38, 106, 139, .1); }

.dco-status { min-height: 1.4em; margin: 0; color: var(--text-secondary); font-size: 15px; text-align: center; }
.dco-link {
  min-height: 44px; padding: 8px 16px; border: 0; background: none;
  color: var(--dc-ink); font: inherit; font-size: 16px; font-weight: 700; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer;
}
.dco-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.dco-actions .btn-skip { width: 100%; }
.dco-actions [hidden] { display: none !important; }

/* ---- Teams ---- */
.dco-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 420px; }
.dco-team-card {
  display: flex; flex-direction: column; gap: 10px; min-height: 180px; padding: 12px;
  border: 2px solid var(--dc-line); border-radius: 16px; background: var(--bg-card);
  color: var(--dc-ink); font: inherit; text-align: left; cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}
.dco-team-card.is-mine { border-color: var(--dco-team); background: var(--dco-team-soft); }
.dco-team-card:active { transform: scale(.98); }
.dco-team-card:focus-visible { outline: 3px solid var(--dc-ink); outline-offset: 2px; }
.dco-team-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dco-team-head strong { color: var(--dco-team); font-size: 18px; }
.dco-team-count {
  display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px;
  border-radius: 14px; background: var(--dco-team); color: #fff; font-weight: 800; font-size: 15px;
}
.dco-team-list { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.dco-team-empty { color: var(--text-secondary); font-size: 15px; }
.dco-team-player { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 15px; font-weight: 600; }
.dco-team-player.is-away { opacity: .5; }
.dco-team-player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dco-team-cta { color: var(--dco-team); font-size: 14px; font-weight: 800; text-align: center; }
.dco-avatar {
  display: inline-grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; overflow: hidden;
  border-radius: 50%; background: var(--bg-secondary); color: var(--dc-ink); font-size: 13px; font-weight: 800;
}
.dco-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Round ---- */
.dco-header { position: relative; }
.dco-icon-button {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; background: none; color: var(--dc-ink); cursor: pointer;
}
.dco-icon-button:focus-visible { outline: 3px solid var(--dc-ink); outline-offset: 2px; border-radius: 12px; }
.dco-score { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; max-width: 420px; }
.dco-score-team {
  display: flex; flex-direction: column; gap: 4px; padding: 8px 10px;
  border: 2px solid var(--dc-line); border-radius: 14px; background: var(--bg-card);
}
.dco-score-team.is-mine { border-color: var(--dco-team); }
.dco-score-team strong { color: var(--dco-team); font-size: 15px; }
.dco-tokens { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.dco-token { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
.dco-token b { margin-left: auto; font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.dco-token-label { color: var(--text-secondary); }
.dco-token .rp-mark { width: 16px; height: 16px; }
.dco-token-intercept .rp-mark, .dco-tokens .dco-token:first-child .rp-mark { color: var(--intercept-green); }
.dco-token-miss .rp-mark, .dco-tokens .dco-token:last-child .rp-mark { color: var(--miscom-red); }

.dco-words { width: 100%; max-width: 420px; }
.dco-words:empty { display: none; }
.dco-label { margin-bottom: 6px; color: var(--text-secondary); font-size: 14px; font-weight: 700; text-align: center; }
.dco-word-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dco-word {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px;
  border: 2px solid var(--dco-team); border-radius: 12px; background: var(--bg-card); text-align: center;
}
.dco-word-number { color: var(--dco-team); font-size: 15px; font-weight: 900; }
.dco-word-text { font-size: 14px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; hyphens: auto; }
.dco-word.is-long .dco-word-text { font-size: 12px; }
.dco-word.is-longer .dco-word-text { font-size: 11px; }

.dco-stage { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 420px; }
.dco-card {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  border: 2px solid var(--dc-line); border-radius: 16px; background: var(--bg-card);
}
.dco-card.team-A, .dco-card.team-B { border-color: var(--dco-team); }
.dco-card-title { margin: 0; font-size: 18px; line-height: 1.2; }
.dco-card.team-A .dco-card-title, .dco-card.team-B .dco-card-title { color: var(--dco-team); }
.dco-card-text { margin: 0; color: var(--text-secondary); font-size: 15px; line-height: 1.35; }

.dco-code { display: flex; justify-content: center; gap: 10px; }
.dco-code-digit {
  display: inline-grid; place-items: center; width: 56px; height: 64px;
  border: 2px solid var(--dc-ink); border-radius: 14px; background: var(--bg-primary);
  font-size: 32px; font-weight: 900; font-variant-numeric: tabular-nums;
}
.dco-code-small .dco-code-digit { width: 40px; height: 44px; font-size: 22px; border-radius: 10px; }

.dco-clue-form { display: flex; flex-direction: column; gap: 10px; }
.dco-clue-field { display: flex; flex-direction: column; gap: 4px; }
.dco-clue-for { font-size: 14px; font-weight: 800; color: var(--dco-team); }
.dco-input {
  width: 100%; min-height: 48px; padding: 10px 14px; box-sizing: border-box;
  border: 2px solid var(--dc-line-strong); border-radius: 14px; background: #fff; color: var(--dc-ink);
  font: inherit; font-size: 17px;
}
.dco-input:focus { outline: none; border-color: var(--dco-team); }

.dco-wait-row { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.dco-wait-text { flex: 1; min-width: 0; font-weight: 700; }
.dco-wait-status { display: inline-flex; align-items: center; gap: 4px; color: var(--text-secondary); font-weight: 700; }
.dco-wait-status.is-ready { color: var(--intercept-green); }
.dco-wait-status .rp-mark { width: 14px; height: 14px; }

.dco-guess-list { display: flex; flex-direction: column; gap: 8px; }
.dco-guess-row { display: flex; align-items: center; gap: 8px; }
.dco-guess-clue { flex: 1; min-width: 0; font-size: 17px; font-weight: 800; overflow-wrap: anywhere; }
.dco-digits { display: flex; gap: 4px; }
.dco-digit {
  width: 44px; height: 44px; padding: 0; border: 2px solid var(--dc-line-strong); border-radius: 12px;
  background: var(--bg-primary); color: var(--dc-ink); font: inherit; font-size: 18px; font-weight: 900; cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.dco-digit.is-selected { border-color: var(--dco-team); background: var(--dco-team); color: #fff; }
.dco-digit:active:not(:disabled) { transform: scale(.92); }
.dco-digit:disabled { cursor: default; }
.dco-digit:disabled:not(.is-selected) { opacity: .45; }
.dco-digit:focus-visible { outline: 3px solid var(--dc-ink); outline-offset: 2px; }
.dco-sent { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--intercept-green); font-weight: 800; }

.dco-result-clues { display: flex; flex-direction: column; gap: 6px; }
.dco-result-clue { display: flex; align-items: center; gap: 10px; }
.dco-result-clue .dco-code-digit { width: 36px; height: 36px; font-size: 18px; border-radius: 10px; border-color: var(--dco-team); }
.dco-result-line { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; }
.dco-result-line span:not(.rp-mark) { flex: 1; }
.dco-result-line.is-correct strong { color: var(--rp-correct); }
.dco-result-line.is-wrong strong { color: var(--rp-wrong); }
.dco-result-line.is-correct .rp-mark { color: var(--rp-correct); }
.dco-result-line.is-wrong .rp-mark { color: var(--rp-wrong); }

/* ---- Board ---- */
.dco-board { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 420px; }
.dco-board-team { padding: 12px; border: 2px solid var(--dco-team); border-radius: 16px; background: var(--bg-card); }
.dco-board-title { margin: 0 0 8px; color: var(--dco-team); font-size: 18px; }
.dco-board-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.dco-board-table th, .dco-board-table td {
  padding: 6px 4px; border-bottom: 1px solid var(--dc-line); font-size: 14px; text-align: center;
  overflow-wrap: break-word; hyphens: auto;
}
.dco-board-table td + td, .dco-board-table th + th { border-left: 1px solid var(--dc-line); }
.dco-board-number { display: block; color: var(--dco-team); font-size: 17px; font-weight: 900; }
.dco-board-word { display: block; font-size: 13px; font-weight: 700; }
.dco-board-pending { margin: 8px 0 0; color: var(--text-secondary); font-size: 14px; }

/* ---- Game over ---- */
.dco-over { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; max-width: 420px; }
.dco-over-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.dco-over .dco-card.is-winner { background: var(--dco-team-soft); }
.dco-over-art { width: 160px; height: 160px; }
.dco-over-art img { width: 100%; height: 100%; }
.dco-over-words { margin: 0; padding-left: 22px; font-size: 15px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.dco-over-names { margin: 0; font-size: 14px; font-weight: 700; }

/* ---- Connection ---- */
.dco-connection {
  position: fixed; inset: auto 16px max(16px, env(safe-area-inset-bottom)); z-index: 50;
  display: none; align-items: center; gap: 10px; padding: 12px 16px;
  border-radius: 14px; background: var(--dc-ink); color: #fff; font-size: 15px;
}
.dco-connection.visible { display: flex; }
.dco-connection p { margin: 0; }
.dco-connection .loader-spinner { width: 20px; height: 20px; border-width: 2px; border-color: rgba(255, 255, 255, .25); border-top-color: #fff; }

@media (max-width: 360px) {
  .dco-digit { width: 38px; height: 40px; font-size: 16px; }
  .dco-code-digit { width: 48px; height: 56px; font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .dco-team-card, .dco-digit { transition: none; }
}
