:root {
  --bg: #140e0a;
  --bg2: #1d150f;
  --panel: rgba(38, 27, 19, .9);
  --panel2: rgba(52, 37, 26, .92);
  --line: rgba(217, 170, 90, .16);
  --line2: rgba(232, 184, 74, .42);
  --text: #f3e6cc;
  --muted: #b09a78;
  --cyan: #e8b84a;   /* main accent: gold */
  --mag: #d2483a;    /* secondary accent: crimson */
  --gold: #ffd36a;
  --green: #7fd46a;
  --red: #ff6a5a;
  --radius: 10px;
  --side: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1100px 700px at 85% -10%, #3a2414 0%, transparent 60%),
              radial-gradient(900px 600px at -10% 110%, #1f2a16 0%, transparent 55%), var(--bg);
  color: var(--text); font: 14px/1.45 Inter, system-ui, sans-serif; overflow-x: hidden;
}
#stars { position: fixed; inset: 0; pointer-events: none; opacity: .5;
  background-image: repeating-linear-gradient(90deg, rgba(255, 220, 160, .018) 0 2px, transparent 2px 7px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%); }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--text); background: rgba(20, 13, 8, .85); border: 1px solid var(--line2);
  border-radius: 9px; padding: 8px 10px; outline: none; min-width: 0; }
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(232, 184, 74, .18); }
h1, h2, h3 { font-family: Cinzel, Georgia, serif; letter-spacing: .03em; font-weight: 700; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--red); min-height: 1.2em; margin: 8px 0 0; }

