/* ============================================================
   ChatBase — ⚔️ Duels (duels.js)
   Entry card reuses Draw & Guess's .dg-entry look (beyond.css).
   ============================================================ */
.du-entry { background: linear-gradient(120deg, rgba(255,90,122,.18), rgba(255,180,67,.1)); border-color: rgba(255,90,122,.4); }
.du-count { display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 6px; border-radius: 999px; background: #ff5a7a; color: #fff; font-size: 12px; text-align: center; vertical-align: middle; }
.du-count[hidden] { display: none; }

.du-modal {
    position: fixed; inset: 0; z-index: 99994;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    background: rgba(4,4,10,.66);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.du-modal[hidden] { display: none; }
.du-box {
    position: relative;
    width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
    padding: 22px;
    border-radius: 24px;
    border: 1px solid var(--neo-line-hi, rgba(255,255,255,.16));
    background: rgba(18,18,26,.96);
    color: #fff;
    box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.du-x { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; font-size: 14px; }
.du-title { margin: 0 0 12px; font-size: 21px; letter-spacing: -0.02em; }
.du-turn { text-align: center; font-size: 18px; color: var(--neo-dim, rgba(235,235,245,.7)); }
.du-turn.go { color: #5ef0c0; }
.du-sub { margin: 18px 0 8px; font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--neo-dim, rgba(235,235,245,.6)); }
.du-muted { font-size: 12.5px; color: var(--neo-dim, rgba(235,235,245,.6)); font-weight: 400; text-transform: none; letter-spacing: 0; }
.du-btn {
    padding: 8px 14px; border-radius: 999px;
    border: 1px solid var(--neo-line-hi, rgba(255,255,255,.16));
    background: rgba(255,255,255,.07); color: #fff;
    font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap;
}
.du-btn:hover { background: rgba(255,255,255,.14); }
.du-btn.primary { background: var(--gradient-purple, linear-gradient(120deg,#7c5cff,#5b8cff)); border-color: transparent; }
.du-btn.danger { border-color: rgba(255,90,122,.45); color: #ff8aa0; }
.du-games { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.du-game {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-radius: 16px;
    border: 1px solid var(--neo-line-hi, rgba(255,255,255,.16));
    background: rgba(255,255,255,.04); color: #fff;
    font: inherit; font-size: 14px; font-weight: 650; cursor: pointer;
}
.du-game span { font-size: 22px; }
.du-game.on { border-color: var(--neo-accent, #8ab4ff); background: rgba(138,180,255,.12); }
.du-people { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; max-height: 240px; overflow-y: auto; }
.du-person, .du-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 12px; }
.du-person:hover, .du-row:hover { background: rgba(255,255,255,.04); }
.du-person b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.du-av { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; background: rgba(255,255,255,.08); display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
.du-av img { width: 100%; height: 100%; object-fit: cover; }
.du-row-ic { font-size: 20px; }
.du-row-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.du-row-t b { font-size: 14px; }
.du-row-t small { font-size: 12px; color: var(--neo-dim, rgba(235,235,245,.6)); }
.du-row .du-btn + .du-btn { margin-left: -4px; }

.du-game-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 40px 14px 0; flex-wrap: wrap; }
.du-board { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 6px; margin: 0 auto; }
.du-board.du-ttt { width: min(300px, 100%); }
.du-board.du-c4 { width: min(420px, 100%); padding: 10px; border-radius: 18px; background: #1d3ea8; gap: 6px; }
.du-cell {
    aspect-ratio: 1;
    display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: 14px;
    background: rgba(255,255,255,.06); color: #fff;
    font: inherit; font-size: clamp(28px, 9vw, 56px); font-weight: 800; line-height: 1;
    cursor: pointer; transition: background .15s, transform .15s;
}
.du-cell:not([disabled]):hover { background: rgba(255,255,255,.14); }
.du-cell[disabled] { cursor: default; }
.du-ttt .du-cell.m1 { color: #ff8aa0; }
.du-ttt .du-cell.m2 { color: #8ab4ff; }
.du-c4 .du-cell { border-radius: 50%; background: #0b1530; }
.du-c4 .du-cell:not([disabled]):hover { background: #16264d; }
.du-c4 .du-cell.m1 { background: #ff4757; }
.du-c4 .du-cell.m2 { background: #ffd43b; }
.du-cell.last { box-shadow: inset 0 0 0 3px rgba(255,255,255,.45); }
.du-cell.hot { animation: duHot 0.9s ease-in-out infinite alternate; box-shadow: 0 0 0 3px #5ef0c0; }
@keyframes duHot { to { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .du-cell.hot { animation: none; } }
.du-actions { display: flex; justify-content: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.du-pop {
    position: fixed; right: 16px; bottom: 16px; z-index: 99993;
    width: min(320px, calc(100vw - 32px));
    padding: 14px 16px; border-radius: 18px;
    border: 1px solid rgba(255,90,122,.45);
    background: rgba(18,18,26,.97); color: #fff;
    font-size: 14px; line-height: 1.45;
    box-shadow: 0 20px 50px rgba(0,0,0,.5);
    animation: duIn .35s ease-out;
}
.du-pop div { display: flex; gap: 8px; margin-top: 10px; }
@keyframes duIn { from { transform: translateY(20px); opacity: 0; } }
@media (max-width: 900px) { .du-pop { bottom: 84px; } }

/* ---------- ⌨️ Type Race (typerace.js) — shares the Duels pop-up shell ---------- */
.tr-entry { background: linear-gradient(120deg, rgba(52,232,176,.16), rgba(34,211,238,.1)); border-color: rgba(52,232,176,.4); }
.tr-box { width: min(720px, 100%); }
.tr-modes { display: flex; gap: 6px; margin-bottom: 12px; }
.tr-modes button {
    padding: 6px 14px; border-radius: 999px;
    border: 1px solid var(--neo-line-hi, rgba(255,255,255,.16));
    background: transparent; color: var(--neo-dim, rgba(235,235,245,.7));
    font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
}
.tr-modes button.on { background: rgba(255,255,255,.12); color: #fff; }
.tr-live { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.tr-live span { display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border-radius: 14px; background: rgba(255,255,255,.04); }
.tr-live b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tr-live small { font-size: 11px; color: var(--neo-dim, rgba(235,235,245,.6)); }
.tr-text {
    position: relative;
    max-height: 150px; overflow: hidden;
    padding: 14px 16px; border-radius: 16px;
    background: rgba(255,255,255,.03); border: 1px solid var(--neo-line, rgba(255,255,255,.08));
    font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 19px; line-height: 1.7;
    color: rgba(235,235,245,.38); user-select: none; overflow-wrap: break-word;
}
.tr-text .ok { color: #fff; }
.tr-text .bad { color: #ff5a7a; background: rgba(255,90,122,.15); border-radius: 3px; }
.tr-text .cur { box-shadow: inset 2px 0 0 #8ab4ff; animation: trBlink 1s steps(1) infinite; }
@keyframes trBlink { 50% { box-shadow: none; } }
.tr-input {
    width: 100%; box-sizing: border-box; margin-top: 10px;
    padding: 12px 14px; border-radius: 12px;
    border: 1px solid var(--neo-line-hi, rgba(255,255,255,.16));
    background: rgba(255,255,255,.06); color: #fff;
    font: inherit; font-size: 15px; outline: none;
}
.tr-input:focus { border-color: var(--neo-accent, #8ab4ff); }
.tr-result { margin-top: 12px; padding: 14px; border-radius: 14px; background: rgba(94,240,192,.1); border: 1px solid rgba(94,240,192,.35); text-align: center; }
.tr-result[hidden] { display: none; }
.tr-result b { display: block; font-size: 28px; }
.tr-result span { display: block; margin-top: 4px; font-size: 13.5px; color: var(--neo-dim, rgba(235,235,245,.75)); }
.tr-row { display: flex; justify-content: center; margin-top: 10px; }
.tr-board { display: flex; flex-direction: column; gap: 3px; }
.tr-board-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 72px; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 10px; font-size: 13.5px; }
.tr-board-row.me { background: rgba(138,180,255,.12); }
.tr-board-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tr-board-row small { color: var(--neo-dim, rgba(235,235,245,.6)); }
.tr-board-row em { font-style: normal; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .tr-live { grid-template-columns: repeat(2, 1fr); } .tr-text { font-size: 16px; } }
