/* Nối từ: màn hình chơi (js/room.js) và các phần của bảng tổng kết (js/scoreboard.js). Phần dùng chung của các trò
   (sảnh chờ, danh sách phòng, hộp thoại kết quả, bảng xếp hạng) nằm ở shared/css/game.css. */

/* Màn hình chơi: cột dọc vừa khung nhìn; chuỗi từ cuộn trong khung của nó, ô nhập ở dưới luôn thấy (cả khi bàn phím điện
   thoại mở: khung nhìn co lại, chuỗi từ co theo). */
.nt-play {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 720px);
  min-height: 0;
  margin: 0 auto;
  padding: 10px var(--pad-right) calc(10px + var(--safe-bottom)) var(--pad-left);
}

.nt-top { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.nt-turn { display: grid; gap: 2px; min-width: 0; }
.nt-mode { color: var(--muted); font-size: 13px; }
.nt-turn strong { overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
/* Đồng hồ 15 giây hiện to; đổi màu cảnh báo khi còn ≤ 5 giây. */
.nt-clock { flex: none; min-width: 2.2ch; color: var(--accent); font-family: "Playfair Display", Georgia, serif; font-size: 40px; font-variant-numeric: tabular-nums; line-height: 1; text-align: right; }
.nt-clock.is-warn { color: var(--red); }

.nt-team { flex: none; margin: 0; padding: 8px 12px; border-left: 4px solid var(--c, var(--accent)); border-radius: 10px; background: var(--white); font-weight: 600; }

.nt-scores { display: flex; flex: none; gap: 8px; margin: 0; padding: 0 0 2px; overflow-x: auto; list-style: none; font-size: 14px; }
.nt-scores:empty { display: none; }
.nt-scores li { display: inline-flex; flex: none; align-items: center; gap: 6px; max-width: 100%; padding: 6px 10px; border: 1px solid var(--line); border-left: 4px solid var(--c, var(--line)); border-radius: 999px; background: var(--white); white-space: nowrap; }
.nt-scores li span, .nt-scores li b { overflow: hidden; text-overflow: ellipsis; }
.nt-scores li.is-me { border-color: var(--accent); font-weight: 700; }
.nt-scores b { font-variant-numeric: tabular-nums; }

.nt-chain-box { display: flex; flex: 1; flex-direction: column; min-height: 96px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.nt-chain-title { flex: none; margin: 0 0 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.nt-chain { flex: 1; min-height: 0; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; }
.nt-chain li { padding: 5px 2px; border-bottom: 1px dashed var(--line); overflow-wrap: anywhere; }
.nt-chain li:last-child { border-bottom: 0; font-weight: 700; }
.nt-chain li.is-me { color: var(--accent-dark); }
.nt-chain li.is-start { color: var(--muted); font-style: italic; }
.nt-chain li.empty { color: var(--muted); }

.nt-tries { display: grid; flex: none; gap: 2px; max-height: 6.5em; margin: 0; padding: 0; overflow-y: auto; list-style: none; color: var(--muted); font-size: 13px; }
.nt-tries li { overflow-wrap: anywhere; }
.nt-tries li.is-me { color: var(--red); }

/* Ô nhập: âm tiết đầu (kiểu nối) đứng trước ô, nút "Gửi" ở cuối. */
.nt-form { display: flex; flex: none; align-items: center; gap: 8px; }
.nt-form[hidden] { display: none; }
.nt-head { flex: none; max-width: 40%; overflow: hidden; font-size: 18px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.nt-head:empty, .nt-head[hidden] { display: none; }
.nt-form .input { flex: 1; min-width: 0; font-size: 18px; }
.nt-form .btn { flex: none; }
.nt-form-error { flex: none; min-height: 0; margin: 0; }
.nt-form-error:empty { display: none; }

/* Bảng tổng kết: chuỗi từ của ván dưới bảng xếp hạng. */
.nt-results-table { display: grid; gap: 14px; }
.nt-chain-saved h3 { margin: 0 0 6px; font-size: 15px; }
.nt-chain-saved h4 { margin: 10px 0 4px; padding-left: 8px; border-left: 4px solid var(--c, var(--accent)); font-size: 14px; }
.nt-chain-list { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.nt-chain-list li { padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); }
.nt-chain-list li.is-me { border-color: var(--accent); color: var(--accent-dark); }
.nt-chain-list li.is-start { color: var(--muted); font-style: italic; }

@media (min-width: 900px) {
  .nt-play { padding-top: 16px; }
  .nt-clock { font-size: 48px; }
}

/* 3… 2… 1… trước lượt đầu, phủ cả màn hình. */
.nt-countdown { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgb(36 28 23 / 0.78); color: #faf6f0; font-family: "Playfair Display", Georgia, serif; font-size: clamp(64px, 26vw, 180px); line-height: 1; }
.nt-countdown[hidden] { display: none; }

/* Từ trong chuỗi từ đã xong: liên kết tới nghĩa (Wiktionary). */
.nt-word-link { color: inherit; font-weight: 600; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.nt-word-link:hover, .nt-word-link:focus-visible { color: var(--accent-dark); text-decoration-color: currentColor; }
.nt-chain-hint { margin: -2px 0 6px; font-size: 12px; }