/* Buttons */
.btn { border: 1px solid var(--line2); background: rgba(232, 184, 74, .08); border-radius: 10px; padding: 8px 14px; font-weight: 600;
  transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: rgba(232, 184, 74, .18); border-color: var(--cyan); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #f0c45a, #b9792a); border: 1px solid #ffdf8a; color: #2a1a0a; text-shadow: 0 1px 0 rgba(255, 240, 200, .5); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.danger { border-color: rgba(255, 93, 108, .5); background: rgba(255, 93, 108, .1); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Logo */
.logo { font-family: Cinzel, Georgia, serif; display: flex; gap: 6px; align-items: baseline; font-size: 20px; }
.logo span { background: linear-gradient(180deg, #ffe7a0, #d99a2a); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.logo b { color: var(--mag); font-weight: 800; font-size: .8em; letter-spacing: .3em; }
.logo.big { font-size: 34px; justify-content: center; }

/* Auth */
#auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; position: relative; }
.auth-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 20px; padding: 28px;
  backdrop-filter: blur(10px); box-shadow: 0 20px 80px rgba(232, 184, 74, .12); text-align: center; }
.auth-card form { display: grid; gap: 12px; text-align: left; margin-top: 14px; }
.auth-card label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.tabs-inline { display: flex; background: rgba(0, 0, 0, .3); border-radius: 10px; padding: 3px; margin-top: 16px; }
.tabs-inline button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.tabs-inline button.on { background: var(--panel2); color: var(--text); }

/* Layout */
#game { display: flex; min-height: 100vh; position: relative; }
#side { width: var(--side); flex: none; background: rgba(24, 16, 11, .96); border-right: 1px solid var(--line); padding: 16px 12px;
  display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 20; }
.wallet { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.credits { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 16px; color: var(--gold); }
#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-h { font-size: 10px; letter-spacing: .18em; color: var(--muted); margin: 12px 8px 4px; font-weight: 700; }
.nav-i { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; border: 1px solid transparent; background: none; text-align: left; width: 100%; }
.nav-i:hover { background: rgba(232, 184, 74, .07); }
.nav-i.on { background: linear-gradient(90deg, rgba(232, 184, 74, .18), rgba(210, 72, 58, .06)); border-color: var(--line2); }
.nav-i .lbl { flex: 1; }
.nav-i .lv { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-i .badge { background: var(--mag); color: #fff; border-radius: 99px; font-size: 10px; padding: 1px 6px; font-weight: 700; }
.nav-i.busy .lbl::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-left: 6px; box-shadow: 0 0 8px var(--green); vertical-align: middle; }
.side-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#top { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: rgba(24, 16, 11, .75);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
#top h1 { font-size: 17px; flex: 1; }
#menuBtn { display: none; font-size: 20px; padding: 4px 10px; }
#activity { display: flex; align-items: center; gap: 8px; min-width: 0; }
#activity .chip { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px 4px 6px; max-width: 320px; }
#activity .chip .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
#activity .pbar { width: 80px; height: 5px; }
#view { padding: 22px; display: grid; gap: 18px; align-content: start; }
#scrim { display: none; }

/* Panels */
.panel { box-shadow: inset 0 1px 0 rgba(255, 230, 180, .05), 0 6px 20px rgba(0, 0, 0, .25); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; backdrop-filter: blur(6px); }
.panel h2 { font-size: 14px; margin-bottom: 12px; color: #cfe2ff; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid.sm { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* Skill header */
.skill-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.skill-head .lvl { font-family: Cinzel, serif; font-size: 30px; font-weight: 800; }
.skill-head .lvl small { font-size: 12px; color: var(--muted); font-family: Inter; font-weight: 600; margin-right: 4px; }
.xpbar { height: 10px; border-radius: 99px; background: rgba(0, 0, 0, .45); overflow: hidden; border: 1px solid var(--line); }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #b9792a, var(--gold)); border-radius: 99px; }

/* Progress bars */
.pbar { height: 7px; background: rgba(0, 0, 0, .5); border-radius: 99px; overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #d99a2a, #ffe7a0); box-shadow: 0 0 8px rgba(255, 190, 90, .5); }
.pbar.red i { background: linear-gradient(90deg, #ff3d6c, #ff8a3d); box-shadow: 0 0 10px rgba(255, 93, 108, .6); }
.pbar.hp { height: 14px; }
.pbar.hp i { background: linear-gradient(90deg, #4a9a3a, var(--green)); transition: width .3s; }
.pbar.hp.e i { background: linear-gradient(90deg, #ff3d6c, #ff8a8a); }

/* Action cards */
.card { position: relative; background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 10px;
  transition: border-color .15s, transform .15s, box-shadow .15s; text-align: left; width: 100%; }
button.card:hover:not(.locked) { border-color: var(--line2); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(232, 184, 74, .08); }
.card.active { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan), 0 0 24px rgba(232, 184, 74, .2); }
.card.locked { opacity: .55; cursor: not-allowed; }
.card .title { font-weight: 700; }
.card .meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.card .meta b { color: var(--text); font-weight: 600; }
.req { display: flex; flex-wrap: wrap; gap: 6px; }
.req span { display: inline-flex; align-items: center; gap: 4px; background: rgba(0, 0, 0, .35); border-radius: 8px; padding: 2px 8px 2px 2px; font-size: 12px; }
.req span.miss { color: var(--red); }
.lockline { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }

/* Bank */
.bank { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.slot { position: relative; aspect-ratio: 1; border-radius: 12px; background: rgba(20, 13, 8, .7); border: 1px solid var(--line); display: grid; place-items: center; padding: 0; }
.slot:hover { border-color: var(--line2); }
.slot.sel { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }
.slot .q { position: absolute; right: 6px; bottom: 4px; font-size: 11px; font-weight: 700; text-shadow: 0 1px 3px #000; font-variant-numeric: tabular-nums; }
.slot.empty { opacity: .25; }
.detail { display: grid; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.stat { background: rgba(0, 0, 0, .3); border-radius: 9px; padding: 6px 10px; font-size: 12px; }
.stat b { display: block; font-size: 15px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: rgba(232, 184, 74, .12); color: var(--muted); }
.tag.gold { color: var(--gold); background: rgba(255, 207, 58, .12); }

/* Combat */
.arena { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; }
.fighter { display: grid; gap: 8px; justify-items: center; text-align: center; }
.fighter .name { font-weight: 700; }
.fighter .bars { width: 100%; display: grid; gap: 6px; }
.vs { font-family: Cinzel, serif; color: var(--mag); font-size: 22px; }
.feed { font-size: 12px; display: grid; gap: 3px; max-height: 170px; overflow: hidden; }
.feed .p { color: var(--cyan); } .feed .e { color: #ff9aa5; } .feed .k { color: var(--gold); }
.zone { border-left: 3px solid var(--zc, var(--cyan)); }
.enemy { display: flex; gap: 12px; align-items: center; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.me td { background: rgba(232, 184, 74, .08); }
.tablewrap { overflow-x: auto; }

/* Chat */
.chatbox { display: grid; grid-template-rows: 1fr auto; height: calc(100vh - 160px); min-height: 320px; }
.msgs { overflow-y: auto; display: grid; align-content: start; gap: 6px; padding-right: 4px; }
.msg { background: rgba(0, 0, 0, .28); padding: 6px 10px; border-radius: 10px; word-wrap: break-word; }
.msg b { color: var(--cyan); margin-right: 6px; }
.msg time { color: var(--muted); font-size: 11px; margin-left: 6px; }
.chatform { display: flex; gap: 8px; margin-top: 10px; }
.chatform input { flex: 1; }

/* Toasts & modal */
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 100; max-width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  animation: tin .25s ease-out; }
.toast.level { border-color: var(--gold); } .toast.rare { border-color: var(--mag); } .toast.warn, .toast.error { border-color: var(--red); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }
#modal { position: fixed; inset: 0; background: rgba(10, 6, 3, .75); display: grid; place-items: center; z-index: 90; padding: 16px; }
.modal-card { width: min(460px, 100%); max-height: 85vh; overflow-y: auto; }
.gain { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.gain .plus { color: var(--green); font-weight: 700; margin-left: auto; }
.gain .minus { color: var(--red); font-weight: 700; margin-left: auto; }

/* World boss, dungeons, chat channels */
.feed .m { color: #c9a8ff; }
.tag.red { background: rgba(255, 90, 80, .18); color: #ff8a7a; font-weight: 700; letter-spacing: .08em; }
.boss { border-left: 3px solid #9ad8a8; }
.boss.live { border-color: #ff6a5a; box-shadow: 0 0 0 1px rgba(255, 106, 90, .35), 0 0 30px rgba(255, 106, 90, .15); animation: bosspulse 2.4s ease-in-out infinite; }
@keyframes bosspulse { 50% { box-shadow: 0 0 0 1px rgba(255, 106, 90, .6), 0 0 40px rgba(255, 106, 90, .3); } }
.bossbanner { width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.bosstop { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bosstop span { background: rgba(0, 0, 0, .3); border-radius: 8px; padding: 3px 8px; font-size: 12px; }
.chantabs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.chan { position: relative; border: 1px solid var(--line); background: rgba(0, 0, 0, .25); border-radius: 99px; padding: 6px 14px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.chan.on { background: var(--panel2); color: var(--gold); border-color: var(--line2); }
.chan .badge { margin-left: 6px; background: var(--mag); color: #fff; border-radius: 99px; font-size: 10px; padding: 1px 6px; }
.chatbox { grid-template-rows: auto 1fr auto; }
.msg.sys { background: rgba(232, 184, 74, .1); border: 1px solid rgba(232, 184, 74, .25); }
.msg.sys b { color: var(--gold); }

/* Quests, achievements, pets, guild */
.card.pet { justify-items: center; text-align: center; gap: 6px; }
.card.ach.active { box-shadow: 0 0 0 1px rgba(232, 184, 74, .5); }
.motd { margin-top: 10px; padding: 8px 12px; border-left: 3px solid var(--cyan); background: rgba(0, 0, 0, .25); border-radius: 0 8px 8px 0; font-style: italic; }
.motd:empty { display: none; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #5a4a3a; margin-right: 6px; vertical-align: middle; }
.dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }

/* Prayer */
.pbar.pray { height: 6px; }
.pbar.pray i { background: linear-gradient(90deg, #8a7bff, #e8e0ff); box-shadow: 0 0 8px rgba(180, 160, 255, .6); width: auto; }
.card.bless { gap: 4px; }
.card.bless .title { font-size: 13px; }

/* Store & premium */
.star { color: var(--gold); text-shadow: 0 0 8px rgba(255, 211, 106, .6); margin-right: 3px; }
.utitle { font-size: 11px; font-weight: 600; color: #c9a8ff; background: rgba(160, 120, 255, .12); border-radius: 6px; padding: 1px 6px; }
.gemcount { display: inline-flex; align-items: center; gap: 4px; color: #8ae4ff; margin-left: 8px; cursor: pointer; }
.panel.premium { border-color: rgba(255, 211, 106, .45); background: linear-gradient(160deg, rgba(90, 60, 20, .55), var(--panel)); }
.perks { margin: 12px 0; padding-left: 20px; display: grid; gap: 4px; }
.perks li::marker { content: '✦  '; color: var(--gold); }
.card.plan { justify-items: start; position: relative; }
.card.plan .price { font-family: Cinzel, serif; font-size: 22px; font-weight: 800; color: var(--gold); }
.card.cos .title { font-size: 15px; }
.testmode { border-color: rgba(255, 106, 90, .5); color: #ffb0a0; font-size: 13px; }
.msg b.who { color: var(--cyan); }

/* Premium (P2P) skills */
.p2p { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 4px; background: rgba(255, 211, 106, .18); color: var(--gold); font-size: 9px; font-weight: 800; vertical-align: middle; }
.tag.p2ptag { color: var(--gold); background: rgba(255, 211, 106, .14); font-size: 10px; vertical-align: middle; }

.panel.slayer { border-left: 3px solid #c94a3a; }

/* Guide, login streak, hero design, profiles */
.panel.guide { border-left: 3px solid var(--green); }
.logincard { border-color: rgba(255, 211, 106, .5); animation: bosspulse 2.4s ease-in-out infinite; }
.ldays { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.lday { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: rgba(0, 0, 0, .25); min-height: 64px; }
.lday.got { opacity: .45; }
.lday.now { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(255, 211, 106, .25); }
.avpreview { display: grid; place-items: center; margin: 6px 0 10px; }
.avrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.avrow > span { width: 56px; }
.avopt { border: 1px solid var(--line); background: rgba(0, 0, 0, .25); border-radius: 10px; padding: 3px; display: grid; place-items: center; }
.avopt.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.sw { display: block; width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .4); }
.pname { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.pname:hover span { text-decoration: underline; }
.ico.mini { flex: none; }
.pskills { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; margin-top: 12px; }
.pskill { display: flex; align-items: center; gap: 4px; background: rgba(0, 0, 0, .25); border-radius: 8px; padding: 4px 6px; font-size: 13px; }

/* Combat juice: floating numbers, hit shake, level-up celebration */
.fighter { position: relative; }
.float { position: absolute; top: 18px; transform: translateX(-50%); font-family: Cinzel, serif; font-weight: 800; font-size: 22px;
  pointer-events: none; text-shadow: 0 2px 6px rgba(0, 0, 0, .8); animation: floatUp 1.2s ease-out forwards; z-index: 3; }
.float.dmg-out { color: #ffe27a; }
.float.dmg-in { color: #ff6a5a; }
.float.magic { color: #c9a8ff; }
.float.gold { color: var(--gold); font-size: 15px; }
.float.miss { color: var(--muted); font-size: 14px; font-family: Inter, sans-serif; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -46px) scale(1); } }
.ico.shake { animation: shake .35s ease; }
@keyframes shake { 20% { transform: translateX(-5px) rotate(-3deg); } 40% { transform: translateX(5px) rotate(3deg); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.levelup { position: fixed; inset: 0; display: grid; place-items: center; z-index: 120; pointer-events: none;
  background: radial-gradient(circle at center, rgba(255, 211, 106, .22), transparent 60%); animation: luIn .4s ease-out; }
.levelup.out { animation: luOut .5s ease-in forwards; }
.lu-card { display: grid; justify-items: center; gap: 6px; padding: 22px 30px; border-radius: 18px; background: rgba(30, 20, 12, .92);
  border: 1px solid var(--gold); box-shadow: 0 0 60px rgba(255, 211, 106, .45); animation: luPop .5s cubic-bezier(.2, 1.6, .4, 1); }
.lu-title { font-family: Cinzel, serif; font-weight: 800; font-size: 24px; letter-spacing: .08em; color: var(--gold); text-shadow: 0 0 18px rgba(255, 211, 106, .7); }
.lu-sub { font-size: 16px; }
.lu-sub b { color: var(--gold); font-size: 22px; }
@keyframes luIn { from { opacity: 0; } }
@keyframes luOut { to { opacity: 0; transform: scale(1.05); } }
@keyframes luPop { from { transform: scale(.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .float, .ico.shake, .levelup, .lu-card, .logincard, .boss.live { animation: none !important; } }

/* Mastery */
.mastery { display: grid; gap: 3px; }
.mbar { height: 4px; border-radius: 99px; background: rgba(0, 0, 0, .4); overflow: hidden; }
.mbar i { display: block; height: 100%; background: linear-gradient(90deg, #8a6a3a, var(--gold)); }

/* Touch & app shell (all sizes) */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
button, .card, .slot, .bn { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
#topGold, #bottomNav { display: none; }
.auth-emblem { display: block; margin: 0 auto 6px; border-radius: 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
#auth { padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); }

/* Phone layout */
@media (max-width: 860px) {
  #side { position: fixed; left: 0; top: 0; bottom: 0; height: auto; transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 20px 0 60px rgba(0, 0, 0, .6); padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40; }
  #game.menu #side { transform: none; }
  #game.menu #scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 35; }
  #menuBtn { display: none; }
  .nav-i { padding: 10px 8px; }

  #top { flex-wrap: wrap; gap: 8px 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
  #top h1 { font-size: 16px; }
  #topGold { display: flex; align-items: center; gap: 5px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
  #activity { order: 3; width: 100%; }
  #activity .chip { flex: 1; max-width: none; min-width: 0; padding: 5px 12px 5px 6px; }
  #activity .chip .t { flex: 1; }
  #activity .pbar { display: block; width: 70px; flex: none; }
  #activity .btn { padding: 7px 12px; }

  #view { padding: 14px 12px calc(86px + env(safe-area-inset-bottom)); gap: 14px; }
  .panel { padding: 14px; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .grid.sm { grid-template-columns: 1fr 1fr; }
  .card { padding: 12px; }
  .btn { padding: 10px 16px; }
  .btn.small { padding: 7px 12px; font-size: 13px; }
  input, select { font-size: 16px; padding: 10px 12px; } /* 16px stops iOS zooming on focus */
  .bank { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
  .skill-head .lvl { font-size: 26px; }
  .arena { grid-template-columns: 1fr auto 1fr; gap: 8px; }
  .fighter > .ico { width: 56px; height: 56px; }
  .fighter .name { font-size: 13px; }
  .vs { font-size: 16px; }
  .feed { max-height: 120px; }
  .chatbox { height: calc(100dvh - 210px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  table { font-size: 13px; }
  th, td { padding: 8px 6px; }

  #toasts { left: 12px; right: 12px; max-width: none; bottom: calc(80px + env(safe-area-inset-bottom)); }
  #modal { align-items: end; padding: 0; }
  .modal-card { width: 100%; border-radius: 18px 18px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); max-height: 80vh; }

  #bottomNav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(22, 15, 10, .97); border-top: 1px solid var(--line2); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .45); }
  .bn { position: relative; display: grid; justify-items: center; gap: 2px; background: none; border: 0; padding: 4px 0; border-radius: 10px;
    color: var(--muted); font-size: 11px; font-weight: 600; min-height: 52px; }
  .bn .ico { opacity: .7; transition: transform .15s, opacity .15s; }
  .bn.on { color: var(--gold); }
  .bn.on .ico { opacity: 1; transform: translateY(-2px) scale(1.08); }
  .bn.on::before { content: ''; position: absolute; top: -7px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--cyan); }
  .bn.busy::after { content: ''; position: absolute; top: 4px; right: calc(50% - 18px); width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
  .bn .badge { position: absolute; top: 2px; right: calc(50% - 22px); background: var(--mag); color: #fff; border-radius: 99px; font-size: 10px; padding: 1px 6px; }
}

@media (max-width: 340px) {
  .arena { grid-template-columns: 1fr; }
  .vs { justify-self: center; }
}

/* Guild project */
.gp-bar { position: relative; margin: 14px 0 8px; padding-top: 4px; }
.gp-bar .pbar { height: 12px; }
.gp-mark { position: absolute; top: -2px; transform: translateX(-100%); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; background: #2a2018; border: 2px solid #6a5a40; color: var(--muted); }
.gp-mark.done { background: var(--gold); border-color: #fff2c0; color: #2a1a08; }
.gp-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.gp-item:last-child { border-bottom: 0; }

/* Social, guild logos, grades */
.glogo { display: inline-grid; place-items: center; border-radius: 10px; border: 2px solid rgba(255, 220, 150, .35); flex: none; overflow: hidden; }
.glogo svg { display: block; }
.gname { display: flex; align-items: center; gap: 8px; }
.gtag { color: var(--muted); font-size: 11px; font-weight: 600; margin-right: 4px; }
.grade { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--gc); color: var(--gc); white-space: nowrap; font-weight: 600; }
.gradetabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.gtab { background: rgba(0, 0, 0, .3); border: 1px solid rgba(255, 255, 255, .1); color: var(--gc); border-radius: 99px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.gtab span { color: var(--muted); margin-left: 2px; }
.gtab.on { border-color: var(--gc); background: rgba(255, 255, 255, .08); }
.frow, .convo { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); flex-wrap: wrap; }
.frow:last-child, .convo:last-child { border-bottom: 0; }
.convo { cursor: pointer; flex-wrap: nowrap; }
.convo .grow { min-width: 0; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgs.dm { display: flex; flex-direction: column; gap: 6px; height: 45vh; min-height: 200px; margin-top: 10px; padding: 8px; background: rgba(0, 0, 0, .25); border-radius: 10px; }
.dmm { align-self: flex-start; max-width: 80%; background: rgba(255, 255, 255, .07); padding: 6px 10px; border-radius: 12px 12px 12px 3px; word-wrap: break-word; }
.dmm.mine { align-self: flex-end; background: rgba(232, 184, 74, .2); border-radius: 12px 12px 3px 12px; }
.dmm time { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.lpick { background: rgba(0, 0, 0, .3); border: 2px solid transparent; border-radius: 10px; padding: 4px; cursor: pointer; line-height: 0; }
.lpick.on { border-color: var(--gold); }
.warnbox { border-color: rgba(255, 140, 90, .5); color: #ffc0a0; }
#view > * { min-width: 0; }
.frow.mine { background: rgba(232, 184, 74, .07); border-radius: 8px; padding-left: 6px; padding-right: 6px; }
.frow .mact { flex-basis: 100%; justify-content: flex-end; gap: 4px; }

/* leaderboard skill picker */
.lbskills { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.lbsk { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 64px; padding: 6px 2px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(255, 255, 255, .1); border-radius: 10px; color: var(--muted); font: inherit; font-size: 10px; cursor: pointer; }
.lbsk span { max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbsk.on { border-color: var(--gold); background: rgba(232, 184, 74, .14); color: var(--gold); }
.lbhead { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.lbname { display: flex; align-items: center; gap: 6px; }
.lbact { display: inline-flex; opacity: .55; }
.lbact.on { opacity: 1; }
@media (max-width: 480px) {
  #lb th, #lb td { padding-left: 4px; padding-right: 4px; }
  #lb .lbname { gap: 3px; }
}

/* roadmap */
.card.rm { overflow: hidden; }
.card.rm.soon { border-color: rgba(180, 138, 255, .45); }
.soonrib { position: absolute; top: 14px; right: -38px; transform: rotate(35deg); width: 140px; text-align: center; font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; padding: 2px 0; background: #6a4ab8; color: #fff; }
.card.plan .soonrib { background: rgba(255, 255, 255, .12); color: var(--muted); }
.card.rm .title { padding-right: 56px; }

/* collection log */
.cpage { cursor: pointer; }
.cpage.ready { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 207, 58, .18); }
.cpage.claimed { border-color: rgba(143, 209, 106, .4); }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.centry { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 8px 4px; border-radius: 10px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(255, 255, 255, .06); font-size: 11px; min-width: 0; }
.centry span { overflow-wrap: anywhere; }
.centry small { color: var(--muted); font-size: 10px; }
.centry.miss svg { filter: grayscale(1) brightness(.35); }
.centry.miss span { color: var(--muted); opacity: .6; }
/* notifications */
.prefrow { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.prefrow:last-child { border-bottom: 0; }
.prefrow input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--gold); flex: 0 0 auto; }
/* planned features in the menu */
.soontag { margin-left: auto; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 1px 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); color: var(--muted); white-space: nowrap; }
.soontag.soon { background: #6a4ab8; color: #fff; }
.card.rm.focus { box-shadow: 0 0 0 2px var(--gold); }

/* milestones */
.miles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.mile { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: rgba(0, 0, 0, .35); color: var(--muted); border: 1px solid rgba(255, 255, 255, .08); }
.mile.on { color: #1b130c; background: var(--gold); border-color: var(--gold); }
.mile.cape.on { background: #7ef0ff; border-color: #7ef0ff; }
/* capes */
.caperow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.caperow.max { border-bottom: 2px solid rgba(255, 207, 58, .3); }
.capebtns { display: flex; gap: 8px; margin-left: auto; }
.capebtns > div { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.capebtns small { color: var(--muted); font-size: 10px; }
.caperow .tag { white-space: normal; text-align: right; max-width: 150px; }
.panel.weekly { border-color: rgba(255, 207, 58, .35); }

.contest { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px; border-radius: 12px; background: linear-gradient(90deg, rgba(255, 207, 58, .14), rgba(255, 207, 58, .03)); border: 1px solid rgba(255, 207, 58, .35); }
.contest .grow { min-width: 180px; }

/* event of the day */
.dayev { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dayev.panel { background: linear-gradient(90deg, rgba(90, 184, 232, .14), rgba(90, 184, 232, .03)); border-color: rgba(90, 184, 232, .35); }
.dayev.mini { margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(90, 184, 232, .1); border: 1px solid rgba(90, 184, 232, .3); }
.dayev .grow { min-width: 180px; }
/* queue */
.qpanel.locked { opacity: .85; }
.qpanel select { background: rgba(0, 0, 0, .35); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px; font: inherit; }
/* treasure */
.clue { padding: 8px 10px; margin-top: 6px; border-radius: 10px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(232, 201, 138, .25); }
.clue.done { border-color: rgba(143, 209, 106, .4); }
.clue.locked { opacity: .55; font-size: 13px; }
.panel.treasure { border-color: rgba(232, 201, 138, .45); }

/* payments */
.payform { display: grid; gap: 8px; }
.payform label { display: flex; gap: 8px; align-items: flex-start; }
.payform label input { margin-top: 3px; flex: 0 0 auto; }
.payframe { width: 100%; height: 70vh; min-height: 480px; border: 0; border-radius: 10px; background: #fff; }

/* e-mail verification */
.vform { display: grid; gap: 8px; margin-top: 8px; }
#verifyBox a { color: var(--cyan); }
