:root {
  --bg: #0f0c18;
  --panel: #1a1626;
  --panel2: #251f36;
  --line: #3a3252;
  --text: #e9e4f5;
  --dim: #9a91b3;
  --accent: #b08cff;
  --hp: #d4455a;
  --xp: #5fb0ff;
  --good: #6fd08c;
  --bad: #ff7a7a;
  --gold: #f0c45a;
  --t-common: #b9b2cc;
  --t-fine: #8fe0a6;
  --t-rare: #7cc4ff;
  --t-epic: #d6a8ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 560px; margin: 0 auto; padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
h1 { font-size: 2rem; margin: 8px 0 4px; letter-spacing: .12em; text-align: center; }
h2 { font-size: 1rem; margin: 0 0 8px; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.sub { color: var(--dim); margin: 0 0 16px; text-align: center; }
.auth { padding-top: 28px; }
.logo { display: block; width: 84px; height: 84px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.card.nopad { padding: 0; overflow: hidden; }
.pad { padding: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.dim { color: var(--dim); font-size: .9rem; }
.good { color: var(--good); } .bad { color: var(--bad); } .gold { color: var(--gold); }
input { width: 100%; padding: 12px; margin: 6px 0; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font: inherit; }
button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-height: 44px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button[data-wait] { opacity: .55; }
button.primary { background: var(--accent); color: #17102b; border-color: var(--accent); font-weight: 600; }
button.danger { border-color: var(--bad); color: var(--bad); }
button.small { min-height: 36px; padding: 6px 10px; font-size: .85rem; white-space: nowrap; }
.bar { height: 10px; background: var(--panel2); border-radius: 6px; overflow: hidden; margin: 4px 0 8px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--hp); transition: width .3s; }
.bar.xp > i { background: var(--xp); }
.bar.cd > i { background: var(--accent); transition: none; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 12px; }
.tabs button { padding: 8px 2px; font-size: .78rem; min-height: 40px; }
.tabs button.on { background: var(--accent); color: #17102b; border-color: var(--accent); font-weight: 600; }
.loc { display: flex; justify-content: space-between; width: 100%; text-align: left; margin-bottom: 6px; }
.loc.cur { border-color: var(--accent); }
.tag { font-size: .7rem; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--dim); margin-left: 4px; }
.tag.pvp { color: var(--bad); border-color: var(--bad); }
.item { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.iname { font-weight: 600; }
.t-common { color: var(--t-common); } .t-fine { color: var(--t-fine); } .t-rare { color: var(--t-rare); } .t-epic { color: var(--t-epic); }
.log { font-size: .9rem; color: var(--dim); max-height: 180px; overflow-y: auto; }
.log p { margin: 2px 0; }
.enc { border-color: var(--bad); }
.err { color: var(--bad); min-height: 1.4em; margin: 4px 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; font-size: .9rem; color: var(--dim); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Графіка */
.icon { width: 46px; height: 46px; flex: none; }
.icon.small { width: 24px; height: 24px; }
.monster { display: block; width: 100%; max-width: 240px; margin: 0 auto 8px; border-radius: 14px; }
.banner { display: block; width: 100%; height: auto; }
.mats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; background: var(--panel2); border-radius: 10px; font-size: .8rem; text-align: center; }
.mat.none { opacity: .45; }
.mat .icon { width: 36px; height: 36px; }
.recipe { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 4px; }
.recipe:last-child { border-bottom: 0; }
.recipe .item { border-bottom: 0; padding-bottom: 2px; }
.need { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8rem; padding-left: 56px; }
.need span { display: inline-flex; align-items: center; gap: 4px; }
.need .ok { color: var(--good); } .need .lack { color: var(--bad); }

@media (max-width: 380px) {
  .tabs button { font-size: .7rem; }
  .icon { width: 40px; height: 40px; }
}

/* рідкість */
.r-white { color: var(--t-common); } .r-green { color: #7cf0a8; } .r-blue { color: #7cc4ff; } .r-legend { color: #ffb347; text-shadow: 0 0 6px #ffb34766; }
.extra { font-size: .78rem; color: #c9b8ff; } .extra.fixed { color: #ffb347; }
.special { font-size: .78rem; color: #ff8fb0; }
.forge .sel { outline: 2px solid var(--accent); }
.chance { font-weight: 600; } .chance.danger { color: #ff7a7a; }
.mine-box p { margin: 6px 0; }
.mats .sell { font-size: .7rem; padding: 2px 6px; margin-left: 6px; }

.item.pick { cursor: pointer; }

.item.me { outline: 1px solid var(--accent); }
.place { width: 1.6em; text-align: center; color: var(--accent); }

.hintrow { margin: 0 0 8px; } .hintbtn { background: none; border: none; color: var(--dim, #8d86a3); font-size: .78rem; padding: 2px 4px; min-height: 0; }
.hintrow p { margin: 4px 0 0; font-size: .82rem; }
.ts { color: var(--dim, #8d86a3); font-size: .75rem; }

.chat { max-height: 260px; overflow-y: auto; } button.tiny { padding: 0 6px; min-height: 0; font-size: .7rem; }
