/* Trận chiến Sudoku: giao diện bổ sung cho ChiaNè / Trò chơi nhóm (game.css). */
.sd-narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.sd-code-in { text-align: center; font-size: 2rem; font-weight: 800; letter-spacing: .5em; padding-left: calc(.5em + 14px); text-transform: uppercase; }
.sd-code-tag { display: inline-block; padding: 0 .5em; border-radius: 10px; background: var(--teal-soft); color: var(--teal-deep); letter-spacing: .25em; font-weight: 800; }
.sd-label { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.sd-wait { margin: 8px 0; color: var(--ink-2); }
.sd-room .card { margin-bottom: 14px; }
.sd-msg { text-align: center; }
.sd-bigcode { font-size: clamp(2.4rem, 12vw, 3.6rem); font-weight: 800; letter-spacing: .3em; padding-left: .3em; color: var(--teal-deep); line-height: 1.15; }
.sd-guest-code { text-align: center; }
.sd-invite-grid { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
@media (max-width: 520px) { .sd-invite-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.sd-invite-info { min-width: 0; width: 100%; }
.sd-link { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.sd-link input { flex: 1; min-width: 0; padding: 9px 12px; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; font: inherit; font-size: .9rem; }
.sd-qr { width: 200px; height: 200px; line-height: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.sd-qr svg { width: 100%; height: 100%; display: block; }
.sd-count { font-weight: 600; color: var(--ink-3); font-size: .9em; }
.sd-plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sd-prow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.sd-prow.is-off { opacity: .6; }
.sd-av { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 800; }
.sd-pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sd-pname small { color: var(--ink-3); font-weight: 500; }
.sd-badge { padding: 2px 8px; border-radius: 99px; background: var(--khaki-soft); color: var(--ink-2); font-size: .72rem; font-weight: 700; }
.sd-badge.is-off { background: var(--mahogany-soft); color: var(--mahogany); }
.sd-x { flex: none; min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 99px; background: transparent; font: inherit; font-weight: 700; color: var(--mahogany); cursor: pointer; }
.sd-x:hover, .sd-x.is-arm { background: var(--mahogany); color: #fff; border-color: var(--mahogany); }
.sd-lobby-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sd-lobby-actions .btn-primary { margin-left: auto; min-width: 190px; }
.sd-lock-ico { font-size: 1.2rem; margin-right: 4px; }
#sdLock.is-locked { border-color: var(--mahogany); background: var(--mahogany-soft); color: var(--mahogany); }
.sd-msgs { margin: 12px 0; max-height: 220px; min-height: 80px; overflow-y: auto; display: grid; gap: 6px; align-content: start; }
.sd-audio { position: absolute; width: 0; height: 0; overflow: hidden; }

.sd-home { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 420px) { .sd-home { grid-template-columns: 1fr; } }


.sd-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 16, 14, .55); }
.sd-modal[hidden] { display: none; }
.sd-modal-box { width: 100%; max-width: 440px; max-height: 92vh; overflow: auto; padding: 22px; border-radius: var(--r-lg); background: var(--paper); box-shadow: var(--shadow-lift); }
.sd-modal-box h2 { margin: 0 0 6px; }
.sd-home { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 420px) { .sd-home { grid-template-columns: 1fr; } }
.sd-hint { margin: 0 0 14px; color: var(--ink-2); font-size: .9rem; }
.sd-modal-sub { margin: 0 0 14px; color: var(--ink-2); }
#crDiff { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; font: inherit; font-size: 16px; }

/* ---- Màn chơi ---- */
.sd-game { max-width: 520px; margin: 0 auto; padding-bottom: 36px; }
.sd-hbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 10px; font-weight: 700; }
.sd-who { color: var(--ink-2); font-size: .9rem; }
.sd-clock { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--teal-deep); }
.sd-countdown { min-height: 320px; display: flex; align-items: center; justify-content: center; font-size: 7rem; font-weight: 800; color: var(--teal-deep); }
.sd-countdown[hidden], .sd-over[hidden], .sd-board-wrap[hidden], .sd-pad[hidden] { display: none; }
.sd-board-wrap { position: relative; }
.sd-board { display: grid; grid-template-columns: repeat(9, 1fr); border: 3px solid var(--ink); border-radius: 6px; overflow: hidden; background: #fff; aspect-ratio: 1; user-select: none; }
.sd-cell { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; padding: 0; border: 0; border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); background: #fff; color: var(--teal-deep); font: inherit; font-size: clamp(1.1rem, 5.4vw, 1.9rem); font-weight: 600; cursor: pointer; }
.sd-cell:nth-child(9n + 3), .sd-cell:nth-child(9n + 6) { border-right: 2px solid var(--ink); }
.sd-cell:nth-child(n + 19):nth-child(-n + 27), .sd-cell:nth-child(n + 46):nth-child(-n + 54) { border-bottom: 2px solid var(--ink); }
.sd-cell:nth-child(9n) { border-right: 0; }
.sd-cell:nth-child(n + 73) { border-bottom: 0; }
.sd-cell.is-given { color: var(--ink); font-weight: 800; background: #f3f1ec; }
.sd-cell.is-rel { background: #e6f1f1; }
.sd-cell.is-given.is-rel { background: #dbe8e8; }
.sd-cell.is-same { background: #bfe0e0; }
.sd-cell.is-sel { background: #8fcfd1; }
.sd-cell.is-bad { color: #d12b2b; background: #fde3e3; }
.sd-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 14px; }
.sd-pad button { padding: 12px 0; border: 1.5px solid var(--line-strong); border-radius: 12px; background: var(--paper); font: inherit; font-size: 1.4rem; font-weight: 700; color: var(--teal-deep); cursor: pointer; box-shadow: var(--shadow); }
.sd-pad button:active { transform: translateY(2px); }
.sd-pad .sd-erase { color: var(--mahogany); }
.sd-pad.is-locked, .sd-board-wrap.is-locked .sd-board { pointer-events: none; }
.sd-pad.is-locked { opacity: .4; }
.sd-over { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; text-align: center; background: rgba(250, 248, 243, .93); border-radius: 6px; }
.sd-over-ico { font-size: 3.4rem; line-height: 1; }
.sd-over-t { margin: 0; font-size: 1.3rem; line-height: 1.4; }
.sd-over-s { margin: 4px 0 0; color: var(--ink-2); font-size: 1.05rem; font-weight: 600; }
@media (max-width: 400px) { .sd-pad { grid-template-columns: repeat(5, 1fr); gap: 6px; } }

.sd-alone { margin: 6px 0 10px; padding: 10px 14px; border-radius: 12px; background: #fff4c7; border: 1px solid #e6c84a; text-align: center; font-weight: 700; }
.sd-alone[hidden] { display: none; }
.sd-hbar .btn { margin-left: auto; margin-right: 12px; }
