/* Odinz — vàng trên đen. Góc vát lấy từ hình tam giác của logo. */
:root {
  color-scheme: dark;
  --bg: #000;
  --wash: rgba(212, 165, 43, .05);
  --wash-2: rgba(212, 165, 43, .1);
  --line: rgba(212, 165, 43, .22);
  --line-strong: rgba(212, 165, 43, .5);
  --gold: #d4a52b;
  --gold-hi: #f2c94c;
  --gold-lo: #7a5f14;
  --text: #efe6cf;
  --muted: #9b927c;
  --danger: #e26d5a;
  --ok: #8fc36b;
  --font-display: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Be Vietnam Pro', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --chamfer: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 15px/1.6 var(--font-body);
}
a { color: var(--gold-hi); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: .01em; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.tnum { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Nút ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  min-height: 44px; padding: 0 20px; border: 1px solid var(--line-strong); background: transparent;
  color: var(--gold-hi); font-weight: 600; text-decoration: none !important;
}
.btn:hover { background: var(--wash-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: var(--gold); border-color: var(--gold); color: #000;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--chamfer)), calc(100% - var(--chamfer)) 100%, 0 100%);
}
.btn-primary:hover { background: var(--gold-hi); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(226, 109, 90, .12); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 13px; }

/* ── Đầu trang ── */
.top { border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 14px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 20px var(--font-display); color: var(--gold-hi); }
.brand img { width: 34px; height: 34px; border: 1px solid var(--line); }
.brand:hover { text-decoration: none; }
.crumb { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--muted); }
.crumb a { color: var(--muted); }
.crumb strong { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .grow { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; }
.me img { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); }
.me .name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbtn { white-space: nowrap; background: none; border: 0; padding: 6px 0; cursor: pointer; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--gold-hi); }

