:root {
  --bg: #0b0b0d;
  --card: #17171b;
  --card2: #1f1f25;
  --line: #2a2a31;
  --text: #f4f4f6;
  --muted: #8c8c96;
  --accent: #f4f4f6;
  --r-common: #9aa0a6;
  --r-uncommon: #4cd97b;
  --r-rare: #4a8cff;
  --r-epic: #a259ff;
  --r-legendary: #ff4fd8;
  --r-mythic: #ff5050;
  --r-secret: #ffcc33;
  --rc: var(--r-common);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; margin: 8px 0 16px; text-transform: uppercase; }
h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin: 22px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: 0 18px 110px; }

/* --- верхняя панель --- */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0 10px; background: linear-gradient(var(--bg) 70%, transparent); }
.balance { font-weight: 800; font-size: 19px; }
.balance .sep { display: inline-block; width: 1px; height: 16px; background: var(--line); margin: 0 10px; vertical-align: -2px; }
.balance .energy b { color: #ffd23f; }
.balance .sub { font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 2px; min-height: 14px; }
.lang { font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 999px; background: var(--card2); }

.screen { display: none; animation: fade .2s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --- экран крутки --- */
.drop { text-align: center; padding: 10px 0 6px; }
.tile { width: 210px; height: 210px; margin: 6px auto 14px; border-radius: 34px; display: grid; place-items: center;
  font-size: 108px; position: relative;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--rc) 35%, transparent), transparent 70%), var(--card);
  border: 1px solid color-mix(in srgb, var(--rc) 45%, var(--line));
  box-shadow: 0 0 60px color-mix(in srgb, var(--rc) 25%, transparent); transition: box-shadow .3s, border-color .3s; }
.tile.spinning span { animation: shake .12s infinite; filter: blur(1px); }
@keyframes shake { 0% { transform: translateY(-6px) scale(.95); } 50% { transform: translateY(6px) scale(1.05); } 100% { transform: translateY(-6px) scale(.95); } }
.tile.reveal { animation: pop .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.85); } to { transform: scale(1); } }
.rarity { color: var(--rc); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; min-height: 18px; }
.drop h2 { margin: 4px 0 2px; font-size: 26px; font-weight: 800; }
.serial { color: var(--muted); font-size: 13px; }
.price { font-size: 36px; font-weight: 800; margin: 6px 0 4px; }
.meta { color: var(--muted); font-size: 14px; }
.mods { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 8px; min-height: 26px; }
.mod { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: var(--card2); color: #8fb3ff; }

.level { margin: 18px 0 14px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.level-row { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 10px; }
.bar { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--text); transition: width .3s; }
.bar.thin { flex: 1; }

.decide { display: none; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.decide.show { display: grid; }
.btn { padding: 14px; border-radius: 18px; background: var(--text); color: #000; font-weight: 700; font-size: 15px; width: 100%; }
.btn.ghost { background: var(--card2); color: var(--text); }
.btn.small { padding: 10px 14px; font-size: 13px; width: auto; }
.btn small { display: block; font-weight: 500; opacity: .7; font-size: 12px; }
.spin { width: 100%; padding: 20px; border-radius: 999px; background: var(--text); color: #000; font-size: 18px; font-weight: 800;
  box-shadow: 0 8px 30px rgba(255, 255, 255, .12); transition: transform .1s; }
.spin:active { transform: scale(.97); }
.spin:disabled { opacity: .5; }
.chip { font-size: 13px; padding: 4px 9px; border-radius: 999px; background: rgba(0, 0, 0, .08); margin-left: 6px; }

/* --- хранилище --- */
.card { background: var(--card); border-radius: 22px; padding: 18px; margin-bottom: 12px; }
.card.hero { background: linear-gradient(135deg, #2a1416, #17171b 60%); }
.big { font-size: 34px; font-weight: 800; margin: 4px 0 12px; }
.row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.item { background: var(--card); border-radius: 20px; padding: 14px 10px; text-align: center; position: relative;
  border: 1px solid color-mix(in srgb, var(--rc) 30%, transparent); }
.item .e { font-size: 46px; height: 64px; display: grid; place-items: center; }
.item .n { font-size: 13px; font-weight: 600; margin: 4px 0 2px; }
.item .r { color: var(--rc); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.item .p { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--rc) 22%, transparent); }
.item .x { position: absolute; top: 8px; right: 10px; font-size: 12px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 30px 0; grid-column: 1 / -1; }

/* --- магазин --- */
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shop-card { background: var(--card); border-radius: 20px; padding: 16px 8px; text-align: center; }
.shop-card .q { font-size: 30px; font-weight: 800; }
.shop-card .u { color: var(--muted); font-size: 12px; margin-bottom: 12px; }

/* --- списки --- */
.list { background: var(--card); border-radius: 20px; overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .pl { width: 26px; color: var(--muted); font-weight: 700; }
.li .nm { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .v { font-weight: 800; }
.li.mine { background: var(--card2); }
.li.gold { background: linear-gradient(90deg, #f6c548, #e7a92a); color: #000; }
.li.gold .pl { color: #000; }

/* --- профиль --- */
.profile { text-align: center; padding: 10px 0 16px; }
.avatar { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center;
  font-size: 34px; font-weight: 800; background: linear-gradient(135deg, #4a8cff, #6cc3ff); }
.profile h2 { margin: 0 0 8px; }
.stats { padding: 0; }
.stat { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.stat:last-child { border-bottom: 0; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .val { font-size: 20px; font-weight: 700; margin-top: 2px; }

/* --- нижняя навигация, как у NomerGame --- */
.tabbar { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 6px;
  background: rgba(30, 30, 36, .85); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: 999px; border: 1px solid var(--line); z-index: 10; }
.tabbar button { padding: 10px 14px; border-radius: 999px; font-size: 14px; color: var(--muted); }
.tabbar button.active { background: #3a3a44; color: var(--text); }
.tabbar .me { width: 38px; height: 38px; padding: 0; border-radius: 50%; background: linear-gradient(135deg, #4a8cff, #6cc3ff);
  color: #fff; font-size: 12px; font-weight: 800; margin-left: 4px; }

/* --- модалка и тост --- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); display: none; align-items: flex-end; z-index: 20; }
.modal.show { display: flex; }
.sheet { background: var(--card); width: 100%; max-width: 480px; margin: 0 auto; border-radius: 26px 26px 0 0; padding: 22px 18px 34px; }
.flags { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.flags button { background: var(--card2); border-radius: 16px; padding: 12px 0; font-size: 30px; }
.flags button small { display: block; font-size: 11px; color: var(--muted); }
.toast { position: fixed; top: 16px; left: 50%; transform: translate(-50%, -80px); background: #2b2b33; padding: 12px 18px;
  border-radius: 14px; font-size: 14px; transition: transform .25s; z-index: 30; }
.toast.show { transform: translate(-50%, 0); }
