:root {
  --brand: #0f766e;
  --brand-2: #14b8a6;
  --brand-ink: #ffffff;
  --accent: #f59e0b;
  --danger: #e11d48;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.hide-sm {}
.show-sm { display: none !important; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 18px;
  font: inherit; font-weight: 600; cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #0d5f59; }
.btn-accent { background: var(--accent); color: #1f1300; }
.btn-accent:hover { filter: brightness(.95); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 42px; height: 42px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 18px;
}
.badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

/* Top bar & header */
.topbar { background: var(--ink); color: #e2e8f0; font-size: 13px; }
.topbar-inner { display: flex; justify-content: space-between; gap: 12px; padding: 6px 16px; }
.header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.header-inner { display: flex; align-items: center; gap: 20px; padding: 12px 16px; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-mark {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; letter-spacing: -.5px;
}
.logo-text { font-size: 12px; line-height: 1.15; color: var(--muted); }
.logo-text b { font-size: 16px; color: var(--brand); }
.search { flex: 1; display: flex; max-width: 560px; }
.search input {
  flex: 1; min-width: 0; border: 1.5px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px;
  padding: 10px 14px; font: inherit; background: var(--surface-2); outline: none;
}
.search input:focus { border-color: var(--brand); background: #fff; }
.search button { border: 0; background: var(--brand); color: #fff; padding: 0 16px; border-radius: 0 10px 10px 0; cursor: pointer; }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav-wrap { border-top: 1px solid var(--line); }
.nav { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.nav a { display: block; padding: 11px 14px; font-weight: 600; font-size: 14px; white-space: nowrap; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.active { color: var(--brand); border-bottom-color: var(--brand); }
.user-chip { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #1f1300; display: grid; place-items: center; font-weight: 700; }
.dropdown {
  position: absolute; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); min-width: 200px; padding: 6px; display: none;
}
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; border: 0; background: none; font: inherit; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); }

/* Sections */
main { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }
.section { margin: 36px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 22px; margin: 0; }
.section-head a { color: var(--brand); font-weight: 600; font-size: 14px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a:hover { color: var(--brand); }

/* Hero */
.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px;
}
.hero-main {
  border-radius: 20px; padding: 40px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(circle at 85% 20%, rgba(255,255,255,.18), transparent 40%), linear-gradient(135deg, #0f766e, #134e4a 60%, #1e293b);
}
.hero-main h1 { font-size: 34px; letter-spacing: -.5px; max-width: 520px; }
.hero-main p { opacity: .9; max-width: 480px; }
.hero-main .btn { margin-top: 8px; margin-right: 8px; }
.hero-stats { display: flex; gap: 28px; margin-top: 28px; flex-wrap: wrap; }
.hero-stats b { display: block; font-size: 22px; }
.hero-stats span { font-size: 13px; opacity: .8; }
.hero-side { display: grid; gap: 20px; }
.promo { border-radius: 20px; padding: 24px; display: flex; flex-direction: column; justify-content: center; }
.promo h3 { font-size: 20px; margin-bottom: 4px; }
.promo-1 { background: #fef3c7; color: #78350f; }
.promo-2 { background: #e0e7ff; color: #312e81; }
.promo .btn { align-self: flex-start; margin-top: 10px; }

.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 20px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 12px;
  text-align: center; font-weight: 600; font-size: 14px; transition: .15s;
}
.tile:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.tile .ico { font-size: 28px; display: block; margin-bottom: 6px; }

/* Product grid & card */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: .15s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.thumb {
  aspect-ratio: 16 / 9; position: relative; color: #fff; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
}
.thumb::after {
  content: ""; position: absolute; right: -30px; bottom: -30px; width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.thumb .t-icon { font-size: 34px; position: absolute; right: 14px; bottom: 10px; z-index: 1; }
.thumb .t-title { font-weight: 700; font-size: 14px; line-height: 1.3; max-width: 78%; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; z-index: 1; }
.thumb .t-type { font-size: 11px; font-weight: 700; background: rgba(0,0,0,.22); padding: 3px 8px; border-radius: 20px; align-self: flex-start; z-index: 1; }
.thumb.lg { aspect-ratio: 16 / 9; border-radius: var(--radius); padding: 28px; }
.thumb.lg .t-title { font-size: 26px; max-width: 80%; }
.thumb.lg .t-icon { font-size: 72px; right: 28px; bottom: 20px; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.card-title { font-weight: 600; font-size: 14.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-title:hover { color: var(--brand); }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; }
.price { font-weight: 800; color: var(--danger); }
.price.free { color: var(--brand); }
.old-price { font-size: 12px; color: var(--muted); text-decoration: line-through; margin-left: 6px; font-weight: 400; }
.stars { color: var(--accent); font-size: 12px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: var(--surface-2); color: var(--muted); }
.tag-own { background: #dcfce7; color: #166534; }
.tag-pending { background: #fef3c7; color: #92400e; }

/* Listing */
.listing { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; position: sticky; top: 140px; }
.filters h4 { font-size: 14px; margin: 16px 0 8px; }
.filters h4:first-child { margin-top: 0; }
.filters label { display: flex; gap: 8px; align-items: center; font-size: 14px; padding: 3px 0; cursor: pointer; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar h1 { font-size: 22px; margin: 0; }
select, input[type=text], input[type=email], input[type=number], input[type=password], textarea {
  font: inherit; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--surface); color: var(--ink); width: 100%;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--brand); }
.toolbar select { width: auto; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: 6px 12px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--line); }
.empty .big { font-size: 48px; }

/* Detail */
.detail { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.buybox h1 { font-size: 24px; }
.buybox .price-row { display: flex; align-items: baseline; gap: 10px; margin: 12px 0; }
.buybox .price { font-size: 30px; }
.buybox .save { background: #ffe4e6; color: var(--danger); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.buybox .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.specs { width: 100%; border-collapse: collapse; font-size: 14px; }
.specs td { padding: 8px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.specs td:first-child { color: var(--muted); width: 42%; }
.thumbs-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
.thumbs-row .thumb { border-radius: 10px; padding: 8px; aspect-ratio: 16/9; }
.thumbs-row .thumb .t-title { font-size: 10px; }
.thumbs-row .thumb .t-icon { font-size: 18px; right: 8px; bottom: 4px; }
.author { display: flex; gap: 12px; align-items: center; }
.author .avatar { width: 48px; height: 48px; font-size: 18px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.chapter { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.chapter summary { padding: 12px 14px; font-weight: 600; cursor: pointer; background: var(--surface-2); list-style: none; display: flex; justify-content: space-between; }
.chapter summary::-webkit-details-marker { display: none; }
.lesson { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.lesson.playable { cursor: pointer; }
.lesson.playable:hover { background: #f0fdfa; }
.lesson.current { background: #ccfbf1; }
.chapter-head { font-weight: 700; color: var(--brand); padding: 14px 4px 6px; }
.chapter-head:first-child { padding-top: 0; }
.panel > .lesson { padding-left: 4px; padding-right: 4px; }
.review { border-top: 1px solid var(--line); padding: 12px 0; }
.review:first-child { border-top: 0; }
.license { font-size: 13px; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 10px; padding: 12px; color: #134e4a; }

/* Cart & checkout */
.two-col { display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.cart-item { display: grid; grid-template-columns: 120px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-item .thumb { border-radius: 10px; padding: 8px; }
.cart-item .thumb .t-title { font-size: 10px; }
.cart-item .thumb .t-icon { font-size: 22px; right: 8px; bottom: 4px; }
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; }
.summary-row.total { font-size: 20px; font-weight: 800; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; }
.pay-opt { display: flex; gap: 12px; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; margin-bottom: 10px; }
.pay-opt:has(input:checked) { border-color: var(--brand); background: #f0fdfa; }
.pay-opt .pi { font-size: 24px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.qr-box { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; }
.qr-box svg { width: 200px; height: 200px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.kv { font-size: 14px; }
.kv div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.kv b { text-align: right; }
.success { text-align: center; padding: 40px 20px; }
.success .big { font-size: 64px; }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat span { font-size: 13px; color: var(--muted); }
.stat b { display: block; font-size: 24px; margin-top: 4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table-wrap { overflow-x: auto; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.step .num { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; margin-bottom: 10px; }
.cta-band {
  border-radius: 20px; padding: 32px; color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(120deg, #4338ca, #7c3aed);
}
.cta-band h2 { margin: 0 0 4px; }
.player { aspect-ratio: 16/9; border-radius: var(--radius); background: #0f172a; color: #cbd5e1; display: grid; place-items: center; text-align: center; padding: 20px; }
.player .play { width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.15); display: grid; place-items: center; font-size: 30px; margin: 0 auto 12px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 10px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); }
.auth { max-width: 420px; margin: 20px auto; }

/* Footer & toast */
.footer { background: #0f172a; color: #cbd5e1; padding: 40px 0 0; }
.footer .logo-text b { color: #5eead4; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 24px; }
.footer h4 { color: #fff; font-size: 15px; }
.footer a { display: block; padding: 3px 0; font-size: 14px; }
.footer a:hover { color: #5eead4; }
.footer .muted { color: #94a3b8; font-size: 14px; }
.copyright { border-top: 1px solid #1e293b; margin-top: 28px; padding: 16px; font-size: 13px; color: #64748b; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); background: var(--ink); color: #fff;
  padding: 12px 20px; border-radius: 12px; box-shadow: var(--shadow); transition: .25s; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Responsive */
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .hero { grid-template-columns: 1fr; }
  .hero-side { grid-template-columns: 1fr 1fr; }
  .steps, .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .listing, .detail, .two-col { grid-template-columns: 1fr; }
  .filters { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .show-sm { display: inline-grid !important; }
  .header-inner { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .logo-text { display: none; }
  .nav-wrap { display: none; }
  .nav-wrap.open { display: block; }
  .nav { flex-direction: column; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .hero-main { padding: 26px; }
  .hero-main h1 { font-size: 26px; }
  .hero-side { grid-template-columns: 1fr; }
  .thumb.lg .t-title { font-size: 18px; }
  .thumb.lg .t-icon { font-size: 44px; }
  .qr-box { grid-template-columns: 1fr; justify-items: center; }
  .row2, .steps, .footer-grid { grid-template-columns: 1fr; }
  .cart-item { grid-template-columns: 80px 1fr; }
  .cart-item > :last-child { grid-column: 2; }
  .buybox .actions { grid-template-columns: 1fr; }
}
