/* ===== Samio.fun — minigame từ vựng ===== */
:root{--yhw-primary:#3B82F6;--yhw-secondary:#F97316;--yhw-accent:#22C55E;--yhw-bg-soft:#F3F4FF;--yhw-text:#0F172A}
body{margin:0;background:var(--yhw-bg-soft);color:var(--yhw-text)}

/* Header (xanh #3B82F6 như bản gốc) */
.yh-game-header{display:flex;align-items:center;gap:16px;height:64px;padding:0 24px;background:var(--yhw-primary);color:#fff;box-shadow:0 4px 12px rgba(15,23,42,.25);position:sticky;top:0;z-index:20}
.yh-game-logo{display:inline-flex;align-items:center;background:#fff;padding:5px 10px;border-radius:10px;box-shadow:0 2px 6px rgba(15,23,42,.18)}
.yh-game-logo img{height:30px;display:block}
.yh-game-title{font-weight:700;font-size:17px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.yh-game-progress{margin-left:auto;display:flex;align-items:center;gap:8px;font-size:13px;color:#e0f2ff}
.yh-bar{width:170px;height:9px;background:rgba(255,255,255,.35);border-radius:999px;overflow:hidden}
.yh-bar-fill{height:100%;width:0;background:#fff;transition:width .35s}
.yh-game-score{font-weight:700;color:#fff;background:rgba(255,255,255,.18);padding:4px 12px;border-radius:999px}
.yh-game-close{color:#fff;font-size:18px;text-decoration:none;width:34px;height:34px;border-radius:999px;background:rgba(255,255,255,.18);display:grid;place-items:center}
.yh-game-close:hover{background:rgba(255,255,255,.32)}

.yh-game-main{max-width:960px;margin:0 auto;padding:22px 16px 70px}
/* Thẻ trắng bao quanh khu chơi */
#yhStage{background:#fff;border-radius:16px;box-shadow:0 8px 24px rgba(15,35,95,.08);padding:24px 22px;min-height:300px}
.yh-game-actions{display:flex;justify-content:center;gap:12px;margin-top:20px;flex-wrap:wrap}

/* Prompt */
.yh-prompt{text-align:center;border-radius:12px;background:#f7f9ff;padding:18px 12px;margin-bottom:18px;display:flex;flex-direction:column;align-items:center;gap:8px;min-height:80px;justify-content:center}
.yh-prompt .word{font-size:34px;font-weight:700;color:var(--yhw-text)}
.yh-prompt .mean{font-size:30px;font-weight:700;color:var(--yhw-text)}
.yh-prompt .ph{color:rgba(0,0,0,.45);font-size:15px}
.yh-prompt img.cue{max-height:220px;border-radius:12px;object-fit:contain}

/* Nút loa (gradient vàng + sóng) */
.yh-sound{border:none;cursor:pointer;width:72px;height:72px;border-radius:999px;background:radial-gradient(circle at 30% 30%,#ffd666,#fa8c16);display:inline-flex;align-items:center;justify-content:center;position:relative;box-shadow:0 8px 18px rgba(0,0,0,.18);color:#fff;font-size:30px;transition:transform .15s}
.yh-sound:hover{transform:translateY(-1px) scale(1.03)}
.yh-sound:active{transform:scale(.97)}
.yh-sound .wave{position:absolute;inset:0;border-radius:inherit;border:2px solid rgba(250,140,22,.45);animation:yh-wave 1.4s ease-out infinite;pointer-events:none}
@keyframes yh-wave{0%{transform:scale(1);opacity:.9}100%{transform:scale(1.6);opacity:0}}

/* Quiz options (pastel theo vị trí + badge chữ ở góc) */
.yh-options{display:grid;grid-template-columns:1fr 1fr;gap:14px;max-width:680px;margin:0 auto}
.yh-opt{position:relative;border-radius:16px;padding:20px 40px;min-height:120px;display:flex;align-items:center;justify-content:center;text-align:center;cursor:pointer;font-size:24px;font-weight:600;color:var(--yhw-text);overflow:hidden;transition:transform .18s ease-out,box-shadow .18s ease-out,background-color .18s,color .18s}
.yh-options .yh-opt:nth-child(1){background:#e3f5ff}
.yh-options .yh-opt:nth-child(2){background:#fff4d8}
.yh-options .yh-opt:nth-child(3){background:#e6fffb}
.yh-options .yh-opt:nth-child(4){background:#ffe6fb}
.yh-opt:hover{transform:translateY(-2px);box-shadow:0 6px 18px rgba(0,0,0,.08)}
.yh-opt .badge-letter{position:absolute;width:26px;height:26px;border-radius:999px;background:#fa8c16;color:#fff;font-size:13px;font-weight:600;display:flex;align-items:center;justify-content:center;box-shadow:0 0 0 2px rgba(255,255,255,.7)}
.yh-opt:nth-child(1) .badge-letter{right:14px;bottom:14px}
.yh-opt:nth-child(2) .badge-letter{left:14px;bottom:14px}
.yh-opt:nth-child(3) .badge-letter{right:14px;top:14px}
.yh-opt:nth-child(4) .badge-letter{left:14px;top:14px}
.yh-opt.correct{background:#52c41a!important;color:#fff;animation:yh-bounce .28s ease-out}
.yh-opt.wrong{background:#ff4d4f!important;color:#fff;animation:yh-shake .28s ease-out}
.yh-opt.disabled{pointer-events:none}
@keyframes yh-bounce{0%{transform:scale(1)}40%{transform:scale(1.06)}100%{transform:scale(1)}}
@keyframes yh-shake{0%{transform:translateX(0)}20%{transform:translateX(-4px)}40%{transform:translateX(4px)}60%{transform:translateX(-3px)}80%{transform:translateX(3px)}100%{transform:translateX(0)}}

/* Fill-in slots (nét đứt, nền #cadeff) */
.yh-slots{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin:18px 0}
.yh-slot{min-width:50px;height:60px;border:1px dashed #d9d9d9;border-radius:4px;text-align:center;font-size:36px;font-weight:700;text-transform:lowercase;background:#cadeff;color:var(--yhw-text)}
.yh-slot:focus{outline:none;border-style:solid;border-color:var(--yhw-primary);box-shadow:0 0 0 2px rgba(59,130,246,.2)}
.yh-slot.space{border:0;background:transparent;width:14px;min-width:14px}
.yh-slot.ok{border-style:solid;border-color:#52c41a;background:rgba(82,196,26,.1)}
.yh-slot.bad{border-style:solid;border-color:#ff4d4f;background:rgba(255,77,79,.1)}

/* Unscramble tiles (xanh #1677ff) */
.yh-tiles{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin:18px 0;min-height:60px}
.yh-tile{min-width:52px;height:60px;padding:0 8px;border:0;border-radius:6px;background:#1677ff;color:#fff;font-size:34px;font-weight:700;text-transform:uppercase;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;user-select:none;box-shadow:0 3px 8px rgba(22,119,255,.3)}
.yh-tile.placed{filter:brightness(1.08)}
.yh-drop{min-height:64px;border:2px dashed #d9d9d9;border-radius:10px;padding:8px;display:flex;gap:10px;justify-content:center;flex-wrap:wrap;align-items:center;margin:0 auto;max-width:640px;background:#fafcff}

/* Matching (thẻ trắng + active xanh) */
.yh-match-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;max-width:700px;margin:0 auto}
.yh-match-col{display:flex;flex-direction:column;gap:10px;background:#f7f9ff;border:1px dashed rgba(24,144,255,.3);border-radius:12px;padding:12px}
.yh-match-col:last-child{background:#fffdf5;border-color:rgba(250,173,20,.4)}
.yh-mcard{padding:14px 16px;background:#fff;border:2px solid transparent;border-radius:12px;cursor:pointer;text-align:center;font-weight:600;font-size:18px;box-shadow:0 1px 3px rgba(0,0,0,.04);transition:.15s}
.yh-mcard:hover{box-shadow:0 4px 12px rgba(0,0,0,.06);transform:translateY(-1px)}
.yh-mcard.sel{border-color:#1890ff;box-shadow:0 0 0 2px rgba(24,144,255,.25);background:#e6f7ff}
.yh-mcard.done{border-color:#52c41a;background:#f6ffed;color:#389e0d;pointer-events:none}
.yh-mcard.shake{animation:yh-shake .35s}

/* Memory (mặt cam #d46b08, lưng kem) */
.yh-mem-grid{display:grid;gap:14px;max-width:680px;margin:0 auto}
.yh-mem{aspect-ratio:1/1;perspective:800px;cursor:pointer}
.yh-mem-in{position:relative;width:100%;height:100%;transition:transform .35s ease;transform-style:preserve-3d}
.yh-mem.flip .yh-mem-in{transform:rotateY(180deg)}
.yh-mem-f,.yh-mem-b{position:absolute;inset:0;backface-visibility:hidden;border-radius:10px;display:grid;place-items:center;box-shadow:0 4px 12px rgba(0,0,0,.18);padding:6px;text-align:center}
.yh-mem-f{background:#d46b08;color:#fff;font-size:30px;font-weight:800;text-shadow:0 2px 8px rgba(0,0,0,.25)}
.yh-mem-b{background:#fffbe6;transform:rotateY(180deg);font-size:22px;font-weight:600}
.yh-mem.matched .yh-mem-b{background:#f6ffed}
.yh-mem.matched .yh-mem-in{animation:yh-bounce .4s ease-out}

/* Connect */
.yh-connect{position:relative;max-width:700px;margin:0 auto}
.yh-connect-cols{display:grid;grid-template-columns:1fr 1fr;gap:100px}
.yh-citem{padding:12px 14px;border:1px solid #d9d9d9;border-radius:10px;cursor:pointer;text-align:center;font-weight:600;margin-bottom:10px;min-height:52px;display:flex;align-items:center;justify-content:center;transition:.16s}
.yh-connect-cols>div:first-child .yh-citem{background:#fff7e6}
.yh-connect-cols>div:last-child .yh-citem{background:#f0f5ff}
.yh-citem:hover{transform:translateY(-1px);box-shadow:0 4px 10px rgba(0,0,0,.06)}
.yh-citem.sel{border-color:#1677ff;box-shadow:0 0 0 2px rgba(22,119,255,.25)}
.yh-citem.linked{border-color:#52c41a;background:#f0ffe6!important}
#yhLines{position:absolute;inset:0;pointer-events:none;z-index:2}

/* Vowel (phím màu theo nguyên âm) */
.yh-vowel-word{display:flex;gap:6px;justify-content:center;flex-wrap:wrap;font-size:40px;font-weight:700;letter-spacing:3px;margin:14px 0}
.yh-vchar{min-width:28px;text-align:center}
.yh-vchar.blank{border-bottom:3px solid #999;color:var(--yhw-primary)}
.yh-vkeys{display:flex;gap:10px;justify-content:center;flex-wrap:wrap;margin-top:8px}
.yh-vkey{min-width:52px;height:52px;border:0;border-radius:14px;font-size:28px;font-weight:700;cursor:pointer;color:#fff;box-shadow:0 3px 10px rgba(0,0,0,.15);transition:transform .1s}
.yh-vkey:hover{transform:translateY(-2px);box-shadow:0 6px 16px rgba(0,0,0,.2)}
.yh-vkey[data-v=a]{background:linear-gradient(135deg,#ff4d4f,#ff7875)}
.yh-vkey[data-v=e]{background:linear-gradient(135deg,#fa8c16,#ffa940)}
.yh-vkey[data-v=i]{background:linear-gradient(135deg,#fadb14,#ffd666);color:#473b00}
.yh-vkey[data-v=o]{background:linear-gradient(135deg,#52c41a,#73d13d)}
.yh-vkey[data-v=u]{background:linear-gradient(135deg,#13c2c2,#36cfc9)}
.yh-vkey[data-v=y]{background:linear-gradient(135deg,#597ef7,#85a5ff)}

/* Word Search */
.yh-ws-wrap{display:flex;gap:32px;flex-wrap:wrap;justify-content:center;align-items:flex-start}
.yh-ws-grid{display:grid;gap:4px;user-select:none;touch-action:none;padding:12px;border-radius:16px;background:#fff;box-shadow:0 8px 24px rgba(15,35,95,.06)}
.yh-ws-cell{width:34px;height:34px;display:grid;place-items:center;background:#fff;border:1px solid #f0f0f0;border-radius:6px;font-weight:600;text-transform:uppercase;cursor:pointer;font-size:18px;transition:.1s}
.yh-ws-cell:hover{background:#e6f7ff;border-color:#91d5ff;transform:translateY(-1px)}
.yh-ws-cell.sel{background:#e6f4ff;border-color:#91caff}
.yh-ws-cell.found{border-color:#1890ff;color:#102a43;background:#eaf3ff}
.yh-ws-list{min-width:220px}
.yh-ws-list b{display:block;margin-bottom:8px}
.yh-ws-list .yh-ws-grid2{display:grid;grid-template-columns:repeat(2,1fr);gap:6px 12px}
.yh-ws-list .w{padding:5px 10px;border-radius:999px;background:#f5f5f5;text-align:center;font-weight:600;font-size:16px}
.yh-ws-list .w.done{background:#e6fffb;color:#08979c;text-decoration:line-through}

/* Flashcard */
.yh-fc{max-width:520px;margin:0 auto}
.yh-fc-card{perspective:1400px;height:300px;cursor:pointer}
.yh-fc-in{position:relative;width:100%;height:100%;transition:transform .5s;transform-style:preserve-3d}
.yh-fc-card.flip .yh-fc-in{transform:rotateY(180deg)}
.yh-fc-face{position:absolute;inset:0;backface-visibility:hidden;border-radius:18px;display:grid;place-items:center;text-align:center;padding:20px;box-shadow:0 8px 24px rgba(15,35,95,.12);border:1px solid #eef;background:#fff}
.yh-fc-back{transform:rotateY(180deg);background:#eaf3ff}

/* Buttons (đồng bộ màu primary game) */
.yh-game-main .btn{background:var(--yhw-primary);border-color:var(--yhw-primary);border-radius:10px}
.yh-game-main .btn:hover{background:#2f6fe0;border-color:#2f6fe0}
.yh-game-main .btn-ghost{background:#fff;color:var(--yhw-text);border-color:#d9d9d9}
.yh-game-main .btn-ghost:hover{color:var(--yhw-primary);border-color:var(--yhw-primary)}

/* Màn hình hoàn thành */
.yh-done{position:fixed;inset:0;background:rgba(10,40,70,.55);display:none;place-items:center;z-index:50;padding:16px}
.yh-done.show{display:grid}
.yh-done-card{background:linear-gradient(135deg,#f6ffed,#e6f7ff,#fff0f6);border-radius:18px;padding:34px;text-align:center;max-width:460px;width:100%;box-shadow:0 12px 30px rgba(0,0,0,.18)}
.yh-done-emoji{font-size:54px}
.yh-done-card h2{background:linear-gradient(120deg,#ff7875,#ffa940,#95de64,#69c0ff,#b37feb);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;font-size:30px}
.yh-done-score{font-size:46px;font-weight:800;color:var(--yhw-primary);margin:6px 0}
.yh-done-max{font-size:24px;color:rgba(0,0,0,.45)}
.yh-done-sub{color:rgba(0,0,0,.55);margin-bottom:18px;font-size:15px}
.yh-done-btns{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}

@media(max-width:600px){
  #yhStage{padding:14px 10px}
  .yh-options,.yh-match-grid{grid-template-columns:1fr 1fr;gap:8px}
  .yh-opt{padding:14px 30px;min-height:80px;font-size:18px;border-radius:12px}
  .yh-connect-cols{gap:60px}
  .yh-prompt .word{font-size:28px}.yh-prompt .mean{font-size:24px}
  .yh-slot{min-width:34px;height:46px;font-size:26px}
  .yh-tile{min-width:34px;height:46px;font-size:26px}
  .yh-vkey{min-width:38px;height:46px;font-size:20px}
  .yh-game-title{display:none}
}

/* ===== Mobile minigame (≤480 / ≤360) ===== */
@media(max-width:480px){
  .yh-game-header{height:54px;padding:0 12px;gap:10px}
  .yh-bar{width:70px} .yh-game-close{width:44px;height:44px}
  .yh-prompt .word{font-size:26px} .yh-prompt .mean{font-size:22px}
  .yh-options{grid-template-columns:1fr;gap:10px} .yh-opt{min-height:58px;padding:12px 18px}
  .yh-fc-card{height:220px} .yh-fc-face h2,.yh-fc-front h2{font-size:28px}
  .yhw-memory-grid{grid-template-columns:repeat(3,1fr);gap:12px}
  .yh-ws-wrap{flex-direction:column;align-items:center;gap:14px}
  .yh-ws-cell{width:30px;height:30px;font-size:15px}
  .yh-connect-cols{gap:24px}
  .yhw-fillin-input{font-size:26px!important} .yhw-unscramble-top h2{font-size:30px;letter-spacing:2px}
}
@media(max-width:360px){
  .yh-game-title{display:none!important}
  .yh-game-header{height:50px;padding:0 10px;gap:8px} .yh-bar{width:54px} .yh-game-progress{font-size:10px}
  .yh-prompt .word{font-size:22px} .yh-prompt .mean{font-size:18px}
  .yh-slot{min-width:36px;height:48px;font-size:24px} .yh-slots{gap:5px}
  .yh-tile{min-width:32px;height:44px;font-size:22px} .yh-tiles{gap:6px}
  .yh-match-grid{grid-template-columns:1fr;gap:12px}
  .yhw-memory-grid{grid-template-columns:repeat(2,1fr);gap:10px}
  .yh-ws-grid2{grid-template-columns:1fr} .yh-ws-list{min-width:0;width:100%}
  .yh-vowel-keys,.yh-vkeys{gap:6px} .yh-vkey{min-width:44px;height:46px;font-size:22px}
  .yh-fc-card{height:180px} .yh-fc-face h2,.yh-fc-front h2{font-size:22px}
}
.yh-newgame{max-width:820px;margin:0 auto;padding:20px;text-align:center}
.yh-kicker{font-size:12px;letter-spacing:.12em;font-weight:800;color:#6d8580;margin-bottom:14px}
.yh-focus-word{font-size:42px;margin:4px 0 22px;color:#133338}
.yh-context-sentence{font-size:26px;line-height:1.55;font-weight:700;color:#133338;background:#f7fbfa;border:1px solid #dce8e6;border-radius:14px;padding:24px;margin-bottom:22px}
.yh-choice-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.yh-choice{min-height:58px;border:2px solid #dce6e4;background:#fff;border-radius:12px;padding:12px 16px;font:inherit;font-size:17px;color:#133338;cursor:pointer;transition:.15s}
.yh-choice:hover{border-color:#58b1b8;background:#f1fbfc}
.yh-choice.is-selected{border-color:#0a8ca0;background:#e9f8fa;box-shadow:0 0 0 3px rgba(0,175,198,.12)}
.yh-choice.is-correct{border-color:#22a06b!important;background:#eaf9f1!important;color:#11613f}
.yh-choice.is-wrong{border-color:#dc5b70!important;background:#fff0f3!important;color:#95263b}
.yh-triple{display:grid;grid-template-columns:1fr 1fr;gap:18px;text-align:left}
.yh-triple>div{display:grid;gap:9px}.yh-triple>div>span{font-weight:800;color:#526a66;font-size:13px;text-transform:uppercase;letter-spacing:.06em}
.yh-inline-status{min-height:24px;margin-top:16px;color:#607873;font-weight:600}
.yh-clue{color:#526a66;font-size:17px;margin:0 0 18px}
.yh-sentence-answer{min-height:76px;border:2px dashed #b9ccca;border-radius:14px;padding:12px;display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap;background:#f8fbfb;margin-bottom:16px}
.yh-sentence-answer.is-correct{border-color:#22a06b;background:#eaf9f1}.yh-sentence-answer.is-wrong{border-color:#dc5b70;background:#fff0f3}
.yh-token-bank{display:flex;flex-wrap:wrap;gap:9px;justify-content:center}.yh-token{border:1px solid #cad9d7;background:#fff;border-radius:9px;padding:9px 13px;font:inherit;font-weight:700;color:#133338;cursor:pointer}.yh-token:disabled{opacity:.28}.yh-token.is-answer{background:#e8f6f7;border-color:#59abb4}
.yh-game-controls{display:flex;justify-content:center;gap:10px;margin-top:18px;flex-wrap:wrap}
.yh-radical{font-family:"Noto Sans SC","Microsoft YaHei",sans-serif;font-size:74px;line-height:1;margin:8px 0 24px;color:#0b8191}
.yh-hanzi-choices .yh-choice b{display:block;font-family:"Noto Sans SC","Microsoft YaHei",sans-serif;font-size:34px}.yh-hanzi-choices .yh-choice small{display:block;color:#6e827f;font-size:13px;margin-top:5px}
.yh-strokes{display:flex;flex-direction:column;align-items:center}.yh-hanzi-board{border:2px solid #bfd1ce;border-radius:14px;background-color:#fff;background-image:linear-gradient(45deg,transparent 49.7%,#edf2f1 49.7%,#edf2f1 50.3%,transparent 50.3%),linear-gradient(-45deg,transparent 49.7%,#edf2f1 49.7%,#edf2f1 50.3%,transparent 50.3%);touch-action:none}
.yh-memory-image{display:block;width:100%;max-height:92px;object-fit:contain;border-radius:8px}.yh-memory-caption{display:block;font-size:12px;margin-top:4px}
.yh-empty-game{text-align:center;padding:24px 10px}
@media(max-width:640px){.yh-newgame{padding:10px}.yh-choice-grid,.yh-triple{grid-template-columns:1fr}.yh-context-sentence{font-size:20px;padding:18px}.yh-focus-word{font-size:34px}.yh-radical{font-size:60px}}
/* 17/10/2026: Điền từ — đáp án đúng dưới ô nhập (vocab-games.js fillEngine) */
.yhw-fillin-answer{font-weight:600;font-size:18px;color:#475569;text-align:center}.yhw-fillin-answer b{color:#16a34a;font-weight:800}
