/* Đảo Kỳ Thủ — “Khởi động 5 phút”. Xem js/classroom-warmups.js */
.dkw-overlay{
  --ink:#143A52;--ink-2:#2A5A73;--sea:#1C7C8C;--sea-d:#14606D;--shallow:#E3F3F1;--cloud:#F7FBFC;--line:#CFE3E0;
  --sun:#FFC23D;--sun-d:#C98A00;--leaf:#2F9E62;--leaf-t:#1F7A46;--berry:#D8465F;--berry-t:#B4304A;--sand:#F2E3C0;--moss:#86B8AA;--muted:#4F6E7E;
  position:fixed;inset:0;z-index:2147483000;display:grid;place-items:center;padding:16px;
  background:rgba(14,44,62,.74);font-family:"Baloo 2","Nunito","Segoe UI",system-ui,sans-serif;color:var(--ink);
}
.dkw-overlay[hidden]{display:none}
html.dkw-lock{overflow:hidden}
.dkw{width:min(1100px,100%);height:min(94vh,860px);display:flex;flex-direction:column;background:var(--cloud);border-radius:26px;overflow:hidden;box-shadow:0 30px 80px rgba(6,26,40,.38)}
.dkw button{font-family:inherit;color:inherit}
.dkw :focus-visible{outline:3px solid var(--sun);outline-offset:2px}

