:root {
  --bg:       #0a1114;
  --panel:    #111b20;
  --panel2:   #18262c;
  --line:     #1f2f36;
  --line2:    #2c424b;
  --text:     #ece8df;
  --mute:     #8fa1a6;
  --acc:      #f2b440;
  --acc-hover:#ffc65a;
  --on-acc:   #1a1303;
  --hot:      #ff6b57;
  --gold:     #f2b440;
  --ok:       #5fd68a;
  --err:      #ff6b6b;
  --warn:     #f2b440;
  --r-sm:     8px;
  --r:        12px;
  --c:        #f2b440;
  --font:     "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box }
html { color-scheme: dark }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased }
body.noscroll { overflow: hidden }
a { color: var(--acc); text-decoration: none }
img { max-width: 100% }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: var(--r-sm) }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px }

/* ---------- Header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(10,17,20,.94); border-bottom: 1px solid var(--line) }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); font-size: 17px; letter-spacing: -.01em }
.mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--acc); color: var(--on-acc); font-size: 12px; font-weight: 800; letter-spacing: -.05em }
.nav { display: flex; align-items: center; gap: 4px }
.nav > a, .dd-btn { color: var(--mute); padding: 8px 12px; border-radius: var(--r-sm); font-weight: 500; font-size: 15px; transition: color .15s, background .15s }
.nav > a:hover, .dd-btn:hover, .dd-btn.on, .dd.open .dd-btn { color: var(--text); background: var(--panel2) }
.dd { position: relative }
.dd-btn { display: flex; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer; font-family: inherit }
.dd-btn svg { transition: transform .2s }
.dd.open .dd-btn svg { transform: rotate(180deg) }
.dd-menu { position: absolute; right: 0; top: calc(100% + 10px); width: 300px; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); padding: 6px; box-shadow: 0 16px 40px -8px rgba(0,0,0,.7); transform-origin: top right }
.dd.open .dd-menu { animation: pop .16s ease-out }
.dd-menu[hidden] { display: none }
.dd-item { display: grid; grid-template-columns: auto 1fr auto; column-gap: 12px; align-items: center; padding: 10px 12px; border-radius: 8px; color: var(--text) }
.dd-item i { grid-column: 1; grid-row: 1/3; width: 9px; height: 9px; border-radius: 50%; background: var(--c) }
.dd-item b { grid-column: 2; grid-row: 1; font-weight: 600; font-size: 15px; line-height: 1.3 }
.dd-item small { grid-column: 2; grid-row: 2; color: var(--mute); font-size: 13px; line-height: 1.3 }
.dd-item em { grid-column: 3; grid-row: 1/3; align-self: center; font-style: normal; color: var(--mute); font-size: 13px; background: var(--bg); border-radius: 20px; padding: 1px 9px }
.dd-item:hover, .dd-item.cur { background: var(--panel2) }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.97) } to { opacity: 1; transform: none } }

main.wrap { padding-bottom: 72px; min-height: 72vh }
footer { border-top: 1px solid var(--line); color: var(--mute); padding: 26px 0; text-align: center; font-size: 14px }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 32px; text-align: center }
.hero h1 { margin: 0 0 12px; font-size: clamp(36px, 6vw, 60px); line-height: 1.05; font-weight: 800; letter-spacing: -.035em }
.hero p { margin: 0 auto 24px; color: var(--mute); max-width: 52ch; font-size: 16px; line-height: 1.6 }
.search { display: flex; align-items: center; gap: 8px; max-width: 500px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); padding: 6px 6px 6px 16px; transition: border-color .15s }
.search:focus-within { border-color: var(--acc) }
.search svg { color: var(--mute); flex: none }
.search input { flex: 1; background: none; border: 0; padding: 9px 4px; color: var(--text); outline: none; min-width: 0; font-size: 15px }
.search button { background: var(--acc); color: var(--on-acc); border: 0; border-radius: var(--r-sm); padding: 10px 20px; cursor: pointer; font-weight: 600; font-size: 15px; transition: background .15s }
.search button:hover { background: var(--acc-hover) }


/* ---------- Form controls ---------- */
input, textarea, button, select { font: inherit }
.box input:not([type=checkbox]):not([type=file]), .box textarea, .box select { width: 100%; background: var(--bg); border: 1px solid var(--line2); color: var(--text); border-radius: var(--r-sm); padding: 11px 13px; font-size: 15px; line-height: 1.6 }
.box textarea { resize: vertical; min-height: 160px; white-space: pre-wrap }
.box input:focus, .box textarea:focus, .box select:focus { outline: 2px solid var(--acc); border-color: transparent }
.btn { background: var(--acc); color: var(--on-acc); border: 0; border-radius: var(--r-sm); padding: 12px 22px; cursor: pointer; display: inline-block; font-weight: 600; transition: background .15s, transform .1s }
.btn:hover { background: var(--acc-hover) }
.btn:active { transform: translateY(1px) }
.btn.ghost { background: transparent; border: 1px solid var(--line2); color: var(--text) }
.btn.ghost:hover { background: var(--panel2) }

