:root { --blue: #2c4bda; --navy: #101f3f; --orange: #f5b544; --muted: #5f6b7a; --line: #e3e8ef; --soft: #f5f7fc; --bg: #fbfcfe; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--navy); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 18px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.top { background: #fff; border-bottom: 1px solid var(--line); padding-bottom: 14px; position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 800; color: var(--navy); }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand b { color: var(--blue); }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { padding: 8px 12px; border-radius: 10px; color: var(--navy); white-space: nowrap; font-weight: 500; }
.nav a.on, .nav a:hover { background: #eef2fd; color: var(--blue); text-decoration: none; }
#hl { border: 1px solid var(--line); border-radius: 10px; padding: 7px 8px; background: #fff; font: inherit; }
.search { position: relative; display: flex; gap: 0; border: 2px solid var(--blue); border-radius: 14px; overflow: visible; background: #fff; }
.search input { flex: 1; border: 0; outline: none; padding: 13px 16px; font-size: 18px; border-radius: 14px 0 0 14px; min-width: 0; }
.search button { border: 0; background: var(--blue); color: #fff; font-weight: 700; padding: 0 22px; font-size: 16px; border-radius: 0 11px 11px 0; cursor: pointer; }
.sug { position: absolute; top: 100%; left: -2px; right: -2px; background: #fff; border: 1px solid var(--line); border-radius: 0 0 12px 12px;
  list-style: none; margin: 0; padding: 4px 0; box-shadow: 0 12px 24px rgba(16,31,63,.1); z-index: 9; }
.sug li a { display: block; padding: 8px 16px; color: var(--navy); }
.sug li a:hover, .sug li a.act { background: var(--soft); text-decoration: none; }
.notice { background: #fff8e1; border-bottom: 1px solid #f3dfb0; padding: 8px 18px; text-align: center; }
main { padding-top: 22px; padding-bottom: 40px; min-height: 60vh; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.side .panel { margin-bottom: 16px; }
h1.hero { font-size: 30px; margin: 10px 0 4px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 22px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; color: var(--navy); }
.chips a:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.az { display: flex; flex-wrap: wrap; gap: 6px; }
.az a { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: #fff;
  border: 1px solid var(--line); font-weight: 700; color: var(--navy); }
.az a.on { background: var(--blue); color: #fff; }
.wotd { background: linear-gradient(135deg, #eef2ff, #fff6e6); border: 0; }
.wotd .lbl { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--blue); }
.wotd .w { font-size: 30px; font-weight: 800; color: var(--navy); }
.btn { display: inline-block; border: 0; background: var(--blue); color: #fff; border-radius: 12px; padding: 11px 18px; font-weight: 700; cursor: pointer; font: inherit; }
.btn.ghost, button.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.list { columns: 3 180px; padding: 0; list-style: none; }
.list li { padding: 3px 0; break-inside: avoid; }
.origins .item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.origins .item b { font-size: 18px; }
.flash { min-height: 240px; border-radius: 18px; border: 1px solid var(--line); background: #fff; padding: 26px; text-align: center;
  display: flex; flex-direction: column; justify-content: center; cursor: pointer; box-shadow: 0 8px 26px rgba(16,31,63,.07); }
.flash .front { font-size: 38px; font-weight: 800; }
.flash.back { text-align: left; cursor: default; justify-content: flex-start; }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.rate button { border: 0; border-radius: 12px; padding: 13px 4px; font-weight: 700; color: #fff; cursor: pointer; font: inherit; }
.r0 { background: #d64545; } .r1 { background: #e08a1e; } .r2 { background: #2e9d5b; } .r3 { background: var(--blue); }
.stats { display: flex; gap: 12px; margin: 16px 0; }
.stats div { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; text-align: center; }
.stats b { display: block; font-size: 28px; color: var(--blue); }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.game { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.game h3 { margin: 6px 0; }
.opts { display: grid; gap: 10px; margin-top: 14px; }
.opts button { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; cursor: pointer; font: inherit; }
.opts button.ok { background: #e8f6ee; border-color: #2e9d5b; } .opts button.no { background: #fdecec; border-color: #d64545; }
.apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.foot { border-top: 1px solid var(--line); background: #fff; padding: 22px 0; }
.foot .wrap { display: flex; flex-direction: column; gap: 6px; }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(440px, 92vw); box-shadow: 0 20px 50px rgba(16,31,63,.25); }
dialog form { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
dialog input, dialog textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; }
dialog .row { display: flex; gap: 10px; justify-content: flex-end; }
dialog button { border: 0; background: var(--blue); color: #fff; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 20; }
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .bar { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .du-hw { font-size: 26px; }
}
html[dir=rtl] .search input { border-radius: 0 14px 14px 0; }
html[dir=rtl] .search button { border-radius: 11px 0 0 11px; }
/* bộ thẻ có sẵn (gói dựng bằng DictBuilder) */
.sec-title { margin: 26px 0 4px; font-size: 20px; color: var(--navy, #101f3f); }
.deck-pack h3 { margin: 14px 0 6px; font-size: 15px; color: #5f6b7a; }
.deck { background: #fff; border: 1px solid #e3e8ef; border-radius: 10px; margin: 6px 0; padding: 0 12px; }
.deck summary { display: flex; align-items: center; gap: 10px; padding: 10px 0; cursor: pointer; list-style: none; }
.deck summary::-webkit-details-marker { display: none; }
.deck summary::before { content: "▸"; color: #2c4bda; transition: transform .15s; }
.deck[open] summary::before { transform: rotate(90deg); }
.deck-name { font-weight: 700; flex: 1; }
.deck-sub { display: flex; align-items: center; gap: 10px; padding: 7px 0 7px 22px; border-top: 1px solid #eef1f6; }
.deck-sub span:first-child { flex: 1; }
.btn.small { padding: 4px 10px; font-size: 13px; }
