/* สนามฝึกธรรมศึกษา — visual system (ธีมวัดยามรุ่งอรุณ คราม-ทอง) responsive 320px–desktop */
:root {
	--dq-night: #0b1030;
	--dq-deep: #070b22;
	--dq-indigo: #1d2a6e;
	--dq-ink: #1c2350;
	--dq-slate: #47517e;
	--dq-gold: #e9b95c;
	--dq-gold-deep: #b9821f;
	--dq-gold-light: #ffe6a3;
	--dq-paper: #fffaf0;
	--dq-paper-deep: #f3e8cf;
	--dq-jade: #2e9e63;
	--dq-jade-soft: #e2f6ea;
	--dq-coral: #d95656;
	--dq-coral-soft: #fdebeb;
	--dq-white: #fffdf7;
	--dq-shadow: 0 24px 80px rgba(4, 8, 34, .3);
}

* { box-sizing: border-box; }
[v-cloak] { display: none; }
html { min-width: 320px; background: var(--dq-deep); }
body.dq-body { margin: 0; min-width: 320px; background: var(--dq-deep); color: var(--dq-ink); font-family: "Sarabun", system-ui, sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
.dq-app { min-height: 100vh; font-size: calc(17px * var(--dq-fs, 1)); background: var(--dq-deep); }
.dq-app a { color: inherit; }
.dq-skip { position: fixed; z-index: 1000; left: 1rem; top: -5rem; padding: .75rem 1rem; border-radius: .75rem; background: #fff; color: var(--dq-deep); font-weight: 800; }
.dq-skip:focus { top: 1rem; }
:where(.dq-app button, .dq-app a, .dq-app select):focus-visible { outline: 3px solid #ffd36a; outline-offset: 3px; }
.dq-live { position: fixed; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- system states ---------- */
.dq-system { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: .8rem; padding: 2rem; text-align: center; color: var(--dq-white); background: radial-gradient(circle at 50% 35%, #253a8a, #070b22 72%); }
.dq-system h1, .dq-system p { margin: 0; }
.dq-system p { color: #b9c4ea; }
.dq-system > i { font-size: 3rem; color: #ffb594; }
.dq-lamp-loader { display: grid; place-items: center; width: 5rem; height: 5rem; border-radius: 50%; color: var(--dq-gold); font-size: 2.6rem; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); animation: dqGlow 2s ease-in-out infinite; }
@keyframes dqGlow { 50% { box-shadow: 0 0 44px rgba(233, 185, 92, .55); color: var(--dq-gold-light); } }

/* ---------- topbar ---------- */
.dq-topbar { position: sticky; top: 0; z-index: 50; height: 66px; display: flex; align-items: center; gap: .7rem; padding: 0 clamp(.75rem, 3vw, 2rem); color: #f2f0ff; background: rgba(6, 9, 30, .93); border-bottom: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 8px 28px rgba(0, 0, 0, .18); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.dq-brand { min-width: 0; display: inline-flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; }
.dq-brand-mark { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: #241a05; background: linear-gradient(145deg, #ffe8a5, #d89a38); box-shadow: 0 0 0 3px rgba(255, 220, 137, .16); font-size: 1.15rem; }
.dq-brand strong, .dq-brand small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dq-brand strong { font-size: .95rem; color: #fff8dd; }
.dq-brand small { margin-top: .1rem; color: #a9b4e2; font-size: .68rem; }
.dq-topbar-side { margin-left: auto; display: flex; align-items: center; gap: .45rem; }
.dq-icon-button { flex: none; min-width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: 0 .6rem; border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; color: #fdf6dd; background: rgba(255, 255, 255, .07); text-decoration: none; font-weight: 700; font-size: .85rem; }
.dq-icon-button:hover { background: rgba(255, 255, 255, .15); }
.dq-icon-button.is-off { color: #8b93b8; }
.dq-storage-warning { margin: 0; padding: .65rem 1rem; color: #5c3a00; background: #fff1bd; text-align: center; font-size: .85rem; font-weight: 700; }

/* ---------- scenes ---------- */
.dq-scene { position: relative; isolation: isolate; background-size: cover; background-position: center; }
.dq-scene::before { content: ""; position: absolute; z-index: -1; inset: 0; background: inherit; }

/* ---------- home ---------- */
.dq-home { min-height: calc(100vh - 66px); display: flex; align-items: stretch; color: #fff; overflow: hidden; }
.dq-home-shade { position: absolute; z-index: 0; inset: 0; background: linear-gradient(90deg, rgba(5, 8, 28, .94) 0%, rgba(5, 8, 28, .78) 34%, rgba(5, 8, 28, .18) 66%, rgba(5, 8, 28, .05)), linear-gradient(0deg, rgba(5, 8, 28, .78), transparent 42%); }
.dq-home-grid { position: relative; z-index: 1; width: min(1220px, 100%); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 460px); gap: clamp(1.5rem, 3.5vw, 3.5rem); align-items: center; padding: clamp(2rem, 5vw, 4.5rem) clamp(1rem, 4vw, 3rem); }
.dq-home-copy { animation: dqRise .7s cubic-bezier(.22, .9, .3, 1) both; }
@keyframes dqRise { from { opacity: 0; transform: translateY(18px); } }
.dq-kicker { display: inline-flex; align-items: center; gap: .5rem; max-width: 100%; margin-bottom: .8rem; color: var(--dq-gold-light); font-size: .74rem; font-weight: 800; letter-spacing: .07em; }
.dq-kicker i { font-size: .85rem; }
.dq-home h1 { margin: 0; color: #fffaf0; font-size: clamp(2rem, 4.6vw, 3.9rem); line-height: 1.14; letter-spacing: -.03em; text-shadow: 0 3px 30px rgba(0, 0, 0, .45); }
.dq-home h1 em { color: #ffd776; font-style: normal; }
.dq-home-line { display: block; white-space: nowrap; }
.dq-home-copy > p { max-width: 560px; margin: 1.1rem 0 0; color: #d5dcf2; font-size: clamp(.98rem, 1.5vw, 1.14rem); line-height: 1.8; }
.dq-home-stats { max-width: 560px; display: grid; grid-template-columns: repeat(3, 1fr); margin: 1.6rem 0 0; border: 1px solid rgba(255, 255, 255, .16); border-radius: 1rem; background: rgba(6, 10, 34, .5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); overflow: hidden; }
.dq-home-stats div { padding: .8rem .95rem; border-right: 1px solid rgba(255, 255, 255, .12); }
.dq-home-stats div:last-child { border: 0; }
.dq-home-stats b, .dq-home-stats span { display: block; }
.dq-home-stats b { color: #ffe099; font-size: 1.18rem; }
.dq-home-stats span { margin-top: .1rem; color: #b4bfe6; font-size: .7rem; }
.dq-source-note { max-width: 560px; margin-top: 1rem !important; color: #9aa6d4 !important; font-size: .74rem !important; }
.dq-source-note a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- setup card ---------- */
.dq-setup { position: relative; z-index: 1; padding: clamp(1.1rem, 2vw, 1.6rem); border-radius: 1.4rem; color: var(--dq-ink); background: linear-gradient(180deg, #fffdf6, #f8efdb); box-shadow: var(--dq-shadow), inset 0 1px 0 #fff; border: 1px solid #e4d3ac; animation: dqRise .7s .1s cubic-bezier(.22, .9, .3, 1) both; }
.dq-setup-head { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; }
.dq-setup-head > i { width: 44px; height: 44px; display: grid; place-items: center; flex: none; border-radius: .9rem; color: #24407c; background: linear-gradient(160deg, #dbe7ff, #b9ccf4); font-size: 1.15rem; }
.dq-setup-head h2 { margin: 0; font-size: 1.22rem; line-height: 1.3; }
.dq-setup-head p { margin: .1rem 0 0; color: var(--dq-slate); font-size: .8rem; }
.dq-field { margin-top: .95rem; }
.dq-field > label { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .5rem; font-weight: 800; font-size: .88rem; color: #303a6e; }
.dq-field > label small { font-weight: 600; color: #7681ab; font-size: .72rem; }
.dq-field-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #23306b; color: #ffe9b0; font-size: .72rem; }

.dq-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.dq-seg button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .5rem .5rem; border: 1.5px solid #d9c89f; border-radius: .8rem; background: #fff; color: #4c5687; font-weight: 800; transition: transform .15s ease, box-shadow .15s ease; }
.dq-seg button:hover { transform: translateY(-1px); }
.dq-seg button.is-active { border-color: #23306b; background: linear-gradient(180deg, #2b3a80, #1d2a6e); color: #ffedbc; box-shadow: 0 6px 18px rgba(29, 42, 110, .35); }

.dq-subjects { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.dq-subject { position: relative; min-height: 92px; display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; padding: .6rem .65rem; border: 1.5px solid #d9c89f; border-radius: .9rem; background: #fff; text-align: left; transition: transform .15s ease, box-shadow .15s ease; }
.dq-subject:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(4, 8, 34, .12); }
.dq-subject i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: .65rem; color: #8a6017; background: linear-gradient(160deg, #ffedbc, #f3d189); font-size: .95rem; }
.dq-subject .dq-sub-text { display: flex; flex-direction: column; gap: .15rem; }
.dq-subject b { font-size: .82rem; line-height: 1.25; color: #2c3567; }
.dq-subject small { color: #8590ba; font-size: .66rem; line-height: 1.35; }
.dq-subject.is-active { border-color: #b9821f; background: linear-gradient(180deg, #fff8e2, #ffedbc); box-shadow: 0 10px 24px rgba(185, 130, 31, .25); }
.dq-subject.is-active i { color: #fff; background: linear-gradient(160deg, #e9b95c, #b9821f); }
.dq-subject .dq-due { position: absolute; top: -8px; right: -6px; min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 .3rem; border-radius: 999px; background: var(--dq-coral); color: #fff; font-size: .68rem; font-weight: 800; box-shadow: 0 4px 10px rgba(217, 86, 86, .4); }

.dq-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.dq-chips button { min-height: 44px; padding: .45rem .85rem; border: 1.5px solid #d9c89f; border-radius: 999px; background: #fff; color: #4c5687; font-weight: 800; font-size: .9rem; transition: transform .15s ease; }
.dq-chips button:hover { transform: translateY(-1px); }
.dq-chips button.is-active { border-color: #23306b; background: linear-gradient(180deg, #2b3a80, #1d2a6e); color: #ffedbc; }
.dq-chips button i { margin-right: .3rem; font-size: .8rem; }

.dq-review-note { display: flex; gap: .6rem; align-items: flex-start; margin-top: 1rem; padding: .65rem .8rem; border-radius: .8rem; background: #fff3d6; border: 1px dashed #d9ae55; color: #6b4c0e; font-size: .8rem; line-height: 1.55; }
.dq-review-note i { margin-top: .15rem; color: #b9821f; }
.dq-review-note b { color: #92600c; }

.dq-start { width: 100%; margin-top: 1.1rem; }
.dq-setup-foot { margin: .7rem 0 0; text-align: center; color: #8590ba; font-size: .72rem; }

/* ---------- buttons ---------- */
.dq-btn { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: .55rem; padding: .68rem 1.1rem; border: 1px solid transparent; border-radius: .85rem; text-decoration: none; font-weight: 800; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.dq-btn:hover:not(:disabled) { transform: translateY(-2px); }
.dq-btn:disabled { opacity: .45; }
.dq-btn-lg { min-height: 54px; padding: .85rem 1.3rem; font-size: 1.05rem; }
.dq-btn-primary { color: #241a05; background: linear-gradient(180deg, #ffe39a, #e7b34e); box-shadow: 0 7px 0 #9a6723, 0 14px 28px rgba(0, 0, 0, .18); }
.dq-btn-primary:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 3px 0 #9a6723; }
.dq-btn-ink { color: #fdf7e5; background: #23306b; box-shadow: 0 5px 0 #101a45; }
.dq-btn-ink:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 #101a45; }
.dq-btn-glass { color: #fff8df; border-color: rgba(255, 255, 255, .3); background: rgba(10, 16, 48, .58); }
.dq-btn-paper { color: #2c3567; border-color: #cfbd96; background: #fff9e9; box-shadow: 0 4px 0 #c9b78e; }
.dq-btn-paper:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #c9b78e; }

/* ---------- recent rounds ---------- */
.dq-recent { position: relative; z-index: 1; width: min(1220px, 100%); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 3rem) 2.6rem; }
.dq-recent h2 { margin: 0 0 .7rem; color: #f4edd7; font-size: 1rem; }
.dq-recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem; }
.dq-recent-card { display: flex; align-items: center; gap: .7rem; padding: .65rem .8rem; border-radius: .9rem; border: 1px solid rgba(255, 255, 255, .14); background: rgba(9, 14, 42, .62); color: #dfe5f8; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.dq-recent-card b { display: block; color: #ffe4a1; font-size: .95rem; }
.dq-recent-card small { display: block; margin-top: .1rem; color: #a6b1dc; font-size: .7rem; }
.dq-recent-ring { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; font-size: .74rem; font-weight: 800; color: #fff6da; background: radial-gradient(circle at center, #101a45 58%, transparent 60%), conic-gradient(var(--dq-gold) calc(var(--p) * 1%), rgba(255, 255, 255, .16) 0); }

/* ---------- play ---------- */
.dq-play { min-height: calc(100vh - 66px); padding: clamp(1rem, 3vw, 2.2rem) 1rem 3rem; }
.dq-play-overlay { position: absolute; z-index: 0; inset: 0; background: linear-gradient(rgba(5, 8, 28, .82), rgba(5, 8, 28, .9)); }
.dq-play-wrap { position: relative; z-index: 1; width: min(860px, 100%); margin: 0 auto; }

.dq-hud { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; color: #e8ecfd; }
.dq-hud-step { display: inline-flex; align-items: baseline; gap: .3rem; font-weight: 800; font-size: 1.05rem; color: #ffe4a1; }
.dq-hud-step small { color: #aab5e0; font-weight: 700; font-size: .78rem; }
.dq-hud-tally { margin-left: auto; display: inline-flex; gap: .4rem; }
.dq-hud-tally span { display: inline-flex; align-items: center; gap: .35rem; min-height: 34px; padding: .2rem .7rem; border-radius: 999px; font-weight: 800; font-size: .88rem; border: 1px solid rgba(255, 255, 255, .16); background: rgba(9, 14, 42, .62); }
.dq-hud-tally .is-right { color: #9ff0c0; }
.dq-hud-tally .is-wrong { color: #ffb3b3; }
.dq-progress { height: 10px; margin: .75rem 0 1.2rem; border-radius: 999px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.dq-progress i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffd776, #e7a93e); transition: width .35s ease; }

.dq-qcard { padding: clamp(1.1rem, 3vw, 1.8rem); border-radius: 1.3rem; background: linear-gradient(180deg, #fffdf6, #faf3e2); border: 1px solid #e4d3ac; box-shadow: var(--dq-shadow), inset 0 1px 0 #fff; animation: dqCardIn .3s ease both; }
@keyframes dqCardIn { from { opacity: 0; transform: translateY(10px); } }
.dq-qmeta { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.dq-tag { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 800; color: #45508a; background: #eceffc; border: 1px solid #d4daf4; }
.dq-tag-review { color: #92600c; background: #ffedbc; border-color: #ecd08b; }
.dq-question { margin: 0; font-size: clamp(1.1rem, 2.4vw, 1.35rem); line-height: 1.65; color: #191f45; font-weight: 800; }

.dq-choices { display: grid; gap: .55rem; margin-top: 1.1rem; }
.dq-choice { position: relative; display: flex; align-items: center; gap: .8rem; min-height: 58px; padding: .7rem .85rem; border: 1.5px solid #ddceaa; border-radius: 1rem; background: #fff; text-align: left; font-size: 1.02rem; color: #242b5c; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease; }
.dq-choice:hover:not(:disabled) { transform: translateY(-2px); border-color: #b9a468; box-shadow: 0 10px 22px rgba(4, 8, 34, .1); }
.dq-choice-key { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; color: #4c5687; background: #eef0fa; border: 1px solid #d4daf4; transition: inherit; }
.dq-choice-text { font-weight: 700; line-height: 1.5; }
.dq-choice-mark { margin-left: auto; flex: none; font-size: 1.25rem; opacity: 0; transform: scale(.4); transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), opacity .2s ease; }
.dq-choice.is-correct { border-color: var(--dq-jade); background: var(--dq-jade-soft); color: #14522f; }
.dq-choice.is-correct .dq-choice-key { color: #fff; background: var(--dq-jade); border-color: var(--dq-jade); }
.dq-choice.is-correct .dq-choice-mark { color: var(--dq-jade); opacity: 1; transform: scale(1); }
.dq-choice.is-wrong { border-color: var(--dq-coral); background: var(--dq-coral-soft); color: #7c1f1f; animation: dqShake .4s ease; }
.dq-choice.is-wrong .dq-choice-key { color: #fff; background: var(--dq-coral); border-color: var(--dq-coral); }
.dq-choice.is-wrong .dq-choice-mark { color: var(--dq-coral); opacity: 1; transform: scale(1); }
.dq-choice.is-dim { opacity: .5; }
@keyframes dqShake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.dq-feedback { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-top: 1rem; padding: .8rem .95rem; border-radius: .95rem; font-weight: 800; animation: dqCardIn .25s ease both; }
.dq-feedback.is-right { color: #14522f; background: var(--dq-jade-soft); border: 1px solid #bfe7cf; }
.dq-feedback.is-wrong { color: #7c1f1f; background: var(--dq-coral-soft); border: 1px solid #f2c6c6; }
.dq-feedback i { font-size: 1.2rem; }
.dq-feedback p { margin: 0; flex: 1 1 12rem; font-size: .92rem; line-height: 1.55; }
.dq-feedback p b { display: block; font-size: .98rem; }
.dq-feedback .dq-btn { margin-left: auto; }

/* ---------- result ---------- */
.dq-result { min-height: calc(100vh - 66px); padding: clamp(1.2rem, 3vw, 2.5rem) 1rem 3.5rem; }
.dq-result-wrap { position: relative; z-index: 1; width: min(860px, 100%); margin: 0 auto; }
.dq-result-card { padding: clamp(1.3rem, 3.5vw, 2.2rem); border-radius: 1.4rem; background: linear-gradient(180deg, #fffdf6, #f8efdb); border: 1px solid #e4d3ac; box-shadow: var(--dq-shadow), inset 0 1px 0 #fff; text-align: center; animation: dqCardIn .35s ease both; }
.dq-score-ring { --p: 0; width: 158px; height: 158px; margin: .3rem auto 0; display: grid; place-items: center; align-content: center; gap: .1rem; border-radius: 50%; background: radial-gradient(circle at center, #fffdf6 60%, transparent 61%), conic-gradient(var(--ring, #e7a93e) calc(var(--p) * 1%), #ece2c8 0); }
.dq-score-ring strong { font-size: 2.3rem; line-height: 1; color: #1c2350; }
.dq-score-ring strong::after { content: "%"; font-size: .5em; color: #7681ab; }
.dq-score-ring small { color: #7681ab; font-weight: 700; font-size: .78rem; }
.dq-verdict { display: inline-flex; align-items: center; gap: .5rem; margin-top: 1rem; padding: .45rem 1rem; border-radius: 999px; font-weight: 800; font-size: .95rem; }
.dq-verdict.is-gold { color: #92600c; background: #ffedbc; }
.dq-verdict.is-jade { color: #14522f; background: var(--dq-jade-soft); }
.dq-verdict.is-sky { color: #1d4a75; background: #e2effc; }
.dq-verdict.is-coral { color: #7c1f1f; background: var(--dq-coral-soft); }
.dq-result-sub { margin: .8rem auto 0; max-width: 500px; color: var(--dq-slate); font-size: .88rem; line-height: 1.7; }
.dq-result-sub b { color: #92600c; }
.dq-result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .7rem; margin-top: 1.3rem; }

.dq-wrong-list { margin-top: 1.6rem; }
.dq-wrong-list > h2 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .8rem; color: #f4edd7; font-size: 1.05rem; }
.dq-wrong-list > h2 i { color: #ffb3b3; }
.dq-wrong-item { margin-bottom: .7rem; padding: 1rem 1.1rem; border-radius: 1.1rem; background: rgba(255, 253, 246, .97); border: 1px solid #e4d3ac; box-shadow: 0 10px 30px rgba(4, 8, 34, .22); }
.dq-wrong-item .dq-qmeta { margin-bottom: .45rem; }
.dq-wrong-item h3 { margin: 0; font-size: .98rem; line-height: 1.6; color: #191f45; }
.dq-wrong-answers { display: grid; gap: .35rem; margin-top: .6rem; font-size: .88rem; }
.dq-wrong-answers span { display: flex; align-items: baseline; gap: .5rem; line-height: 1.5; }
.dq-wrong-answers i { flex: none; width: 1rem; text-align: center; transform: translateY(1px); }
.dq-ans-picked { color: #a03030; }
.dq-ans-correct { color: #14713e; font-weight: 800; }

.dq-perfect { margin-top: 1.6rem; padding: 1.1rem; border-radius: 1.1rem; text-align: center; color: #ffedbc; background: rgba(9, 14, 42, .62); border: 1px solid rgba(255, 226, 148, .35); font-weight: 800; }
.dq-perfect i { margin-right: .45rem; color: #ffd776; }

/* ---------- ตั้งค่า (dialog) ---------- */
.dq-settings { border: 0; padding: 0; background: transparent; max-width: min(430px, calc(100vw - 2rem)); width: 100%; }
.dq-settings::backdrop { background: rgba(4, 7, 26, .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dq-settings-panel { padding: 1.15rem 1.15rem 1.25rem; border-radius: 1.4rem; background: linear-gradient(180deg, #fffdf6, #f6ecd6); border: 1px solid #e4d3ac; box-shadow: var(--dq-shadow), inset 0 1px 0 #fff; color: var(--dq-ink); animation: dqCardIn .25s ease both; }
.dq-settings-panel header { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; margin-bottom: .4rem; }
.dq-settings-panel header > div { display: flex; align-items: center; gap: .7rem; }
.dq-settings-mark { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: .9rem; color: #fff; background: linear-gradient(160deg, #2b3a80, #1d2a6e); font-size: 1.05rem; }
.dq-settings-panel h2 { margin: 0; font-size: 1.15rem; }
.dq-settings-panel header p { margin: .1rem 0 0; color: var(--dq-slate); font-size: .78rem; }
.dq-settings-panel header > button { width: 40px; height: 40px; flex: none; border: 1px solid #ddceaa; border-radius: 50%; background: #fff; color: #6a734f; color: var(--dq-slate); font-size: 1rem; }
.dq-settings-panel header > button:hover { background: #f7efdc; }
.dq-settings-panel section { display: flex; align-items: center; justify-content: space-between; gap: .9rem; padding: .85rem 0; border-top: 1px dashed #e0d2ab; }
.dq-setting-info { min-width: 0; }
.dq-setting-info b { display: flex; align-items: center; gap: .5rem; font-size: .92rem; color: #2c3567; }
.dq-setting-info b i { color: #b9821f; width: 1.1rem; text-align: center; }
.dq-setting-info small { display: block; margin-top: .2rem; color: #8590ba; font-size: .72rem; line-height: 1.5; }
.dq-setting-seg { flex: none; display: grid; grid-auto-flow: column; gap: .3rem; }
.dq-setting-seg button { min-width: 52px; min-height: 40px; padding: .3rem .5rem; border: 1.5px solid #d9c89f; border-radius: .7rem; background: #fff; color: #4c5687; font-weight: 800; font-size: .82rem; }
.dq-setting-seg button.is-active { border-color: #23306b; background: linear-gradient(180deg, #2b3a80, #1d2a6e); color: #ffedbc; }
.dq-stepper { flex: none; display: inline-flex; align-items: center; gap: .4rem; }
.dq-stepper button { width: 44px; height: 40px; border: 1.5px solid #d9c89f; border-radius: .7rem; background: #fff; color: #2c3567; font-weight: 800; }
.dq-stepper button:disabled { opacity: .4; }
.dq-stepper output { min-width: 3.4rem; text-align: center; font-weight: 800; color: #2c3567; font-size: .92rem; }
.dq-setting-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-top: .1rem; padding: .85rem .2rem .2rem; border: 0; border-top: 1px dashed #e0d2ab; background: none; }
.dq-setting-toggle span { display: inline-flex; align-items: center; gap: .5rem; font-size: .92rem; color: #2c3567; font-weight: 800; }
.dq-setting-toggle span i { color: #b9821f; width: 1.1rem; text-align: center; }
.dq-setting-toggle em { font-style: normal; min-width: 58px; text-align: center; padding: .35rem .7rem; border-radius: 999px; font-weight: 800; font-size: .8rem; color: #8590ba; background: #eef0fa; border: 1px solid #d4daf4; }
.dq-setting-toggle em.is-on { color: #14522f; background: var(--dq-jade-soft); border-color: #bfe7cf; }

/* ---------- ปุ่มถัดไปแบบนับถอยหลัง ---------- */
.dq-btn-count { position: relative; overflow: hidden; }
.dq-count-fill { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255, 255, 255, .28); transition: width .1s linear; pointer-events: none; }
.dq-btn-ink .dq-count-fill { background: rgba(255, 255, 255, .16); }
.dq-count-text { position: relative; }

/* ---------- ปุ่มเล่นเฉพาะข้อผิด ---------- */
.dq-review-only { display: inline-flex; align-items: center; gap: .45rem; margin-top: .55rem; min-height: 42px; padding: .45rem .9rem; border: 0; border-radius: .75rem; background: #92600c; color: #fff6da; font-weight: 800; font-size: .84rem; box-shadow: 0 4px 0 #5e3d05; transition: transform .15s ease; }
.dq-review-only:hover:not(:disabled) { transform: translateY(-1px); }
.dq-review-only:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #5e3d05; }
.dq-hud-mode { display: inline-flex; align-items: center; gap: .4rem; min-height: 34px; padding: .2rem .75rem; border-radius: 999px; font-weight: 800; font-size: .82rem; color: #ffe4a1; background: rgba(146, 96, 12, .45); border: 1px solid rgba(255, 226, 148, .4); }

/* ---------- หน้ารายงาน ---------- */
.dq-stats-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.dq-stats-head h1 { margin: 0; color: #fff9e7; font-size: clamp(1.3rem, 3vw, 1.8rem); text-shadow: 0 2px 18px rgba(0, 0, 0, .4); }
.dq-stats-head h1 i { color: #ffd776; margin-right: .35rem; }
.dq-stats-link { margin-left: auto; display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; padding: .35rem .85rem; border: 1px solid rgba(255, 255, 255, .25); border-radius: 999px; background: rgba(9, 14, 42, .62); color: #ffe4a1; font-weight: 800; font-size: .8rem; }
.dq-stats-link:hover { background: rgba(9, 14, 42, .85); }
.dq-recent h2 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.dq-icon-label { font-size: .8rem; }
.dq-icon-button.is-active { background: rgba(255, 226, 148, .22); color: #ffe4a1; border-color: rgba(255, 226, 148, .4); }

.dq-stats-filter { margin-bottom: 1rem; }
.dq-stats-filter button { border-color: rgba(255, 255, 255, .28); background: rgba(9, 14, 42, .62); color: #dfe5f8; }
.dq-stats-filter button.is-active { border-color: #ffd776; background: linear-gradient(180deg, #ffe39a, #e7b34e); color: #241a05; }

.dq-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; margin-bottom: 1rem; }
.dq-tile { padding: .8rem .9rem; border-radius: 1rem; background: rgba(255, 253, 246, .97); border: 1px solid #e4d3ac; box-shadow: 0 10px 30px rgba(4, 8, 34, .22); }
.dq-tile b { display: block; font-size: 1.45rem; line-height: 1.2; color: #1c2350; }
.dq-tile b small { font-size: .6em; color: #7681ab; }
.dq-tile span { display: block; margin-top: .15rem; color: #7681ab; font-size: .7rem; font-weight: 700; }
.dq-tile.is-hero { background: linear-gradient(180deg, #2b3a80, #1d2a6e); border-color: #3d4c9a; }
.dq-tile.is-hero b { color: #ffe4a1; }
.dq-tile.is-hero span { color: #aab5e0; }
.dq-tile.is-due b { color: #a03030; }

.dq-panel { margin-bottom: 1rem; padding: 1.1rem 1.2rem 1.2rem; border-radius: 1.2rem; background: rgba(255, 253, 246, .97); border: 1px solid #e4d3ac; box-shadow: 0 10px 30px rgba(4, 8, 34, .22); }
.dq-panel h2 { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin: 0 0 .85rem; font-size: 1rem; color: #1c2350; }
.dq-panel h2 i { color: #b9821f; }
.dq-panel h2 small { font-weight: 600; color: #8590ba; font-size: .72rem; }
.dq-panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.dq-panel-grid .dq-panel { margin-bottom: 1rem; }

.dq-bars { display: grid; gap: .55rem; }
.dq-bar-row { display: grid; grid-template-columns: minmax(110px, 172px) 1fr minmax(96px, auto); align-items: center; gap: .7rem; }
.dq-bar-label { font-weight: 800; font-size: .85rem; color: #2c3567; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dq-bar-label i { width: 1.1rem; text-align: center; color: #b9821f; margin-right: .2rem; }
.dq-bar-track { position: relative; height: 18px; border-radius: 999px; background: #ece2c8; overflow: hidden; }
.dq-bar-track i { position: absolute; left: 0; top: 0; bottom: 0; min-width: 4px; border-radius: 999px; background: linear-gradient(90deg, #3446a8, #23306b); transition: width .5s cubic-bezier(.22, .9, .3, 1); }
.dq-bar-row:hover .dq-bar-track i { background: linear-gradient(90deg, #4356c4, #2b3a80); }
.dq-bar-target { position: absolute; top: -2px; bottom: -2px; left: 70%; width: 0; border-left: 2px dashed #b9821f; opacity: .65; }
.dq-bar-val { font-weight: 800; font-size: .88rem; color: #1c2350; text-align: right; white-space: nowrap; }
.dq-bar-val small { font-weight: 600; color: #8590ba; font-size: .78em; }

.dq-line-chart { display: block; width: 100%; height: auto; }
.dq-grid line { stroke: #e7dcbd; stroke-width: 1; }
.dq-grid text { fill: #8590ba; font-size: 11px; font-weight: 700; text-anchor: end; }
.dq-line-target { stroke: #b9821f; stroke-width: 1.5; stroke-dasharray: 5 5; opacity: .55; }
.dq-line-path { fill: none; stroke: #b9821f; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.dq-line-dot { fill: #fffdf6; stroke: #b9821f; stroke-width: 2.5; cursor: default; }
.dq-line-dot:hover { fill: #ffe4a1; r: 7; }
.dq-chart-foot { display: flex; justify-content: space-between; gap: .8rem; margin: .4rem .2rem 0; color: #8590ba; font-size: .72rem; font-weight: 700; }

.dq-table-wrap { overflow-x: auto; }
.dq-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.dq-table th { text-align: left; padding: .4rem .6rem; color: #8590ba; font-size: .72rem; border-bottom: 1.5px solid #e0d2ab; white-space: nowrap; }
.dq-table td { padding: .5rem .6rem; border-bottom: 1px dashed #ece2c8; color: #2c3567; white-space: nowrap; }
.dq-table td.is-pass { color: #14713e; font-weight: 800; }
.dq-table td.is-miss { color: #a03030; font-weight: 800; }

.dq-stats-empty { text-align: center; padding: 2.5rem 1.5rem; }
.dq-stats-empty i { font-size: 2.4rem; color: #2e9e63; }
.dq-stats-empty h2 { justify-content: center; margin-top: .8rem; }
.dq-stats-empty p { max-width: 420px; margin: .4rem auto 1.2rem; color: var(--dq-slate); font-size: .9rem; line-height: 1.7; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
	.dq-home-grid { grid-template-columns: 1fr; align-items: start; }
	.dq-home { align-items: flex-start; }
	.dq-brand small { display: none; }
	.dq-tiles { grid-template-columns: repeat(3, 1fr); }
	.dq-panel-grid { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 560px) {
	.dq-app { font-size: calc(16px * var(--dq-fs, 1)); }
	.dq-subjects { grid-template-columns: 1fr; }
	.dq-subject { flex-direction: row; align-items: center; min-height: 60px; gap: .65rem; }
	.dq-subject .dq-sub-text { display: flex; flex-direction: column; gap: .1rem; }
	.dq-home-stats { grid-template-columns: 1fr 1fr 1fr; }
	.dq-home-stats div { padding: .6rem .6rem; }
	.dq-hud-tally { margin-left: 0; }
	.dq-feedback .dq-btn { margin-left: 0; width: 100%; }
	.dq-result-actions .dq-btn { width: 100%; }
	.dq-icon-label { display: none; }
	.dq-tiles { grid-template-columns: repeat(2, 1fr); }
	.dq-tile.is-hero { grid-column: span 2; }
	.dq-bar-row { grid-template-columns: 1fr; gap: .25rem; }
	.dq-bar-val { text-align: left; }
	.dq-stats-link { margin-left: 0; }
	.dq-settings-panel section { flex-direction: column; align-items: stretch; }
	.dq-setting-seg { grid-auto-flow: row; grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
	.dq-app *, .dq-app *::before, .dq-app *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