/* ---------- Window frame ---------- */
.win { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); overflow: hidden }
.chrome { display: flex; align-items: center; justify-content: space-between; height: 30px; padding: 0 12px; background: var(--panel2); border-bottom: 1px solid var(--line) }
.dots { display: flex; gap: 6px }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line2) }
.tag { font-size: 12px; font-weight: 600; color: var(--c) }

/* ---------- Grid & card ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px }
.card { display: block; color: var(--text) }
.card .win { transition: border-color .2s }
.card:hover .win { border-color: color-mix(in srgb, var(--c) 55%, var(--line2)) }
.card:hover .dots i:nth-child(1) { background: var(--hot); transition: background .2s }
.card:hover .dots i:nth-child(2) { background: var(--gold); transition: background .2s }
.card:hover .dots i:nth-child(3) { background: var(--ok); transition: background .2s }
.thumb { position: relative; aspect-ratio: 16/10; background: #070c0e; display: flex; align-items: center; justify-content: center; color: var(--mute); font-size: 14px; overflow: hidden }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s }
.card:hover .thumb img { transform: scale(1.03) }
.thumb .pin, .thumb .count { position: absolute; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; line-height: 1.5 }
.thumb .pin { top: 10px; left: 10px; display: flex; align-items: center; gap: 5px; background: var(--hot); color: #fff }
.thumb .count { right: 10px; bottom: 10px; background: rgba(10,17,20,.82); backdrop-filter: blur(6px); color: var(--text) }
.info { padding: 12px 2px 4px }
.info h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden }
.price { color: var(--gold); font-weight: 700; font-size: 15px }
.price.free { color: var(--ok) }
.empty { text-align: center; color: var(--mute); padding: 80px 0 }
.empty p { margin: 0 0 18px }

/* ---------- Product detail ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; margin: 28px 0 20px; color: var(--mute); font-weight: 500; font-size: 14px; padding: 6px 12px 6px 8px; border-radius: 999px; border: 1px solid transparent; transition: color .15s, border-color .15s, background .15s }
.back:hover { color: var(--text); border-color: var(--line2); background: var(--panel) }
.detail { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 48px; align-items: start }
.stage { position: relative; display: block; width: 100%; aspect-ratio: 16/10; padding: 0; border: 0; background: #070c0e; cursor: zoom-in; overflow: hidden }
.stage .bg { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(28px) brightness(.4) saturate(1.2) }
.stage img { position: relative; width: 100%; height: 100%; object-fit: contain; display: block }
.stage .zoom { position: absolute; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 6px; background: rgba(10,17,20,.82); backdrop-filter: blur(6px); color: var(--text); font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 999px; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s }
.stage:hover .zoom, .stage:focus-visible .zoom { opacity: 1; transform: none }
@media (hover: none) { .stage .zoom { opacity: 1; transform: none } }
.empty-stage { display: flex; align-items: center; justify-content: center; color: var(--mute); cursor: default }
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 10px }
.st { padding: 0; border: 2px solid var(--line2); border-radius: var(--r-sm); overflow: hidden; aspect-ratio: 16/10; background: #070c0e; cursor: pointer; opacity: .55; transition: opacity .15s, border-color .15s }
.st img { width: 100%; height: 100%; object-fit: cover; display: block }
.st:hover { opacity: .85 }
.st.on { opacity: 1; border-color: var(--c) }

/* Meta panel */
.meta { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 0 }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border-radius: 999px; padding: 4px 12px; margin-bottom: 12px; align-self: flex-start }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--c) }
.meta h1 { margin: 0 0 16px; font-size: clamp(22px, 3.5vw, 32px); line-height: 1.15; font-weight: 800; letter-spacing: -.025em; word-break: break-word }
.price-row { padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 20px }
.price.big { font-size: 28px; letter-spacing: -.02em; margin: 0 }
.desc { color: var(--mute); margin-bottom: 24px; word-break: break-word; line-height: 1.7; font-size: 15px }
.desc-text { white-space: pre-wrap; word-break: break-word }
.desc-toggle { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; background: none; border: none; color: var(--acc); font-size: 14px; font-weight: 600; cursor: pointer; padding: 0; transition: color .15s }
.desc-toggle:hover { color: var(--acc-hover) }
.desc-toggle svg { transition: transform .2s }
.desc-toggle:hover svg { transform: translateY(2px) }