/* ---------- dải đầu + đường tàu ---------- */
.dkw-top{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:20px;padding:12px 14px 12px 24px;background:var(--ink);color:#fff}
.dkw-brand h2{margin:0;font-size:24px;font-weight:800;line-height:1.1;color:#fff}
.dkw-brand p{margin:2px 0 0;font-size:14px;font-weight:500;color:#A9CAD6}
.dkw-route{list-style:none;margin:0;padding:0;display:flex;justify-content:center;gap:0;position:relative;min-height:58px}
.dkw-stop{position:relative;flex:0 1 120px;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:13px;font-weight:600;color:#A9CAD6}
.dkw-stop+.dkw-stop::before{content:"";position:absolute;top:15px;right:calc(50% + 20px);width:calc(100% - 40px);border-top:3px dotted #4C7E95}
.dkw-stop.is-done+.dkw-stop::before{border-top-color:var(--sun)}
.dkw-isle{width:34px;height:30px;display:grid;place-items:center;background:var(--ink-2);border-radius:52% 48% 44% 56%/62% 58% 42% 38%;color:var(--ink)}
.dkw-isle svg{width:26px;height:20px}
.dkw-stop.is-now{color:#fff}
.dkw-stop.is-now .dkw-isle{background:var(--sun);box-shadow:0 0 0 4px rgba(255,194,61,.25)}
.dkw-stop.is-done .dkw-isle{background:var(--leaf)}
.dkw-stop-stars{display:flex;gap:1px}
.dkw-stop-stars i{width:13px;height:13px;display:block}
.dkw-stop-stars svg,.dkw-stars svg{width:100%;height:100%;fill:#3E6B80}
.dkw-stop-stars i.on svg{fill:var(--sun)}
.dkw-tools{display:flex;gap:8px}
.dkw-icon{width:42px;height:42px;display:grid;place-items:center;border:0;border-radius:50%;background:rgba(255,255,255,.1);cursor:pointer}
.dkw-icon:hover{background:rgba(255,255,255,.2)}
.dkw-icon svg{width:22px;height:22px;color:#fff}

/* ---------- vùng chính ---------- */
.dkw-main{flex:1;min-height:0;overflow:auto;padding:22px 26px}
.dkw-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:10px 20px;border-top:1px solid var(--line);font-size:14px;font-weight:600;color:var(--muted)}
.dkw-sync{display:inline-flex;align-items:center;gap:8px}
.dkw-sync::before{content:"";width:9px;height:9px;border-radius:50%;background:#9DB5BE}
.dkw-sync.is-on::before{background:var(--leaf)}
.dkw-row{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.dkw-muted{color:var(--muted);font-size:15px;line-height:1.45;margin:0}
.dkw-btn{min-height:48px;padding:0 20px;border:2px solid var(--line);border-radius:14px;background:#fff;font-size:17px;font-weight:700;cursor:pointer;transition:transform .08s}
.dkw-btn:hover:not(:disabled){border-color:#9FC7C2}
.dkw-btn.is-primary{background:var(--sea);border-color:var(--sea-d);color:#fff;box-shadow:0 4px 0 var(--sea-d)}
.dkw-btn.is-primary:hover:not(:disabled){background:#1A8798;border-color:var(--sea-d)}
.dkw-btn:active:not(:disabled){transform:translateY(2px)}
.dkw-btn.is-primary:active:not(:disabled){box-shadow:0 2px 0 var(--sea-d)}
.dkw-btn:disabled{opacity:.45;cursor:not-allowed}
.dkw-btn.is-small{min-height:38px;padding:0 14px;font-size:15px}

/* ---------- màn chơi ---------- */
.dkw-play{display:grid;grid-template-columns:minmax(0,min(560px,calc(94vh - 210px))) minmax(280px,1fr);gap:30px;align-items:start;justify-content:center}
.dkw-boardwrap{width:100%}
.dkw-board{display:grid;grid-template-columns:repeat(8,1fr);grid-template-rows:repeat(8,1fr);aspect-ratio:1;border-radius:14px;overflow:hidden;box-shadow:0 0 0 6px #fff,0 0 0 8px var(--line)}
.dkw-sq{position:relative;display:grid;place-items:center;min-width:0;min-height:0;border:0;padding:0;margin:0;cursor:default;-webkit-tap-highlight-color:transparent}
.dkw-sq.is-light{background:var(--sand)}
.dkw-sq.is-dark{background:var(--moss)}
.dkw-sq img{width:86%;height:86%;object-fit:contain;pointer-events:none;user-select:none;-webkit-user-drag:none;position:relative;z-index:1}
.dkw-board.is-live .dkw-sq{cursor:pointer}
.dkw-board.is-live .dkw-sq:hover{box-shadow:inset 0 0 0 3px rgba(20,58,82,.35)}
.dkw-sq:focus-visible{outline:3px solid var(--ink);outline-offset:-3px;z-index:3}
.dkw-sq.is-hero{background:#FFD978}
.dkw-sq.is-sel{background:var(--sun);box-shadow:inset 0 0 0 3px var(--sun-d)}
.dkw-sq.is-trail{background:#FBE6A6}
.dkw-sq.is-good{background:#93D8B1;box-shadow:inset 0 0 0 4px var(--leaf)}
.dkw-sq.is-bad{background:#F4A9B6;box-shadow:inset 0 0 0 4px var(--berry)}
.dkw-sq.is-miss{background:#FFE08A;box-shadow:inset 0 0 0 4px var(--sun-d)}
.dkw-sq.is-check{background:radial-gradient(circle,#F6B3BF 0 55%,#EE8C9D 100%)}
.dkw-sq.has-dot::after{content:"";position:absolute;width:28%;height:28%;border-radius:50%;background:rgba(20,58,82,.3);z-index:2}
.dkw-sq.has-dot:has(img)::after{width:84%;height:84%;background:none;box-shadow:inset 0 0 0 4px rgba(20,58,82,.32)}
.dkw-star{position:absolute;inset:16%;z-index:1}
.dkw-star svg{width:100%;height:100%;fill:var(--sun);stroke:var(--sun-d);stroke-width:1.2}
.dkw-cf,.dkw-cr{position:absolute;font-size:12px;font-weight:700;line-height:1;color:rgba(20,58,82,.62);z-index:2}
.dkw-cf{right:4px;bottom:3px}
.dkw-cr{left:4px;top:4px}
.dkw-play.is-paused .dkw-board{filter:grayscale(.7) opacity(.55)}

.dkw-side{display:flex;flex-direction:column;gap:14px;min-width:0}
.dkw-buoy{position:relative;display:flex;flex-direction:column;align-items:center;gap:2px;padding:16px 16px 12px;border-radius:22px;text-align:center;
  background:var(--sun);box-shadow:0 0 0 3px #fff,0 0 0 5px #E3AE3A,inset 0 -6px 0 rgba(120,80,0,.12);margin:5px}
.dkw-buoy-big{display:inline-flex;align-items:center;gap:8px;font-size:clamp(50px,6.6vw,78px);font-weight:800;line-height:1;font-variant-numeric:tabular-nums;color:var(--ink)}
.dkw-buoy.is-long .dkw-buoy-big{font-size:clamp(36px,4.4vw,50px)}
.dkw-buoy.is-arrows .dkw-buoy-big{font-size:clamp(32px,3.8vw,48px);letter-spacing:.02em;white-space:nowrap;font-family:"Segoe UI Symbol","Baloo 2",system-ui,sans-serif}
.dkw-buoy-star{width:.62em;height:.62em;display:block}
.dkw-buoy-star svg{width:100%;height:100%;fill:#fff;stroke:var(--sun-d);stroke-width:1.4}
.dkw-buoy-sub{font-size:16px;font-weight:600;color:#5A4300}
.dkw-rule{margin:0;font-size:17px;line-height:1.45;font-weight:500;max-width:42ch}
.dkw-legend{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:6px}
.dkw-legend li{display:inline-flex;align-items:center;gap:2px;padding:2px 10px 2px 4px;border-radius:99px;background:var(--shallow);font-size:14px;font-weight:600}
.dkw-legend img{width:26px;height:26px}
.dkw-legend b{font-weight:800;margin-left:3px}
.dkw-choices{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.dkw-choice{min-height:56px;padding:6px 10px;border:2px solid var(--line);border-radius:14px;background:#fff;font-size:18px;font-weight:700;cursor:pointer}
.dkw-choice:hover:not(:disabled){border-color:var(--sea)}
.dkw-choice:disabled{cursor:default}
.dkw-choice.is-good{background:#DDF4E7;border-color:var(--leaf);color:var(--leaf-t)}
.dkw-choice.is-bad{background:#FCE3E8;border-color:var(--berry);color:var(--berry-t)}
.dkw-tray{display:flex;flex-wrap:wrap;gap:8px;padding:10px;border-radius:16px;background:var(--shallow)}
.dkw-tray-p{position:relative;width:58px;height:58px;display:grid;place-items:center;border:2px solid var(--line);border-radius:14px;background:#fff;cursor:pointer}
.dkw-tray-p img{width:44px;height:44px}
.dkw-tray-p.is-on{border-color:var(--sun-d);background:#FFF1C9;box-shadow:0 0 0 3px var(--sun)}
.dkw-tray-p b{position:absolute;right:-6px;top:-6px;min-width:22px;height:22px;border-radius:11px;background:var(--ink);color:#fff;font-size:13px;line-height:22px}
.dkw-stats{display:flex;align-items:center;gap:22px;flex-wrap:wrap}
.dkw-clock,.dkw-score{display:inline-flex;align-items:center;gap:6px}
.dkw-clock svg{width:24px;height:24px;color:var(--sea)}
.dkw-score svg{width:24px;height:24px;fill:var(--sun);stroke:var(--sun-d);stroke-width:1.2}
.dkw-stats b{font-size:28px;font-weight:800;line-height:1;font-variant-numeric:tabular-nums}
.dkw-score small{font-size:14px;font-weight:600;color:var(--muted)}
.dkw-clock.is-low b,.dkw-clock.is-low svg{color:var(--berry-t)}
.dkw-energy{position:relative;display:grid;gap:4px}
.dkw-energy i{position:relative;display:block;height:16px;border-radius:99px;background:#D4E9E6;overflow:hidden}
.dkw-energy i::after{content:"";position:absolute;inset:0 auto 0 0;width:calc(var(--fill) * 100%);border-radius:inherit;background:var(--sun);transition:width .35s ease}
.dkw-energy span{font-size:13px;font-weight:600;color:var(--muted)}
.dkw-energy em{position:absolute;right:0;top:-30px;font-style:normal;font-size:22px;font-weight:800;color:var(--sea-d);opacity:0;pointer-events:none}
.dkw-energy.is-burst i{animation:dkw-flash .9s ease}
.dkw-energy.is-burst em{animation:dkw-rise 1.3s ease}
@keyframes dkw-flash{0%{background:var(--sun);box-shadow:0 0 0 0 rgba(255,194,61,.7)}60%{box-shadow:0 0 0 10px rgba(255,194,61,0)}100%{background:#D4E9E6}}
@keyframes dkw-rise{0%{opacity:0;transform:translateY(10px)}20%{opacity:1}80%{opacity:1;transform:translateY(-8px)}100%{opacity:0;transform:translateY(-14px)}}
.dkw-acts .dkw-btn{flex:1 1 auto}
.dkw-fb{margin:0;min-height:2.9em;font-size:17px;font-weight:700;line-height:1.4}
.dkw-fb.is-ok{color:var(--leaf-t)}
.dkw-fb.is-no{color:var(--berry-t)}
.dkw-nudge{margin:-8px 0 0;min-height:1.4em;font-size:15px;font-weight:600;color:#7A5900}
.dkw-paused{margin:0;padding:8px 12px;border-radius:12px;background:var(--ink);color:#fff;font-weight:700;text-align:center}

/* ---------- thẻ: giới thiệu, xong chặng, tổng kết, chờ ---------- */
.dkw-card{max-width:640px;margin:4vh auto;text-align:center;display:flex;flex-direction:column;align-items:center;gap:10px}
.dkw-card h3{margin:0;font-size:clamp(28px,4vw,38px);font-weight:800;line-height:1.15}
.dkw-stage-no{margin:0;font-size:16px;font-weight:700;color:var(--sea)}
.dkw-skill{margin:0;font-size:16px;color:var(--muted)}
.dkw-intro-rule{margin:4px 0 6px;font-size:21px;line-height:1.4;font-weight:600;max-width:34ch}
.dkw-count{width:96px;height:96px;display:grid;place-items:center;border-radius:50%;border:6px solid var(--sun);font-size:48px;font-weight:800;font-variant-numeric:tabular-nums;margin:6px 0 10px}
.dkw-stars{display:inline-flex;gap:2px;vertical-align:middle}
.dkw-stars i{display:block;width:22px;height:22px}
.dkw-stars svg{fill:#D3E2E0}
.dkw-stars i.on svg{fill:var(--sun);stroke:var(--sun-d);stroke-width:1.2}
.dkw-stars.is-big{gap:8px;margin:6px 0}
.dkw-stars.is-big i{width:58px;height:58px}
.dkw-stars.is-big i.on{animation:dkw-pop .5s cubic-bezier(.3,1.6,.5,1) both;animation-delay:calc(var(--d) * .22s + .15s)}
@keyframes dkw-pop{0%{transform:scale(0) rotate(-30deg)}100%{transform:scale(1) rotate(0)}}
.dkw-big-line{margin:0;font-size:22px;font-weight:700}
.dkw-record{display:inline-block;margin:0;padding:1px 12px;border-radius:99px;background:var(--sun);color:var(--ink);font-size:15px;font-weight:800;font-style:normal}
.dkw-total{display:inline-flex;align-items:center;gap:8px;margin:0;font-size:22px;font-weight:700}
.dkw-total svg{width:40px;height:40px;fill:var(--sun);stroke:var(--sun-d)}
.dkw-total b{font-size:44px;font-weight:800}
.dkw-table{width:100%;border-collapse:collapse;margin:6px 0 10px;text-align:left;font-size:17px}
.dkw-table th,.dkw-table td{padding:10px 8px;border-bottom:1px solid var(--line)}
.dkw-table thead th{font-size:14px;color:var(--muted);font-weight:700}
.dkw-table tbody th{font-weight:700}
.dkw-table td{font-weight:700;font-variant-numeric:tabular-nums}
.dkw-card .dkw-row{justify-content:center;margin-top:6px}

/* ---------- màn chọn ---------- */
.dkw-pick.is-readonly button:disabled{opacity:1;cursor:default}
.dkw-pick.is-readonly .dkw-pick-single summary{cursor:default}
.dkw-ro-note{display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:12px;background:var(--shallow);color:var(--ink);font-weight:600}
.dkw-pick{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,.9fr);gap:28px;align-items:start}
.dkw-pick-chain{display:flex;flex-direction:column;gap:14px}
.dkw-pick-chain h3{margin:0;font-size:28px;font-weight:800;line-height:1.1}
.dkw-levels{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.dkw-level{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:10px 14px;border:2px solid var(--line);border-radius:16px;background:#fff;text-align:left;cursor:pointer}
.dkw-level b{font-size:21px;font-weight:800;line-height:1.1}
.dkw-level span{font-size:13.5px;font-weight:500;color:var(--muted);line-height:1.3}
.dkw-level.is-on{border-color:var(--sea);background:var(--shallow);box-shadow:inset 0 0 0 2px var(--sea)}
.dkw-plan{list-style:none;margin:0;padding:0;counter-reset:dkw;display:flex;flex-direction:column}
.dkw-plan li{position:relative;counter-increment:dkw;display:grid;grid-template-columns:1fr auto;column-gap:12px;padding:10px 0 10px 48px}
.dkw-plan li::before{content:counter(dkw);position:absolute;left:0;top:10px;width:32px;height:32px;display:grid;place-items:center;border-radius:50%;background:var(--sea);color:#fff;font-weight:800;font-size:16px}
.dkw-plan li+li::after{content:"";position:absolute;left:15px;top:-12px;height:22px;border-left:3px dotted #9CC4C0}
.dkw-plan b{font-size:18px;font-weight:700;line-height:1.2}
.dkw-plan span{grid-column:1;font-size:14.5px;color:var(--muted)}
.dkw-plan em{grid-column:2;grid-row:1/3;align-self:center;font-style:normal;font-weight:700;font-size:15px;color:var(--sea-d);font-variant-numeric:tabular-nums}
.dkw-tally{display:flex;align-items:center;gap:6px}
.dkw-tally svg{width:20px;height:20px;fill:var(--sun);stroke:var(--sun-d)}
.dkw-pick-single{border-radius:18px;background:var(--shallow);padding:6px 6px 8px}
.dkw-pick-single summary{padding:10px 12px;font-size:18px;font-weight:700;cursor:pointer;border-radius:12px}
.dkw-pick-single ul{list-style:none;margin:0;padding:0 4px}
.dkw-pick-single li+li{border-top:1px solid var(--line)}
.dkw-pick-single li button{width:100%;display:flex;flex-direction:column;align-items:flex-start;gap:0;padding:9px 10px;border:0;border-radius:10px;background:none;text-align:left;cursor:pointer}
.dkw-pick-single li button:hover{background:#fff}
.dkw-pick-single li b{font-size:17px;font-weight:700}
.dkw-pick-single li span{font-size:14px;color:var(--muted)}

/* ---------- điện thoại / màn hẹp ---------- */
@media (max-width:820px){
  .dkw-overlay{padding:0;place-items:stretch}
  .dkw{width:100%;height:100%;max-height:none;border-radius:0}
  .dkw-top{grid-template-columns:1fr auto;gap:6px 10px;padding:8px 8px 8px 14px}
  .dkw-brand h2{font-size:19px}
  .dkw-brand p{display:none}
  .dkw-route{grid-column:1/-1;grid-row:2;min-height:44px}
  .dkw-stop-name{display:none}
  .dkw-stop.is-now .dkw-stop-name{display:block;position:absolute;top:31px;white-space:nowrap}
  .dkw-stop-stars{display:none}
  .dkw-tools{grid-column:2;grid-row:1}
  .dkw-icon{width:38px;height:38px}
  .dkw-main{padding:12px}
  .dkw-play{display:flex;flex-direction:column;align-items:stretch;gap:10px}
  .dkw-side{display:contents}
  .dkw-side>*{order:3}
  .dkw-buoy{order:0;flex-direction:row;justify-content:center;gap:12px;padding:8px 14px 6px;border-radius:16px;margin:4px}
  .dkw-buoy-big{font-size:40px}
  .dkw-buoy.is-long .dkw-buoy-big{font-size:28px}
  .dkw-buoy.is-arrows .dkw-buoy-big{font-size:34px}
  .dkw-buoy-sub{font-size:14px;text-align:left}
  .dkw-rule{order:1;font-size:15px}
  .dkw-boardwrap{order:2;width:min(100%,max(230px,calc(100dvh - 360px)));align-self:center;flex:none}
  .has-acts .dkw-boardwrap{width:min(100%,max(230px,calc(100dvh - 420px)))}
  .has-many .dkw-boardwrap{width:min(100%,max(200px,calc(100dvh - 580px)))}
  .dkw-legend{gap:4px}
  .dkw-legend li{font-size:12px;padding:1px 7px 1px 2px}
  .dkw-legend img{width:20px;height:20px}
  .dkw-board{box-shadow:0 0 0 4px #fff,0 0 0 5px var(--line);border-radius:10px}
  .dkw-cf,.dkw-cr{font-size:10px}
  .dkw-buoy{align-self:stretch}
  .dkw-legend,.dkw-choices,.dkw-tray,.dkw-acts{order:3}
  .dkw-fb{order:4;min-height:2.6em;font-size:16px}
  .dkw-nudge{order:5;margin:-6px 0 0}
  .dkw-stats,.dkw-energy,.dkw-paused{order:6}
  .dkw-energy span{display:none}
  .dkw-energy em{top:-28px}
  .dkw-choice{min-height:50px;font-size:17px}
  .dkw-stats{gap:16px}
  .dkw-stats b{font-size:24px}
  .dkw-pick{grid-template-columns:1fr;gap:18px}
  .dkw-pick-chain h3{font-size:23px}
  .dkw-level{padding:8px 10px}
  .dkw-level b{font-size:18px}
  .dkw-level span{font-size:12px}
  .dkw-foot{padding:6px 10px;gap:6px;flex-wrap:nowrap}
  .dkw-foot .dkw-sync{font-size:12px;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
  .dkw-foot .dkw-row{flex-wrap:nowrap;gap:6px;margin-left:auto}
  .dkw-foot .dkw-btn.is-small{min-height:36px;padding:0 10px;font-size:14px;white-space:nowrap}
  .dkw-foot:has(.dkw-ctl) .dkw-sync{display:none}
  .dkw-card{margin:2vh auto}
  .dkw-intro-rule{font-size:18px}
}
@media (max-width:820px) and (max-height:720px){
  .dkw-rule,.dkw-energy span{display:none}
  .dkw-route{min-height:36px}
  .dkw-isle{width:26px;height:22px}
  .dkw-stop.is-now .dkw-stop-name{display:none}
  .dkw-stop+.dkw-stop::before{top:10px}
  .dkw-fb{min-height:2.2em;font-size:15px}
  .dkw-boardwrap{width:min(100%,max(200px,calc(100dvh - 350px)))}
  .has-acts .dkw-boardwrap{width:min(100%,max(190px,calc(100dvh - 400px)))}
  .has-many .dkw-boardwrap{width:min(100%,max(180px,calc(100dvh - 470px)))}
}
@media (prefers-reduced-motion:reduce){
  .dkw *{animation:none!important;transition:none!important}
  .dkw-energy.is-burst em{opacity:1}
}
