/* Data Detective — the guess-then-reveal game on /data (content pipeline item 20). */

.dq-card { border-top: 4px solid #6f42c1 !important; }
.dq-hud { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.dq-hud-item { display: flex; flex-direction: column; line-height: 1.1; min-width: 3.5rem; }
.dq-hud-item > span { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.dq-hud-item small { color: var(--bs-secondary-color, #6c757d); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.dq-hearts { color: #dc3545; letter-spacing: .1em; }
.dq-combo { display: inline-block; color: #6f42c1; }
.dq-pop { animation: dq-pop .45s ease-out; }
@keyframes dq-pop { 0% { transform: scale(1); } 40% { transform: scale(1.6); color: #d63384; } 100% { transform: scale(1); } }

.dq-stage { position: relative; min-height: 22rem; border-radius: .75rem; padding: 1rem;
    background: linear-gradient(160deg, rgba(111, 66, 193, .07), rgba(13, 110, 253, .05)); overflow: hidden; }
.dq-progress { height: .35rem; background: rgba(111, 66, 193, .15); border-radius: 1rem; overflow: hidden; margin-bottom: .6rem; }
.dq-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #6f42c1, #0d6efd); transition: width .4s ease; }
.dq-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .8rem; color: var(--bs-secondary-color, #6c757d); margin-bottom: .5rem; }
.dq-band-pill { background: #6f42c1; color: #fff; border-radius: 1rem; padding: .1rem .6rem; font-weight: 600; }
.dq-kind { background: rgba(13, 110, 253, .12); color: #0a58ca; border-radius: 1rem; padding: .1rem .6rem; font-weight: 600; }

.dq-prompt { font-size: 1.15rem; font-weight: 700; margin-bottom: .9rem; }
.dq-enter { animation: dq-enter .35s ease-out; }
@keyframes dq-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.dq-options { display: grid; gap: .6rem; align-items: stretch; }
.dq-options.dq-pair { grid-template-columns: 1fr auto 1fr; }
.dq-options.dq-quad { grid-template-columns: 1fr 1fr; }
.dq-vs { align-self: center; font-weight: 800; color: #6f42c1; font-size: .9rem; }
.dq-option { position: relative; display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .8rem .6rem .6rem;
    border: 2px solid rgba(111, 66, 193, .25); border-radius: .75rem; background: var(--bs-body-bg, #fff); color: inherit;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; text-align: center; }
.dq-option:not(:disabled):hover { transform: translateY(-2px); border-color: #6f42c1; box-shadow: 0 .4rem 1rem rgba(111, 66, 193, .18); }
.dq-option:disabled { cursor: default; }
.dq-key { position: absolute; top: .35rem; left: .5rem; font-size: .7rem; color: var(--bs-secondary-color, #6c757d); }
.dq-option-label { font-weight: 700; font-size: 1.05rem; }
.dq-option-label.dq-hanzi { font-size: 2.4rem; line-height: 1.1; font-weight: 500; }
.dq-option-sub { font-size: .85rem; color: #0a58ca; }
.dq-option-gloss { font-size: .78rem; color: var(--bs-secondary-color, #6c757d); max-width: 14rem; margin-bottom: .4rem; }
.dq-bar { display: block; width: 100%; margin-top: auto; padding-top: 0; height: .45rem; background: rgba(111, 66, 193, .12); border-radius: 1rem; overflow: hidden; }
.dq-bar-fill { display: block; height: 100%; width: 0; background: #0d6efd; border-radius: 1rem; transition: width .7s cubic-bezier(.2, .8, .2, 1); }
.dq-value { display: block; font-size: .72rem; line-height: 1.25; font-variant-numeric: tabular-nums; min-height: 1em; }
.dq-picked { border-color: #0d6efd; }
.dq-winner { border-color: #198754 !important; box-shadow: 0 0 0 .2rem rgba(25, 135, 84, .2); }
.dq-winner .dq-bar-fill { background: #198754; }
.dq-loser { border-color: #dc3545 !important; }
.dq-loser .dq-bar-fill { background: #dc3545; }
.dq-crown { position: absolute; top: -.8rem; right: -.3rem; font-size: 1.4rem; animation: dq-crown .5s ease-out; }
@keyframes dq-crown { from { transform: translateY(-10px) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }

.dq-slider { padding: .5rem .25rem 0; }
.dq-guess { font-size: 2rem; font-weight: 800; color: #6f42c1; text-align: center; font-variant-numeric: tabular-nums; }
.dq-track { position: relative; padding: 1.8rem 0 1.6rem; }
.dq-track input[type=range] { width: 100%; position: relative; z-index: 2; accent-color: #6f42c1; }
.dq-track-marks { position: absolute; left: 0; right: 0; top: 0; bottom: 0; pointer-events: none; }
.dq-zone { position: absolute; top: 1.55rem; height: 1.3rem; background: rgba(25, 135, 84, .22); border: 1px dashed #198754; border-radius: .3rem; animation: dq-fade .4s ease-out; }
.dq-mark { position: absolute; top: 1.2rem; width: 0; height: 2rem; border-left: 3px solid; transform: translateX(-1px); }
.dq-mark > span { position: absolute; transform: translateX(-50%); white-space: nowrap; font-size: .75rem; font-weight: 700; padding: 0 .3rem; border-radius: .3rem; }
.dq-mark-guess { border-color: #0d6efd; }
.dq-mark-guess > span { top: -1.2rem; color: #0d6efd; }
.dq-mark-truth { border-color: #d63384; transition: left .9s cubic-bezier(.2, .8, .2, 1); }
.dq-mark-truth > span { bottom: -1.3rem; background: #d63384; color: #fff; }
.dq-range-ends { display: flex; justify-content: space-between; font-size: .72rem; color: var(--bs-secondary-color, #6c757d); }
@keyframes dq-fade { from { opacity: 0; } to { opacity: 1; } }

.dq-status { min-height: 1.6rem; margin-top: .75rem; }
.dq-detail { color: var(--bs-body-color); }
.dq-btn-primary { background: #6f42c1; border-color: #6f42c1; color: #fff; }
.dq-btn-primary:hover, .dq-btn-primary:focus { background: #59339d; border-color: #59339d; color: #fff; }

.dq-overlay { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .55rem; padding: 1rem; text-align: center; background: rgba(255, 255, 255, .96); overflow-y: auto; }
.dq-big-icon { font-size: 2.2rem; color: #6f42c1; }
.dq-band-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; width: 100%; max-width: 30rem; }
.dq-band-btn { border: 2px solid rgba(111, 66, 193, .3); background: var(--bs-body-bg, #fff); border-radius: .6rem; padding: .35rem .2rem; display: flex; flex-direction: column; color: inherit; }
.dq-band-btn.active { border-color: #6f42c1; background: rgba(111, 66, 193, .1); }
.dq-band-zh { font-size: 1.05rem; }
.dq-band-en { font-size: .72rem; }
.dq-final-score { font-size: 2.6rem; font-weight: 800; color: #6f42c1; font-variant-numeric: tabular-nums; }
.dq-final-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1rem; font-size: .85rem; }
.dq-missed { text-align: left; font-size: .8rem; margin: 0; padding-left: 1.1rem; max-width: 32rem; }
.dq-best { display: flex; flex-wrap: wrap; justify-content: center; gap: .2rem 1rem; font-size: .78rem; }

.dq-fx { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.dq-particle { position: absolute; width: .5rem; height: .5rem; border-radius: 50%; animation: dq-burst .9s ease-out forwards; }
@keyframes dq-burst { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }
.dq-confetti { position: absolute; top: -1rem; width: .45rem; height: .8rem; border-radius: .1rem; animation: dq-rain 1.8s ease-in forwards; }
@keyframes dq-rain { to { transform: translateY(26rem) rotate(540deg); opacity: 0; } }
.dq-shake { animation: dq-shake .4s ease; }
@keyframes dq-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.dq-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The veil: while a run is live the answers a scroll below are blurred, then lifted at game over. */
.dq-playing [data-dq-veil] { position: relative; pointer-events: none; user-select: none; }
.dq-playing [data-dq-veil] > * { filter: blur(7px); }
.dq-playing [data-dq-veil]::after { content: "🔍 Hidden while you play Data Detective"; position: absolute; top: 1rem; left: 50%; transform: translateX(-50%);
    background: #6f42c1; color: #fff; padding: .25rem .8rem; border-radius: 1rem; font-size: .85rem; white-space: nowrap; z-index: 2; }
/* backwards, never both: a held end frame of blur(0) would beat the veil on the next run. */
.dq-unveiled > * { animation: dq-unveil .9s ease-out backwards; animation-delay: inherit; }
@keyframes dq-unveil { from { filter: blur(7px); } to { filter: blur(0); } }

@media (max-width: 575.98px) {
    .dq-options.dq-quad { grid-template-columns: 1fr 1fr; }
    .dq-option-label.dq-hanzi { font-size: 2rem; }
    .dq-band-picker { grid-template-columns: repeat(2, 1fr); }
    .dq-stage { padding: .75rem; min-height: 24rem; }
}

@media (prefers-reduced-motion: reduce) {
    .dq-pop, .dq-enter, .dq-shake, .dq-crown, .dq-unveiled > *, .dq-zone { animation: none; }
    .dq-bar-fill, .dq-mark-truth, .dq-progress-fill { transition: none; }
}

[data-theme="dark"] .dq-overlay { background: rgba(33, 37, 41, .96); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .dq-overlay { background: rgba(33, 37, 41, .96); }
}