.tabs { border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .wrap { display: flex; gap: 4px; }
.tabs a {
  flex: none; padding: 14px 16px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current='page'] { color: var(--gold-hi); border-bottom-color: var(--gold); }

main.wrap { padding-top: 32px; padding-bottom: 120px; }
.page-title { font-size: 28px; margin-bottom: 6px; }
.page-sub { color: var(--muted); margin-bottom: 28px; max-width: 62ch; }
.section { margin-top: 40px; }
.section > h2 { font-size: 19px; margin-bottom: 4px; }
.section > .hint { color: var(--muted); margin-bottom: 16px; max-width: 62ch; }

/* ── Danh sách dòng ── */
.rows { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.row .body { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .desc { color: var(--muted); font-size: 14px; max-width: 64ch; }
.row.link { color: inherit; }
.row.link:hover { background: var(--wash); text-decoration: none; }
.guild-icon { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); background: var(--wash); font: 600 18px var(--font-display); color: var(--gold); overflow: hidden; }
.guild-icon img { width: 100%; height: 100%; object-fit: cover; }

/* ── Công tắc ── */
.switch { position: relative; flex: none; width: 52px; height: 30px; padding: 0; border: 1px solid var(--line-strong); border-radius: 15px; background: transparent; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch[aria-checked='true'] { background: var(--gold); border-color: var(--gold); }
.switch[aria-checked='true']::after { transform: translateX(22px); background: #000; }
.switch:disabled { opacity: .45; cursor: not-allowed; }

/* ── Mục bảo vệ ── */
.prot { padding: 20px 0; border-bottom: 1px solid var(--line); }
.prot .head { display: flex; align-items: flex-start; gap: 16px; }
.prot .head .body { flex: 1; min-width: 0; }
.prot .settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 18px; margin-top: 16px; padding-left: 14px; border-left: 2px solid var(--gold-lo); }
.prot.off .settings { opacity: .55; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field .unit { font-size: 12px; color: var(--muted); margin-top: 4px; }
.input, select.input {
  width: 100%; min-height: 42px; padding: 0 12px; background: #000; border: 1px solid var(--line-strong); border-radius: 0; color: var(--text);
}
.input.invalid { border-color: var(--danger); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border: 1px solid var(--line); background: var(--wash); font-size: 13px; font-variant-numeric: tabular-nums; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 6px; font-size: 16px; line-height: 1; }
.chip button:hover { color: var(--danger); }
.addrow { display: flex; gap: 8px; }
.field.wide { grid-column: 1 / -1; }

/* ── Cảnh báo / trạng thái ── */
.notice { padding: 14px 16px; border: 1px solid var(--danger); background: rgba(226, 109, 90, .08); margin-bottom: 24px; }
.notice strong { color: var(--danger); }
.notice.gold { border-color: var(--line-strong); background: var(--wash); }
.notice.gold strong { color: var(--gold-hi); }
.state { padding: 48px 0; color: var(--muted); }

/* ── Tổng quan ── */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.kv > div { padding: 14px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kv .k { color: var(--muted); font-size: 13px; }
.kv .v { font: 600 22px var(--font-display); color: var(--gold-hi); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font: 11px var(--font-body); }
.chart .axis { stroke: var(--line); }
.chart .bar-join { fill: var(--gold-lo); }
.chart .bar-auto { fill: var(--gold-hi); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; }
.legend .j { background: var(--gold-lo); }
.legend .a { background: var(--gold-hi); }
.stat-table { display: grid; grid-template-columns: 1fr auto auto; border-top: 1px solid var(--line); }
.stat-table > * { padding: 10px 0; border-bottom: 1px solid var(--line); }
.stat-table .h { color: var(--muted); font-size: 13px; text-align: right; padding-left: 24px; }
.stat-table .h:first-child { text-align: left; padding-left: 0; }
.stat-table .n { text-align: right; padding-left: 24px; font-variant-numeric: tabular-nums; }
.stat-table .zero { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── Cảnh cáo ── */
.person { border-bottom: 1px solid var(--line); padding: 16px 0; }
.person .who { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.person .who img, .person .who .ph { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--wash); }
.person .who .count { margin-left: auto; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.warn { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0 8px 48px; font-size: 14px; }
.warn .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.warn .meta { color: var(--muted); font-size: 12px; }

/* ── Thanh lưu + thông báo ── */
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #000; border-top: 1px solid var(--gold);
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
}
.savebar .wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.savebar .msg { flex: 1; min-width: 160px; }
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px);
  padding: 12px 18px; background: #000; border: 1px solid var(--gold); color: var(--text); opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.toast.err { border-color: var(--danger); }

/* ── Trang chủ ── */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero .wrap { position: relative; z-index: 1; padding-top: 72px; padding-bottom: 80px; }
.hero h1 { font-size: clamp(44px, 9vw, 84px); max-width: 11ch; margin-bottom: 20px; }
.hero p.lead { font-size: 18px; max-width: 46ch; color: var(--text); margin-bottom: 32px; }
.hero .actions { margin-bottom: 36px; }
.hero-logo {
  position: absolute; z-index: 0; right: -6%; top: 50%; width: min(60vw, 520px); transform: translateY(-50%); opacity: .55; pointer-events: none;
  animation: rise 1.6s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes rise { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
.live { display: flex; flex-wrap: wrap; gap: 8px 28px; color: var(--muted); font-size: 14px; }
.live b { color: var(--gold-hi); font-weight: 600; font-variant-numeric: tabular-nums; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 48px; margin-top: 8px; }
.features > div { padding: 16px 0; border-bottom: 1px solid var(--line); }
.features dt { font-weight: 600; margin-bottom: 4px; }
.features dd { margin: 0; color: var(--muted); font-size: 14px; }
.foot { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 14px; }

@media (max-width: 560px) {
  main.wrap { padding-top: 24px; }
  .page-title { font-size: 24px; }
  .me .name { display: none; }
  .crumb a { display: none; }
  .warn { padding-left: 0; }
  .hero .wrap { padding-top: 48px; padding-bottom: 56px; }
  .hero-logo { opacity: .28; right: -22%; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-logo { animation: none; }
  .switch::after, .toast { transition: none; }
}

/* ── Trang xác minh ── */
.vwrap { max-width: 520px; }
.vcard { border: 1px solid var(--line); background: var(--wash); padding: 28px 24px; clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--chamfer)), calc(100% - var(--chamfer)) 100%, 0 100%); }
.vcard > * + * { margin-top: 18px; }
.vhead { display: flex; align-items: center; gap: 14px; }
.vtitle { font-size: 22px; margin-bottom: 2px; }
.vp { max-width: 56ch; }
.vmsg { min-height: 1.6em; color: var(--gold-hi); }
.captcha-img { display: block; width: 100%; max-width: 360px; height: auto; border: 1px solid var(--line-strong); background: #000; image-rendering: auto; }
.vform { display: flex; gap: 10px; flex-wrap: wrap; }
.codein { flex: 1; min-width: 160px; text-transform: uppercase; letter-spacing: .35em; font: 600 20px var(--font-display); text-align: center; }
.notes > p + p { margin-top: 6px; }
.notes { margin-top: 16px; }
@media (max-width: 560px) { .vcard { padding: 22px 16px; } }
