/* Tu Tiên · iOSVN — phong cách thủy mặc, sơn mài, ấn triện */
@font-face { font-family: "Serif VN"; font-weight: 400; font-display: swap; src: url(fonts/noto-serif-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Serif VN"; font-weight: 400; font-display: swap; src: url(fonts/noto-serif-vietnamese-400-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Serif VN"; font-weight: 700; font-display: swap; src: url(fonts/noto-serif-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Serif VN"; font-weight: 700; font-display: swap; src: url(fonts/noto-serif-vietnamese-700-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Display VN"; font-weight: 700; font-display: swap; src: url(fonts/noto-serif-display-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F; }
@font-face { font-family: "Display VN"; font-weight: 700; font-display: swap; src: url(fonts/noto-serif-display-vietnamese-700-normal.woff2) format("woff2"); unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Thu Phap"; font-display: block; src: url(fonts/thu-phap.woff2) format("woff2"); }

:root {
  --ink: #0a0c10;
  --lacquer: rgba(20, 23, 29, .88);
  --lacquer-2: rgba(30, 33, 40, .92);
  --gold: #d6b06a;
  --gold-2: #f1d99a;
  --gold-line: rgba(214, 176, 106, .32);
  --gold-soft: rgba(214, 176, 106, .12);
  --jade: #5ec2a2;
  --jade-2: #9be3c8;
  --cinnabar: #b3261e;
  --cinnabar-2: #e0564a;
  --paper: #efe6d2;
  --muted: #9a927f;
  --line: rgba(239, 230, 210, .09);
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --serif: "Serif VN", "Noto Serif", Georgia, "Times New Roman", serif;
  --display: "Display VN", "Serif VN", Georgia, serif;
  --brush: "Thu Phap", "Ma Shan Zheng", "STKaiti", "KaiTi", serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; color: var(--paper); font: 15px/1.5 var(--serif); }
html { background: var(--ink); }
body {
  min-height: 100vh; overscroll-behavior: none;
  background:
    radial-gradient(circle at 86% 7%, rgba(241, 217, 154, .16) 0, rgba(241, 217, 154, .05) 42px, transparent 120px),
    radial-gradient(ellipse at 50% -10%, rgba(94, 194, 162, .10), transparent 55%),
    linear-gradient(180deg, #0c1016 0%, #0a0c10 60%, #08090c 100%);
  background-attachment: fixed;
}
/* núi xa thủy mặc */
body::before {
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 42vh; z-index: -1; pointer-events: none; opacity: .9;
  background:
    linear-gradient(180deg, transparent 0%, rgba(8, 9, 12, .0) 40%, rgba(8, 9, 12, .85) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 200' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23283240'/%3E%3Cstop offset='1' stop-color='%230d1015'/%3E%3C/linearGradient%3E%3ClinearGradient id='b' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%231b222c'/%3E%3Cstop offset='1' stop-color='%230a0c10'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 200V96c18-10 30-34 46-30s22 30 40 24 26-50 48-58 30 38 52 40 30-22 50-18 24 34 44 30 30-40 52-44 34 30 48 34 14-8 20-10V200z' fill='url(%23a)' opacity='.55'/%3E%3Cpath d='M0 200v-58c22-2 34-26 60-22s36 30 62 26 40-34 66-30 30 30 56 30 38-24 62-20 34 26 56 22c16-3 26-12 38-14V200z' fill='url(%23b)'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
}
/* linh khí trôi */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 30%, rgba(155, 227, 200, .7), transparent),
    radial-gradient(1.5px 1.5px at 72% 18%, rgba(241, 217, 154, .6), transparent),
    radial-gradient(1px 1px at 40% 62%, rgba(155, 227, 200, .6), transparent),
    radial-gradient(1.5px 1.5px at 88% 54%, rgba(241, 217, 154, .5), transparent),
    radial-gradient(1px 1px at 22% 80%, rgba(155, 227, 200, .5), transparent),
    radial-gradient(1px 1px at 60% 40%, rgba(241, 217, 154, .5), transparent);
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift { from { transform: translateY(0); } to { transform: translateY(-26px); } }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
.hidden { display: none !important; }
.brush { font-family: var(--brush); font-weight: 400; line-height: 1; }

/* Ấn triện và ô chữ */
.seal { display: inline-grid; place-items: center; font-family: var(--display), var(--serif); font-weight: 700; line-height: 1; color: #fbeedd; background: radial-gradient(circle at 30% 25%, #cf3a2f, var(--cinnabar) 60%, #8e1c15); border-radius: 6px; box-shadow: inset 0 0 0 2px rgba(251, 238, 221, .28), 0 2px 10px rgba(179, 38, 30, .35); text-align: center; }
.seal.lg { width: 92px; height: 92px; font-size: 24px; letter-spacing: 1px; border-radius: 10px; transform: rotate(-4deg); }
.seal.md { width: 44px; height: 44px; font-size: 15px; border-radius: 6px; transform: rotate(-3deg); }
.seal.sm { width: auto; min-width: 26px; height: 26px; padding: 0 5px; font-size: 11px; border-radius: 4px; }
.seal.gold { color: #2a1a06; background: radial-gradient(circle at 30% 25%, #fff0bf, var(--gold) 60%, #9c7430); box-shadow: inset 0 0 0 2px rgba(42, 26, 6, .25), 0 2px 12px rgba(214, 176, 106, .4); }
.seal.jade { color: #0b231c; background: radial-gradient(circle at 30% 25%, #c8f5e4, var(--jade) 60%, #2f7d66); box-shadow: inset 0 0 0 2px rgba(11, 35, 28, .25), 0 2px 12px rgba(94, 194, 162, .35); }
.gl { --el: var(--gold-2); --el-bg: rgba(214, 176, 106, .12); width: 42px; height: 42px; flex: none; display: grid; place-items: center; font-family: var(--display), var(--serif); font-weight: 700; font-size: 13.5px; line-height: 1; color: var(--el); background: radial-gradient(circle at 50% 40%, var(--el-bg), rgba(0, 0, 0, .15) 75%); border: 1px solid var(--line); border-radius: 12px; text-shadow: 0 0 12px var(--el-bg); text-align: center; }
.monster-glyph { font-size: 24px; font-family: initial; }
.he-kim { --el: #f0cf6c; --el-bg: rgba(240, 207, 108, .2); }
.he-moc { --el: #7fd08a; --el-bg: rgba(127, 208, 138, .18); }
.he-thuy { --el: #64b5f0; --el-bg: rgba(100, 181, 240, .2); }
.he-hoa { --el: #f07a4e; --el-bg: rgba(240, 122, 78, .2); }
.he-tho { --el: #d0a16a; --el-bg: rgba(208, 161, 106, .2); }
.he-loi { --el: #b69cff; --el-bg: rgba(182, 156, 255, .22); }
.he-phong { --el: #86e0cc; --el-bg: rgba(134, 224, 204, .18); }
.he-bang { --el: #b4e6ff; --el-bg: rgba(180, 230, 255, .2); }

/* Viền phẩm cấp */
.r-pham, .r-pt { --rar: #a9a391; }
.r-hoang, .r-hiem { --rar: #7fd08a; }
.r-huyen, .r-cuchiem { --rar: #64b5f0; }
.r-dia, .r-tt { --rar: #b69cff; }
.r-thien { --rar: #f0a24e; }
.r-tien, .r-docban { --rar: #ff6a5c; }
.item[class*="r-"] { border-left: 3px solid var(--rar); }
.item[class*="r-"] .gl { --el: var(--rar); }
.item.r-tien, .item.r-docban { box-shadow: 0 0 18px rgba(255, 106, 92, .18), inset 0 0 0 1px rgba(255, 106, 92, .25); }
.item.r-thien, .item.r-tt { box-shadow: 0 0 14px rgba(240, 162, 78, .12); }
.rar { font-size: 11px; color: var(--rar, var(--muted)); letter-spacing: .3px; }

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); gap: 16px; padding: 24px; }

/* Đầu trang */
.top { position: sticky; top: 0; z-index: 5; padding: 12px 16px 10px; background: linear-gradient(180deg, rgba(12, 15, 20, .98), rgba(12, 15, 20, .9)); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--gold-line); }
.top::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .6; }
.top-row { display: flex; align-items: center; gap: 12px; }
.who { flex: 1; min-width: 0; }
.name { font-family: var(--display); font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name .brush { font-size: 15px; color: var(--muted); margin-left: 4px; }
.realm { font-size: 13px; color: var(--gold-2); letter-spacing: .2px; }
.realm b { background: linear-gradient(180deg, #fff1c4, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.power { text-align: right; line-height: 1.1; }
.power .brush { font-size: 14px; color: var(--muted); display: block; margin-bottom: 2px; }
.power b { font-family: var(--display); font-size: 20px; color: var(--gold-2); }
.xp { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12px; color: var(--muted); }
.xp .brush { color: var(--jade-2); font-size: 16px; }
.bar { position: relative; flex: 1; height: 8px; border-radius: 99px; background: rgba(0, 0, 0, .45); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.bar > i { position: relative; display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2c8c73, var(--jade), var(--jade-2)); transition: width .3s; overflow: hidden; }
.bar > i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent); transform: translateX(-100%); animation: shine 2.8s ease-in-out infinite; }
@keyframes shine { to { transform: translateX(100%); } }
.bar.hp > i { background: linear-gradient(90deg, #7d1a14, var(--cinnabar), var(--cinnabar-2)); }
.bar.mp > i { background: linear-gradient(90deg, #1f4f86, #3f84cc, #7fbef0); }
.bar.shield > i { background: linear-gradient(90deg, #8c7a4c, var(--gold), var(--gold-2)); }
.meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 4px; border-radius: 999px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); font-size: 12px; color: var(--muted); white-space: nowrap; }
.pill .brush { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--gold-soft); color: var(--gold-2); font-size: 13px; }
.pill b { color: var(--paper); font-weight: 700; }
.pill.bad { color: #ffb4a8; border-color: rgba(224, 86, 74, .4); }
.pill.bad .brush { background: rgba(179, 38, 30, .35); color: #ffd2c9; }

/* Bố cục */
main { padding: 16px 16px calc(92px + var(--safe-bottom)); }
h2 { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 16px; font-weight: 700; margin: 22px 0 12px; color: var(--gold-2); letter-spacing: .5px; }
h2::before, h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-line)); }
h2::after { background: linear-gradient(90deg, var(--gold-line), transparent); }
h2:first-child { margin-top: 2px; }
h2 .brush { font-size: 20px; color: var(--gold); }
.card { position: relative; background: var(--lacquer); border: 1px solid var(--gold-line); border-radius: var(--radius); padding: 14px 16px; box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .25), inset 0 0 0 4px rgba(214, 176, 106, .08); }
.card::before, .card::after { content: ""; position: absolute; width: 12px; height: 12px; border: 1px solid var(--gold); opacity: .7; pointer-events: none; }
.card::before { top: 5px; left: 5px; border-right: 0; border-bottom: 0; border-top-left-radius: 4px; }
.card::after { bottom: 5px; right: 5px; border-left: 0; border-top: 0; border-bottom-right-radius: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { display: flex; align-items: center; gap: 8px; background: var(--lacquer); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.stat .brush { font-size: 20px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; text-align: center; flex-shrink: 0; }
.stat .stat-info { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.stat small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; }
.stat b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 0; }
.list { display: grid; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--lacquer); border: 1px solid var(--line); border-radius: 12px; text-align: left; width: 100%; }
.item:active { background: var(--lacquer-2); }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 12px; color: var(--muted); line-height: 1.45; }
.qty { font-size: 12px; color: var(--gold-2); font-weight: 700; }
.tag { display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 99px; background: rgba(0, 0, 0, .35); color: var(--muted); border: 1px solid var(--line); vertical-align: 1px; font-weight: 400; }
.tag.warn { color: #ffb4a8; border-color: rgba(224, 86, 74, .45); background: rgba(179, 38, 30, .15); }
.tag.good { color: var(--jade-2); border-color: rgba(94, 194, 162, .45); background: rgba(94, 194, 162, .1); }
.tag.gold { color: var(--gold-2); border-color: var(--gold-line); background: var(--gold-soft); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--lacquer-2); border: 1px solid var(--gold-line); font-weight: 700; letter-spacing: .2px; }
.btn.primary { color: #2a1a06; border-color: transparent; background: linear-gradient(180deg, #f6e0a4, var(--gold) 55%, #b58a3e); box-shadow: 0 4px 18px rgba(214, 176, 106, .25), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn.danger { background: rgba(179, 38, 30, .14); color: #ffb4a8; border-color: rgba(224, 86, 74, .45); }
.btn.sm { padding: 8px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .4; }
.btns { display: grid; gap: 8px; margin-top: 14px; }
.note { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.55; }

/* Thanh tab */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(9, 1fr); padding: 5px 1px calc(5px + var(--safe-bottom)); background: linear-gradient(180deg, rgba(14, 16, 21, .94), rgba(9, 10, 13, .99)); border-top: 1px solid var(--gold-line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tabs button { position: relative; background: none; padding: 3px 0 2px; font-size: 9px; color: var(--muted); display: grid; justify-items: center; gap: 1px; min-width: 0; }
.tabs button .brush { font-size: 17px; color: #6f6a5d; transition: color .2s, text-shadow .2s; }
.tabs button.on { color: var(--gold-2); font-weight: 700; }
.tabs button.on .brush { color: var(--gold-2); text-shadow: 0 0 14px rgba(241, 217, 154, .55); }
.tabs button.on::before { content: ""; position: absolute; top: -6px; width: 16px; height: 2px; border-radius: 2px; background: var(--cinnabar-2); box-shadow: 0 0 10px var(--cinnabar-2); }

/* Tạo nhân vật */
.intro { text-align: center; padding: 10px 0 4px; display: grid; justify-items: center; gap: 6px; }
.intro .title { font-family: var(--display); font-size: 26px; font-weight: 700; margin: 8px 0 0; background: linear-gradient(180deg, #fff1c4, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: 1px; }
.intro .sub { font-family: var(--brush); font-size: 20px; color: var(--muted); letter-spacing: 8px; }
.halo { position: relative; display: grid; place-items: center; width: 132px; height: 132px; }
.halo::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1px dashed rgba(214, 176, 106, .45); animation: spin 40s linear infinite; }
.halo::after { content: ""; position: absolute; inset: 12px; border-radius: 50%; border: 1px solid rgba(94, 194, 162, .3); box-shadow: 0 0 40px rgba(94, 194, 162, .15), inset 0 0 30px rgba(94, 194, 162, .08); }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { display: flex; gap: 10px; justify-content: center; margin: 14px 0 18px; }
.steps i { width: 9px; height: 9px; transform: rotate(45deg); border: 1px solid var(--gold-line); background: transparent; }
.steps i.on { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 10px rgba(214, 176, 106, .6); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--radius); background: var(--lacquer); border: 1px solid var(--line); text-align: left; transition: border-color .2s, box-shadow .2s; }
.choice .gl { width: 44px; height: 44px; font-size: 30px; }
.choice.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset, 0 0 22px rgba(214, 176, 106, .15); background: linear-gradient(180deg, rgba(214, 176, 106, .08), var(--lacquer)); }
.choice b { display: block; font-size: 15px; }
.choice small { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 2px; }
.reveal { text-align: center; display: grid; justify-items: center; gap: 4px; }
.reveal .big { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--gold-2); margin: 2px 0 6px; }
.tablets { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 6px 0; }
.tablet { padding: 7px 12px; border-radius: 8px; background: linear-gradient(180deg, rgba(94, 194, 162, .16), rgba(94, 194, 162, .06)); border: 1px solid rgba(94, 194, 162, .4); color: var(--jade-2); font-weight: 700; font-size: 13px; }

/* Trang bị */
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slot { display: flex; gap: 10px; align-items: center; min-height: 70px; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, .28); border: 1px dashed rgba(214, 176, 106, .25); text-align: left; }
.slot.filled { border-style: solid; background: var(--lacquer); }
.slot .gl { width: 38px; height: 38px; font-size: 24px; }
.slot .ghost { opacity: .35; }
.slot small { color: var(--muted); font-size: 11px; display: block; }
.slot b { display: block; font-size: 13.5px; line-height: 1.3; }
.slot .s { font-size: 11.5px; color: var(--muted); }
.segment { display: grid; grid-template-columns: 1fr 1fr; background: rgba(0, 0, 0, .35); border: 1px solid var(--gold-line); border-radius: 12px; padding: 3px; margin: 14px 0 10px; }
.segment button { padding: 8px; border-radius: 9px; background: none; color: var(--muted); font-weight: 700; }
.segment button.on { background: linear-gradient(180deg, rgba(214, 176, 106, .2), rgba(214, 176, 106, .08)); color: var(--gold-2); }

/* Kỹ năng */
.skillbar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sk { min-height: 86px; padding: 8px 3px 6px; border-radius: 12px; background: rgba(0, 0, 0, .28); border: 1px dashed rgba(214, 176, 106, .25); font-size: 10.5px; text-align: center; display: grid; justify-items: center; align-content: start; gap: 4px; }
.sk.filled { border-style: solid; background: var(--lacquer); border-color: var(--rar, var(--gold-line)); }
.sk .gl { width: 34px; height: 34px; font-size: 21px; border-radius: 50%; --el: var(--rar, var(--gold-2)); }
.sk b { font-size: 11px; line-height: 1.25; }

/* Săn yêu */
.monster .gl { border-radius: 50%; width: 46px; height: 46px; font-size: 28px; box-shadow: 0 0 0 1px var(--el-bg), 0 0 16px var(--el-bg); }
.item.off { opacity: .45; }

/* Trận đấu */
.battle { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; padding: 12px 14px calc(12px + var(--safe-bottom)); background: radial-gradient(circle at 50% 22%, rgba(179, 38, 30, .16), transparent 45%), linear-gradient(180deg, #0d0f14, #07080a); }
.foe { text-align: center; }
.foe .fname { font-family: var(--display); font-size: 19px; font-weight: 700; }
.foe .fsub { font-size: 12px; color: var(--muted); }
.arena { position: relative; width: 150px; height: 150px; margin: 8px auto 4px; display: grid; place-items: center; }
.arena .ring { position: absolute; inset: 0; border-radius: 50%; border: 1px dashed var(--el, var(--gold)); opacity: .45; animation: spin 24s linear infinite; }
.arena .ring.r2 { inset: 16px; border-style: solid; opacity: .25; animation-duration: 16s; animation-direction: reverse; }
.arena .ring.r3 { inset: 32px; border: 1px dotted var(--el, var(--gold)); opacity: .5; animation-duration: 10s; }
.arena .core { font-family: var(--display), sans-serif; font-size: 58px; line-height: 1; color: var(--el, var(--gold-2)); text-shadow: 0 0 24px var(--el-bg, rgba(214, 176, 106, .4)), 0 0 6px var(--el-bg); transition: transform .1s, color .1s; display: grid; place-items: center; }
.arena.hit .core { transform: scale(.88) rotate(-6deg); color: #fff; }
.arena.stun .ring { animation-play-state: paused; }
.arena.dead { opacity: .35; filter: grayscale(1); }
.warnbar { margin: 6px auto 0; padding: 8px 12px; border-radius: 10px; background: rgba(179, 38, 30, .22); border: 1px solid rgba(224, 86, 74, .7); color: #ffd2c9; font-weight: 700; font-size: 13.5px; text-align: center; animation: pulse .45s infinite alternate; display: flex; align-items: center; justify-content: center; gap: 8px; }
@keyframes pulse { from { opacity: .7; box-shadow: 0 0 0 rgba(224, 86, 74, 0); } to { opacity: 1; box-shadow: 0 0 22px rgba(224, 86, 74, .45); } }
.status { font-size: 12px; color: var(--muted); text-align: center; min-height: 18px; margin-top: 4px; }
.me { margin-top: auto; }
.me .bar { flex: none; margin-top: 6px; }
.log { position: relative; font-size: 12px; color: var(--muted); flex: 1; min-height: 60px; max-height: 120px; overflow: hidden; margin: 8px 0; display: flex; flex-direction: column; justify-content: flex-end; -webkit-mask-image: linear-gradient(180deg, transparent, #000 45%); mask-image: linear-gradient(180deg, transparent, #000 45%); }
.log div:last-child { color: var(--paper); }
.pad { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin-top: 10px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.pad button { position: relative; overflow: hidden; border-radius: 12px; background: var(--lacquer); border: 1px solid var(--line); padding: 6px 3px; font-size: 11px; font-weight: 700; min-height: 50px; line-height: 1.2; display: grid; place-items: center; align-content: center; gap: 3px; }
.pad button .brush { font-size: 20px; }
.pad .attack { grid-column: span 6; min-height: 82px; font-size: 13px; background: radial-gradient(circle at 50% 30%, #6b1c15, #3a0f0b 75%); border-color: rgba(224, 86, 74, .6); box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .25), 0 0 20px rgba(179, 38, 30, .2); }
.pad .attack .brush { font-size: 32px; color: #ffe2d6; text-shadow: 0 0 16px rgba(255, 120, 100, .6); }
.pad .dodge { grid-column: span 4; min-height: 82px; font-size: 13px; background: radial-gradient(circle at 50% 30%, #173a52, #0c1c29 75%); border-color: rgba(100, 181, 240, .5); }
.pad .dodge .brush { font-size: 30px; color: #d6ecff; text-shadow: 0 0 14px rgba(100, 181, 240, .6); }
.pad .skill { grid-column: span 2; min-height: 64px; border-color: var(--rar, var(--line)); }
.pad .skill .brush { color: var(--rar, var(--gold-2)); font-size: 18px; }
.pad .skill.escape { box-shadow: inset 0 0 0 1px rgba(94, 194, 162, .35); }
.pad .skill.big { box-shadow: inset 0 0 0 1px rgba(214, 176, 106, .35); }
.pad .skill .nm { font-size: 10px; line-height: 1.15; max-height: 2.3em; overflow: hidden; }
.pad .itm { grid-column: span 4; grid-auto-flow: column; gap: 6px; }
.pad .itm .brush { font-size: 16px; color: var(--jade-2); }
.pad .flee { grid-column: span 2; color: #ffb4a8; }
.pad .flee .brush { font-size: 18px; }
.pad button .cd { position: absolute; inset: 0; background: rgba(5, 6, 8, .72); display: grid; place-items: center; font-size: 15px; color: #fff; font-family: var(--display); }
.pad button.locked::after { content: "🔒"; font-family: initial; position: absolute; top: 3px; right: 6px; font-size: 12px; color: #ffb4a8; }
.pad button:active:not(:disabled) { transform: scale(.97); }
.float { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--gold-2); pointer-events: none; animation: rise .8s forwards; text-shadow: 0 2px 10px #000, 0 0 16px rgba(214, 176, 106, .5); z-index: 25; white-space: nowrap; }
.float.crit { color: #ff8a6b; font-size: 32px; }
@keyframes rise { from { opacity: 1; transform: translate(-50%, 0) scale(1.1); } to { opacity: 0; transform: translate(-50%, -46px) scale(1); } }
.result { text-align: center; display: grid; justify-items: center; gap: 6px; }
.result .big { font-family: var(--display); font-size: 22px; font-weight: 700; }
.result .card { text-align: left; width: 100%; }
.result .card div + div { margin-top: 3px; }

/* PVP và Đạo Lữ, Tông Môn bổ sung */
.duel-log { max-height: 200px; overflow-y: auto; background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 12.5px; line-height: 1.6; margin: 10px 0; }
.duel-turn { padding: 4px 0; border-bottom: 1px dashed rgba(255,255,255,.06); }
.duel-turn:last-child { border-bottom: none; }
.duel-turn.crit { color: #ff9b82; font-weight: 700; }
.comp-banner { padding: 14px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(230,120,150,.18), rgba(20,23,29,.9)); border: 1px solid rgba(230,120,150,.35); margin-bottom: 14px; }
.comp-avatar { font-size: 36px; line-height: 1; margin-bottom: 4px; }

/* Bảng và cửa hàng */
.lb { display: grid; gap: 7px; }
.rank { width: 32px; height: 32px; flex: none; display: grid; place-items: center; font-family: var(--display); font-weight: 700; color: var(--muted); border-radius: 50%; border: 1px solid var(--line); }
.rank.top { color: #fbeedd; border: 0; background: radial-gradient(circle at 30% 25%, #cf3a2f, var(--cinnabar) 60%, #8e1c15); box-shadow: 0 0 12px rgba(179, 38, 30, .4); }
.rank.top.g1 { background: radial-gradient(circle at 30% 25%, #fff0bf, var(--gold) 60%, #9c7430); color: #2a1a06; box-shadow: 0 0 14px rgba(214, 176, 106, .5); }
.price { color: var(--gold-2); font-weight: 700; font-size: 12.5px; }
.shop-row { display: flex; gap: 6px; flex: none; }

/* Bảng trượt và thông báo */
.sheet { position: fixed; inset: 0; z-index: 30; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .62); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.sheet-body { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86vh; overflow: auto; background: linear-gradient(180deg, #171a20, #0f1115); border-top: 1px solid var(--gold); border-radius: 20px 20px 0 0; padding: 22px 16px calc(18px + var(--safe-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .6); animation: up .22s ease-out; }
.sheet-body::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--gold-line); }
@keyframes up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet h2 { margin-top: 0; }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%); z-index: 40; background: rgba(22, 25, 31, .97); border: 1px solid var(--gold-line); padding: 10px 16px; border-radius: 12px; max-width: 88vw; text-align: center; box-shadow: 0 8px 28px rgba(0, 0, 0, .6); font-size: 14px; }
.toast.err { border-color: rgba(224, 86, 74, .6); color: #ffcfc6; }

/* Ô nhập, bộ lọc */
.field { display: grid; gap: 6px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.field input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--gold-line); background: rgba(0, 0, 0, .4); color: var(--paper); font: 700 17px var(--serif); outline: none; }
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(214, 176, 106, .15); }
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.chip.on { color: var(--gold-2); border-color: var(--gold-line); background: var(--gold-soft); }

/* Tổ đội trong trận */
.team { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 6px; margin-top: 8px; }
.mate { font-size: 11px; color: var(--muted); padding: 5px 8px; border-radius: 10px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); }
.mate.me { border-color: var(--gold-line); color: var(--gold-2); }
.mate.out { opacity: .45; }
.mate .bar { height: 5px; margin-top: 3px; }
.pad.out { opacity: .35; pointer-events: none; }
.code { font-family: var(--display); letter-spacing: 3px; color: var(--gold-2); font-size: 17px; }

/* Avatar trên cùng & Hồ sơ */
.top-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); box-shadow: 0 0 10px rgba(214,176,106,.3); flex: none; }
.top-avatar-fallback { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 30% 25%, #cf3a2f, var(--cinnabar) 60%, #8e1c15); border: 2px solid var(--gold); font-size: 20px; flex: none; box-shadow: 0 0 10px rgba(214,176,106,.3); color: #fff; }

/* Khí huyết & Trị thương */
.hp-status-bar { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; }
.heal-actions { display: flex; gap: 8px; margin-top: 8px; }

/* Thú triều & Khóa giao chiến */
.beast-banner { background: linear-gradient(135deg, rgba(220,50,50,.25), rgba(40,10,15,.9)); border: 1px solid rgba(240,80,80,.6); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; animation: pulse-border 2s infinite alternate; }
@keyframes pulse-border { from { border-color: rgba(240,80,80,.4); box-shadow: 0 0 8px rgba(240,80,80,.2); } to { border-color: rgba(255,100,100,.9); box-shadow: 0 0 18px rgba(240,80,80,.5); } }
.lock-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; background: rgba(200,40,40,.25); border: 1px solid rgba(240,80,80,.5); color: #ffb4a8; font-size: 11px; font-weight: 700; }

/* Hồ sơ tu sĩ modal */
.profile-stat-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.profile-stat-row:last-child { border-bottom: none; }
.profile-stat-row b { color: var(--gold-2); }
.profile-stat-group { margin-top: 12px; padding: 10px 14px; background: rgba(0,0,0,.3); border-radius: 12px; border: 1px solid var(--line); }

/* Thành Trấn & Bản Đồ */
.town-grid { display: grid; gap: 10px; margin-top: 10px; }
.town-card { background: var(--lacquer); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; position: relative; }
.town-card.current { border-color: var(--gold); box-shadow: 0 0 12px rgba(214,176,106,.25); }
.travel-progress { background: linear-gradient(135deg, rgba(80,140,220,.2), rgba(15,20,30,.95)); border: 1px solid rgba(100,180,255,.4); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }

