/* duel.css — Minecraft Duel Card Battle Arena (V27)
 * Light + System Dark Mode, 0 horizontal overflow on 390px mobile,
 * uniform borders + subtle tinted surfaces (zero single-edge accent bars).
 */
.dl-hero {
  background: var(--c-surf, #ffffff);
  border: 1px solid var(--c-bd, #dbe2ec);
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.dl-hero h1 { margin: 0 0 6px; font-size: clamp(1.35rem, 2.4vw, 1.85rem); }
.dl-hero p { margin: 0; color: var(--c-mut, #526072); max-width: 700px; font-size: 0.96rem; line-height: 1.5; }
.dl-deckbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--c-surf, #ffffff);
  border: 1px solid var(--c-bd, #dbe2ec);
  border-radius: 14px;
}
.dl-deckbar__lbl { font-weight: 700; font-size: 0.9rem; margin-right: 4px; }
.dl-deck-btn {
  border: 1px solid var(--c-bd, #cbd5e1);
  background: var(--c-bg-soft, #f8fafc);
  color: var(--c-txt, #111827);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.dl-deck-btn.is-on {
  background: #16a34a;
  border-color: #15803d;
  color: #ffffff;
}
.dl-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 14px;
  align-items: start;
}
.dl-arena {
  background: var(--c-surf, #ffffff);
  border: 1px solid var(--c-bd, #dbe2ec);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dl-zone {
  border: 1px solid var(--c-bd, #dbe2ec);
  border-radius: 14px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.025);
}
.dl-zone--opp { background: rgba(220, 38, 38, 0.035); border-color: rgba(220, 38, 38, 0.22); }
.dl-zone--you { background: rgba(22, 163, 74, 0.035); border-color: rgba(22, 163, 74, 0.25); }
.dl-zhead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.88rem;
}
.dl-zname { font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }
.dl-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dl-dot--opp { background: #dc2626; }
.dl-dot--you { background: #16a34a; }
.dl-meters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dl-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--c-bd, #cbd5e1);
  background: var(--c-surf, #ffffff);
}
.dl-pill--prizes { color: #b45309; border-color: rgba(217, 119, 6, 0.38); background: rgba(245, 158, 11, 0.1); }
.dl-pill--energy { color: #1d4ed8; border-color: rgba(37, 99, 235, 0.35); background: rgba(59, 130, 246, 0.1); }
.dl-field-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
.dl-active-card {
  border: 1px solid var(--c-bd, #cbd5e1);
  border-radius: 12px;
  background: var(--c-surf, #ffffff);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dl-active-top { display: flex; gap: 10px; align-items: center; }
.dl-active-img {
  width: 68px;
  height: 95px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #0f172a;
}
.dl-active-meta { min-width: 0; flex: 1; }
.dl-cname { font-weight: 800; font-size: 0.96rem; line-height: 1.2; margin-bottom: 3px; word-break: break-word; }
.dl-csub { font-size: 0.76rem; color: var(--c-mut, #526072); text-transform: capitalize; }
.dl-hpbar {
  height: 9px;
  background: rgba(148, 163, 184, 0.28);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 5px;
}
.dl-hpbar__fill {
  height: 100%;
  background: #16a34a;
  transition: width .22s ease;
}
.dl-hpbar__fill--mid { background: #d97706; }
.dl-hpbar__fill--low { background: #dc2626; }
.dl-hptxt { font-size: 0.78rem; font-weight: 700; margin-top: 3px; display: flex; justify-content: space-between; gap: 4px; }
.dl-wr { font-size: 0.72rem; color: var(--c-mut, #526072); display: flex; flex-wrap: wrap; gap: 6px; }
.dl-bench {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.dl-bcard {
  border: 1px solid var(--c-bd, #cbd5e1);
  border-radius: 10px;
  background: var(--c-surf, #ffffff);
  padding: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  min-height: 118px;
}
.dl-bcard--empty {
  justify-content: center;
  color: var(--c-mut, #64748b);
  font-size: 0.76rem;
  border-style: dashed;
  background: transparent;
}
.dl-bcard img { width: 52px; height: 73px; object-fit: cover; border-radius: 5px; }
.dl-bcard__n { font-size: 0.76rem; font-weight: 700; line-height: 1.15; }
.dl-bcard__hp { font-size: 0.72rem; color: var(--c-mut, #526072); }
.dl-bcard__btn {
  margin-top: auto;
  width: 100%;
  border: 1px solid #16a34a;
  background: rgba(22, 163, 74, 0.1);
  color: #15803d;
  border-radius: 7px;
  padding: 4px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.dl-bcard__btn:hover { background: #16a34a; color: #ffffff; }
.dl-midbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--c-bd, #cbd5e1);
  background: rgba(99, 102, 241, 0.06);
  font-size: 0.84rem;
}
.dl-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.dl-mvbtn {
  flex: 1 1 180px;
  text-align: left;
  border: 1px solid #2563eb;
  background: rgba(37, 99, 235, 0.08);
  color: var(--c-txt, #0f172a);
  border-radius: 10px;
  padding: 9px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dl-mvbtn:hover:not(:disabled) { background: #2563eb; color: #ffffff; }
.dl-mvbtn:disabled { opacity: 0.45; cursor: not-allowed; }
.dl-mvbtn__top { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 0.88rem; gap: 6px; }
.dl-mvbtn__sub { font-size: 0.75rem; opacity: 0.86; }
.dl-endbtn {
  border: 1px solid var(--c-bd, #94a3b8);
  background: var(--c-bg-soft, #f1f5f9);
  color: var(--c-txt, #0f172a);
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
}
.dl-endbtn:hover:not(:disabled) { background: #334155; color: #ffffff; }
.dl-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.dl-hcard {
  width: 122px;
  border: 1px solid var(--c-bd, #cbd5e1);
  border-radius: 10px;
  background: var(--c-surf, #ffffff);
  padding: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}
.dl-hcard img { width: 72px; height: 101px; object-fit: cover; border-radius: 5px; }
.dl-hcard__t { font-size: 0.76rem; font-weight: 700; line-height: 1.15; }
.dl-hcard__k { font-size: 0.7rem; color: var(--c-mut, #64748b); }
.dl-hcard__btn {
  margin-top: auto;
  width: 100%;
  border: 1px solid #16a34a;
  background: #16a34a;
  color: #ffffff;
  border-radius: 7px;
  padding: 5px 6px;
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
}
.dl-hcard__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.dl-side {
  background: var(--c-surf, #ffffff);
  border: 1px solid var(--c-bd, #dbe2ec);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dl-side h2 { margin: 0; font-size: 1rem; }
.dl-log {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  line-height: 1.38;
  padding-right: 4px;
}
.dl-log__row {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--c-bd, #e2e8f0);
  background: rgba(15, 23, 42, 0.025);
}
.dl-banner {
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid #16a34a;
  background: rgba(22, 163, 74, 0.12);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dl-banner--loss { border-color: #dc2626; background: rgba(220, 38, 38, 0.1); }
.dl-banner strong { font-size: 1.05rem; }
.dl-rules-box {
  margin-top: 18px;
  background: var(--c-surf, #ffffff);
  border: 1px solid var(--c-bd, #dbe2ec);
  border-radius: 16px;
  padding: 18px 20px;
}
.dl-rules-box h2 { margin: 0 0 10px; font-size: 1.2rem; }
.dl-rules-box p, .dl-rules-box li { line-height: 1.55; font-size: 0.94rem; }
.dl-embed header, .dl-embed footer, .dl-embed .n9-ft, .dl-embed .n9-bc, .dl-embed .dl-rules-box { display: none !important; }
.dl-embed main { padding-top: 10px !important; }

@media (max-width: 900px) {
  .dl-board { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .dl-field-row { grid-template-columns: minmax(0, 1fr); }
  .dl-hcard { width: calc(50% - 4px); }
  .dl-hero { padding: 14px 15px; }
  .dl-arena { padding: 10px; }
}

html[data-theme="dark"] .dl-hero,
html[data-theme="dark"] .dl-deckbar,
html[data-theme="dark"] .dl-arena,
html[data-theme="dark"] .dl-active-card,
html[data-theme="dark"] .dl-bcard,
html[data-theme="dark"] .dl-hcard,
html[data-theme="dark"] .dl-side,
html[data-theme="dark"] .dl-rules-box,
html[data-theme="dark"] .dl-pill {
  background: #161b26;
  border-color: #2c3547;
  color: #e6ecf5;
}
html[data-theme="dark"] .dl-deck-btn,
html[data-theme="dark"] .dl-endbtn {
  background: #1e2636;
  border-color: #364156;
  color: #e6ecf5;
}
html[data-theme="dark"] .dl-deck-btn.is-on { background: #16a34a; border-color: #22c55e; color: #ffffff; }
html[data-theme="dark"] .dl-mvbtn { background: rgba(59, 130, 246, 0.16); color: #e6ecf5; border-color: #3b82f6; }
html[data-theme="dark"] .dl-bcard__btn { color: #4ade80; border-color: #22c55e; }
html[data-theme="dark"] .dl-log__row { background: #1e2534; border-color: #2c3547; }

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .dl-hero,
  html:not([data-theme="light"]) .dl-deckbar,
  html:not([data-theme="light"]) .dl-arena,
  html:not([data-theme="light"]) .dl-active-card,
  html:not([data-theme="light"]) .dl-bcard,
  html:not([data-theme="light"]) .dl-hcard,
  html:not([data-theme="light"]) .dl-side,
  html:not([data-theme="light"]) .dl-rules-box,
  html:not([data-theme="light"]) .dl-pill {
    background: #161b26;
    border-color: #2c3547;
    color: #e6ecf5;
  }
  html:not([data-theme="light"]) .dl-deck-btn,
  html:not([data-theme="light"]) .dl-endbtn {
    background: #1e2636;
    border-color: #364156;
    color: #e6ecf5;
  }
  html:not([data-theme="light"]) .dl-deck-btn.is-on { background: #16a34a; border-color: #22c55e; color: #ffffff; }
  html:not([data-theme="light"]) .dl-mvbtn { background: rgba(59, 130, 246, 0.16); color: #e6ecf5; border-color: #3b82f6; }
  html:not([data-theme="light"]) .dl-bcard__btn { color: #4ade80; border-color: #22c55e; }
  html:not([data-theme="light"]) .dl-log__row { background: #1e2534; border-color: #2c3547; }
}

/* V29 01/12: giữ chỗ bàn đấu trước khi JS dựng (CLS PC 0.281 -> <0.1) */
#dl-root{min-height:780px}
@media (max-width:760px){#dl-root{min-height:1450px}}