/* Popup mô tả */
.dm { position: fixed; inset: 0; z-index: 110; display: flex; align-items: flex-end; justify-content: center; background: rgba(6,7,10,.7); backdrop-filter: blur(4px); opacity: 0; transition: opacity .2s }
.dm[hidden] { display: none }
.dm.in { opacity: 1 }
.dm-box { width: 100%; max-width: 680px; max-height: 85vh; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r) var(--r) 0 0; display: flex; flex-direction: column; transform: translateY(20px); transition: transform .25s cubic-bezier(.2,.8,.2,1) }
.dm.in .dm-box { transform: none }
.dm-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); flex: none }
.dm-head h2 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.3; flex: 1; margin-right: 12px; word-break: break-word }
.dm-close { background: var(--panel2); border: 1px solid var(--line2); color: var(--mute); border-radius: 50%; width: 32px; height: 32px; font-size: 18px; display: grid; place-items: center; cursor: pointer; flex: none; transition: color .15s, border-color .15s }
.dm-close:hover { color: var(--text); border-color: var(--line2) }
.dm-body { overflow-y: auto; padding: 20px; flex: 1; -webkit-overflow-scrolling: touch }
.dm-body p { margin: 0; white-space: pre-wrap; word-break: break-word; line-height: 1.8; font-size: 15px; color: var(--mute) }
@media (min-width: 560px) {
  .dm { align-items: center }
  .dm-box { border-radius: var(--r); max-height: 80vh }
}
.buy { display: flex; gap: 10px; flex-wrap: wrap }
.buy .btn { padding: 14px 28px; font-size: 15px; font-weight: 700 }
.btn-dl { background: var(--ok); color: #0a1f12; display: inline-flex; align-items: center; gap: 8px }
.btn-dl:hover { background: #7ee8a2; }

/* ---------- Popup xem ảnh ---------- */
.lb { position: fixed; inset: 0; z-index: 100; background: rgba(6,7,10,.94); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s }
.lb[hidden] { display: none }
.lb.in { opacity: 1 }
.lb figure { margin: 0; max-width: min(92vw,1500px); max-height: 88vh; display: flex }
.lb img { max-width: 100%; max-height: 88vh; object-fit: contain; border-radius: var(--r); box-shadow: 0 30px 80px rgba(0,0,0,.6); transform: scale(.97); transition: transform .25s cubic-bezier(.2,.7,.2,1) }
.lb.in img { transform: none }
.lb button { position: absolute; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: #fff; cursor: pointer; border-radius: 50%; width: 44px; height: 44px; font-size: 26px; line-height: 1; display: grid; place-items: center; transition: background .15s }
.lb button:hover { background: rgba(255,255,255,.18) }
.lb-x { top: 18px; right: 18px }
.lb-nav { top: 50%; margin-top: -22px; padding-bottom: 3px }
.lb-nav.prev { left: 18px }
.lb-nav.next { right: 18px }
.lb.single .lb-nav { display: none }
.lb-count { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: var(--mute); font-size: 13px; background: rgba(255,255,255,.07); border-radius: 999px; padding: 3px 14px }
.lb-count:empty { display: none }

/* ---------- Admin ---------- */
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; margin-bottom: 32px }
.box.narrow { max-width: 400px; margin: 56px auto }
.box h2, .box h3 { margin-top: 0 }
.box label { display: block; margin-bottom: 16px; color: var(--mute); font-size: 14px; font-weight: 500 }
.box label input:not([type=checkbox]), .box label textarea, .box label select { margin-top: 6px }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px }
.box .chk { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; cursor: pointer; margin: 6px 0 20px }
.box .chk input { width: 18px; height: 18px; accent-color: var(--hot) }
.bar { display: flex; justify-content: space-between; align-items: center; padding-top: 28px }
.ok { background: rgba(74,222,128,.1); color: var(--ok); padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid rgba(74,222,128,.25) }
.err, .err-msg { background: rgba(255,107,107,.1); color: var(--err); padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid rgba(255,107,107,.25) }
.hint { color: var(--mute); font-size: 13px; margin: 2px 0 12px }
.field .lbl { display: block; color: var(--mute); font-size: 14px; font-weight: 500 }
.imgs { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px }
.imgs:empty { display: none }
.imgs li { position: relative; border: 1px solid var(--line2); border-radius: var(--r); overflow: hidden; background: var(--bg); cursor: grab; transition: border-color .15s, opacity .15s }
.imgs li.cover { border-color: var(--acc); box-shadow: 0 0 0 2px rgba(242,180,64,.3) }
.imgs li.drag { opacity: .4 }
.imgs li.over { border-color: var(--gold) }
.imgs li img { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover }
.imgs li > b { position: absolute; top: 8px; left: 8px; background: var(--acc); color: var(--on-acc); font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 10px }
.ibar { display: flex; gap: 4px; padding: 6px; background: var(--panel2) }
.ibar button { flex: 1; background: var(--bg); border: 1px solid var(--line2); color: var(--text); border-radius: 6px; padding: 3px 0; cursor: pointer; font-size: 14px }
.ibar button:hover { border-color: var(--acc) }
.ibar .mk { flex: 1.6; font-size: 12px }
.ibar .rm:hover { border-color: var(--err); color: var(--err) }
.drop { display: block !important; border: 1.5px dashed var(--line2); border-radius: var(--r); padding: 20px; text-align: center; cursor: pointer; margin-bottom: 18px !important; transition: border-color .15s, background .15s }
.drop:hover, .drop.over { border-color: var(--acc); background: rgba(242,180,64,.06); color: var(--text) }
.listhead { margin-bottom: 12px }
.listhead h3 { margin: 0 }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel) }
.list { width: 100%; border-collapse: collapse; min-width: 640px }
.list th { color: var(--mute); font-weight: 500; font-size: 13px }
.list th, .list td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle }
.list tr:last-child td { border-bottom: 0 }
.list tr.dragging { opacity: .45; background: var(--panel2) }
.grip { width: 32px; color: var(--mute); cursor: grab; font-size: 20px; text-align: center; user-select: none }
.mini { width: 72px; aspect-ratio: 16/10; object-fit: cover; border-radius: 6px; display: block }
.rowtags { display: flex; gap: 8px; align-items: center; margin-top: 4px }
.pinned { font-size: 12px; font-weight: 600; color: var(--hot); background: rgba(255,107,87,.12); border-radius: 999px; padding: 2px 10px }
.act { white-space: nowrap }
.act > * { vertical-align: middle; margin-right: 10px }
.act form { margin: 0; display: inline-flex; gap: 6px }
.ic { background: var(--panel2); border: 1px solid var(--line2); color: var(--text); border-radius: var(--r-sm); padding: 5px 10px; cursor: pointer; font-size: 13px }
.ic:hover { border-color: var(--acc) }
.ic.hot { color: var(--hot); border-color: rgba(255,107,87,.45) }
.link { background: none; border: 0; color: var(--err); cursor: pointer; padding: 0 }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line2); border-radius: 999px; padding: 10px 20px; z-index: 200; font-size: 14px; animation: toastIn .25s both; transition: opacity .4s }
.toast.bad { border-color: var(--err); color: var(--err) }
.toast.out { opacity: 0 }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(8px) } to { opacity: 1; transform: translateX(-50%) translateY(0) } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; gap: 24px }
  .meta { position: static }
  .buy .btn { width: 100%; text-align: center; justify-content: center }
}

@media (max-width: 560px) {
  .top .wrap { height: 58px }
  .logo { font-size: 14px; gap: 8px }
  .nav { gap: 0 }
  .nav > a, .dd-btn { padding: 7px 8px; font-size: 13px }
  .dd-menu { position: fixed; left: 12px; right: 12px; top: 66px; width: auto }
  .hero { padding-top: 36px }
  .hero p { font-size: 14px }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px }
  .info h3 { font-size: 13px }
  .info { padding: 10px 2px 4px }
  .row2 { grid-template-columns: 1fr }
  .lb-nav { display: none }
  .strip { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px }
}
@media (max-width: 400px) { .logo { font-size: 0; gap: 0 } .logo .mark { font-size: 12px } }
@media (max-width: 380px) { .grid { grid-template-columns: 1fr } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important } }
