:root {
  --bg: #080607;
  --surface: #100c0e;
  --card: #171113;
  --card-2: #201619;
  --line: rgba(255, 240, 244, 0.09);
  --line-accent: rgba(255, 49, 88, 0.48);
  --text: #fff9fa;
  --muted: #a89b9f;
  --lime: #ff5a78;
  --lime-dark: #b51d3b;
  --red: #e51f49;
  --red-hot: #ff3158;
  --red-dark: #861329;
  --violet: #d92b52;
  --cyan: #ff91a5;
  --danger: #ff3158;
  --ok: #63e895;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 76px;
  --radius: 16px;
  --font: "Space Grotesk", system-ui, sans-serif;
  --display: "Unbounded", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px 18px calc(24px + var(--safe-bottom));
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 49, 88, 0.18), transparent 55%),
    linear-gradient(180deg, #12090c, #080607 60%);
}

.auth-card {
  width: min(100%, 380px);
  padding: 28px 22px 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(23, 17, 19, 0.92);
  backdrop-filter: blur(10px);
}

.auth-brand {
  margin-bottom: 18px;
}

.auth-card h1 {
  font-family: var(--display);
  font-size: 24px;
  line-height: 1.15;
  margin-bottom: 10px;
}

.auth-card > p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 18px;
}

.auth-label {
  display: block;
  margin-bottom: 8px;
  color: var(--lime);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-input {
  width: 100%;
  padding: 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0d0a0b;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.auth-input:focus {
  border-color: rgba(255, 49, 88, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 49, 88, 0.12);
}

.auth-hint {
  min-height: 1.3em;
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.auth-submit {
  width: 100%;
  justify-content: center;
}

.auth-submit:disabled {
  opacity: 0.6;
}

body {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px);
  background:
    radial-gradient(circle at 18% -8%, rgba(153, 20, 48, 0.2), transparent 27rem),
    radial-gradient(circle at 100% 42%, rgba(94, 12, 29, 0.08), transparent 24rem),
    var(--bg);
}

button,
input {
  border: 0;
  color: inherit;
  font: inherit;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.app {
  position: relative;
  max-width: 480px;
  min-height: 100vh;
  margin: auto;
}

.app::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.012;
  z-index: 999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.page {
  display: none;
  animation: page-in 0.28s ease;
}

.page.active {
  display: block;
}

.padded,
.page-rating,
.page-home-inner,
.shop-page {
  padding: 14px 16px 30px;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* Shared top bar */
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  display: block;
  object-fit: cover;
  border: 1px solid var(--line-accent);
  border-radius: 10px;
  color: var(--lime);
  background: rgba(255, 49, 88, 0.06);
  box-shadow: none;
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.brand small {
  color: var(--muted);
  font-family: var(--font);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.25em;
}

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--lime);
  background: rgba(16, 12, 14, 0.9);
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(12px);
}

.coin {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 1px solid var(--lime);
  border-radius: 50%;
  background: radial-gradient(circle, var(--lime) 18%, transparent 21%);
  box-shadow: 0 0 12px rgba(255, 49, 88, 0.28);
}

.eyebrow,
.system-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--lime);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  margin-bottom: 10px;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--lime);
}

.page-title {
  margin: 4px 0 14px;
  font-family: var(--display);
  font-size: 31px;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.page-intro {
  max-width: 38ch;
  margin: -4px 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.btn-red,
.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #e91f48, #a20f2f);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(133, 12, 38, 0.24);
  transition: transform 0.15s, filter 0.15s;
}

.btn-red:active,
.btn-gold:active,
.shop-action:active {
  transform: scale(0.97);
}

.btn-red svg,
.btn-gold svg,
.rules-link svg,
.banner-action svg {
  width: 17px;
  height: 17px;
}

/* Home hero */
.cyber-hero {
  position: relative;
  min-height: 500px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(7, 8, 13, 0.1), rgba(7, 8, 13, 0.98)),
    var(--hero-bg) center/cover;
  isolation: isolate;
}

.cyber-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 76% 38%, rgba(170, 20, 49, 0.14), transparent 34%),
    linear-gradient(100deg, rgba(8, 6, 7, 0.98) 3%, rgba(8, 6, 7, 0.54) 51%, rgba(8, 6, 7, 0.62));
}

.hero-grid {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background-image:
    linear-gradient(rgba(255, 49, 88, 0.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 49, 88, 0.28) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.hero-club-chip {
  position: absolute;
  z-index: 1;
  top: 55px;
  right: -35px;
  width: 190px;
  border-radius: 50%;
  opacity: 0.08;
  mix-blend-mode: screen;
  filter: saturate(1.2) drop-shadow(0 0 20px rgba(255, 49, 88, 0.42));
}

.hero-scan {
  display: none;
}

@keyframes scan {
  to { transform: translateY(620px); }
}

.hero-copy {
  position: relative;
  z-index: 3;
  width: 64%;
  padding: 28px 0 0 22px;
}

.system-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 12px var(--lime);
  animation: blink 1.8s ease-in-out infinite;
}

@keyframes blink {
  50% { opacity: 0.25; }
}

.hero-copy h1 {
  margin: 18px 0 14px;
  font-family: var(--display);
  font-size: 32px;
  line-height: 1.02;
  letter-spacing: -0.06em;
}

.hero-copy h1 span {
  color: transparent;
  -webkit-text-stroke: 1px var(--red-hot);
  text-shadow: 0 0 22px rgba(255, 49, 88, 0.25);
}

.hero-copy p {
  max-width: 29ch;
  margin-bottom: 18px;
  color: #a8acb9;
  font-size: 12px;
  line-height: 1.5;
}

.hero-character {
  position: absolute;
  z-index: 2;
  right: -14px;
  bottom: 0;
  width: 72%;
  max-height: 390px;
  object-fit: contain;
  object-position: center bottom;
  filter:
    contrast(1.08)
    drop-shadow(0 0 18px rgba(255, 49, 88, 0.3))
    drop-shadow(-8px 12px 25px rgba(0, 0, 0, 0.65));
}

.hero-player-tag {
  position: absolute;
  z-index: 4;
  right: 13px;
  bottom: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  min-width: 174px;
  padding: 10px 12px;
  border: 1px solid rgba(229, 47, 87, 0.45);
  border-radius: 11px;
  background: rgba(10, 7, 8, 0.86);
  backdrop-filter: blur(14px);
}

.hero-player-tag small {
  grid-column: 1 / -1;
  color: var(--lime);
  font-size: 9px;
  letter-spacing: 0.15em;
}

.hero-player-tag b {
  overflow: hidden;
  max-width: 112px;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
}

.hero-player-tag span {
  color: var(--muted);
  font-size: 10px;
}

.hero-code {
  position: absolute;
  right: 10px;
  top: 12px;
  color: rgba(255, 255, 255, 0.3);
  font-family: monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.cyber-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  margin: 10px 0 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--line);
}

.cyber-stats div {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 13px;
  background: rgba(16, 12, 14, 0.96);
}

.cyber-stats small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.cyber-stats strong {
  margin-top: 2px;
  color: var(--red-hot);
  font-family: var(--display);
  font-size: 19px;
}

.cyber-stats i {
  align-self: end;
  color: #887a7f;
  font-size: 9px;
  font-style: normal;
}

.club-brand-card {
  position: relative;
  min-height: 154px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid rgba(229, 47, 87, 0.25);
  border-radius: 16px;
  background: #050507;
}

.club-brand-card > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.42;
}

.club-brand-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5, 5, 7, 0.98) 5%, rgba(5, 5, 7, 0.7) 55%, rgba(5, 5, 7, 0.2));
}

.club-brand-card > div {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 154px;
  max-width: 65%;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
}

.club-brand-card small {
  color: var(--red-hot);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.club-brand-card strong {
  margin: 7px 0;
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.2;
}

.club-brand-card p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

/* Carousel */
.carousel {
  overflow: hidden;
  border-radius: var(--radius);
  touch-action: pan-y;
}

.carousel-track {
  display: flex;
  will-change: transform;
  transition: transform 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

.banner {
  position: relative;
  flex: 0 0 100%;
  min-width: 100%;
  min-height: 174px;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0, rgba(180, 22, 53, 0.17), transparent 48%),
    linear-gradient(145deg, #171013, #0f0b0d);
}

.banner::after {
  content: "S";
  position: absolute;
  right: 18px;
  top: 34px;
  color: rgba(255, 90, 120, 0.09);
  font-family: var(--display);
  font-size: 92px;
}

.banner-kicker {
  color: var(--lime);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.banner-title {
  position: relative;
  z-index: 1;
  max-width: 14ch;
  margin: 8px 0 13px;
  font-family: var(--display);
  font-size: 20px;
  line-height: 1.1;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 10px;
}

.chip svg {
  width: 12px;
  height: 12px;
}

.banner-action,
.rules-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--lime);
  font-size: 11px;
  font-weight: 700;
}

.carousel-dots {
  display: flex;
  gap: 5px;
  justify-content: center;
  padding: 10px 0 3px;
}

.dot {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: #282c38;
  transition: width 0.28s ease, background 0.28s ease, box-shadow 0.28s ease;
}

.dot.active {
  width: 34px;
  background: var(--red-hot);
  box-shadow: 0 0 10px rgba(255, 49, 88, 0.4);
}

.section-link {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 24px 0 12px;
  font-family: var(--display);
  font-size: 17px;
}

.section-link span {
  color: var(--red-hot);
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.principles {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.principles div {
  display: grid;
  grid-template-columns: 38px 76px 1fr;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.principles b {
  color: var(--violet);
  font-family: var(--display);
  font-size: 12px;
}

.principles span {
  color: var(--lime);
  font-size: 11px;
  font-weight: 700;
}

.principles small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

/* Rating */
.rating-head,
.rating-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 62px 74px;
  align-items: center;
  gap: 7px;
}

.rating-head {
  padding: 8px 11px;
  color: #8f8186;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rating-head svg {
  width: 16px;
  color: var(--lime);
}

.rating-list {
  display: grid;
  gap: 6px;
}

.rating-row {
  min-height: 57px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(105deg, #181214, #100c0e);
  font-size: 12px;
}

.rating-row.me {
  border-color: var(--line-accent);
  background: linear-gradient(105deg, rgba(255, 49, 88, 0.13), #17090e 55%);
  box-shadow: 0 0 24px rgba(255, 49, 88, 0.09);
}

.place {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #0b0d14;
  font-family: var(--display);
  font-size: 9px;
}

.place.gold { border-color: var(--lime); color: var(--lime); }
.place.silver { border-color: var(--cyan); color: var(--cyan); }
.place.bronze { border-color: var(--violet); color: var(--violet); }

.player {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.avatar {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 9px 2px 9px 9px;
  object-fit: cover;
  background: var(--card-2);
}

.avatar.lg {
  width: 42px;
  height: 42px;
}

.player-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 600;
}

.you-badge {
  margin-left: 4px;
  padding: 2px 4px;
  border-radius: 3px;
  color: #080a0d;
  background: var(--lime);
  font-size: 9px;
}

.knockouts,
.col-center {
  text-align: center;
}

.score,
.col-right {
  text-align: right;
}

.score {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  color: #d9dce5;
  font-family: var(--display);
  font-size: 11px;
}

.score svg {
  width: 12px;
  color: var(--lime);
}

.rating-sep {
  margin: 12px 0 7px;
  color: var(--lime);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-align: center;
}

.rules-link {
  margin-bottom: 14px;
}

/* Tournaments */
.tour-list {
  display: grid;
  gap: 9px;
}

.tour-card {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  gap: 10px;
  align-items: start;
  min-height: 130px;
  padding: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(255, 49, 88, 0.11), transparent 46%),
    var(--surface);
}

.tour-card::after {
  content: "";
  position: absolute;
  right: -25px;
  bottom: -45px;
  width: 130px;
  height: 130px;
  border: 1px solid rgba(255, 49, 88, 0.11);
  border-radius: 50%;
  box-shadow: 0 0 0 14px rgba(255, 49, 88, 0.035);
}

.tour-number {
  align-self: start;
  color: var(--violet);
  font-family: var(--display);
  font-size: 10px;
}

.tour-main {
  min-width: 0;
}

.tour-date {
  color: var(--lime);
  font-family: monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.tour-card h3 {
  margin: 7px 0 11px;
  font-family: var(--display);
  font-size: 14px;
  line-height: 1.25;
}

.tour-art {
  z-index: 1;
  color: var(--lime);
  font-size: 26px;
  text-shadow: 0 0 15px rgba(255, 49, 88, 0.34);
}

.tour-reg {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-width: 220px;
}

.tour-join {
  margin-top: 12px;
  width: fit-content;
  min-height: 38px;
  padding: 0 16px;
  font-size: 12px;
}

.tour-reg-note {
  display: block;
  margin-top: 10px;
  color: var(--muted, #9a94a8);
  font-size: 11px;
  line-height: 1.35;
}

.tour-reg-note.ok {
  color: var(--lime);
}

/* Profile */
.profile-stage {
  position: relative;
  min-height: calc(100vh - var(--nav-h));
  overflow: hidden;
  background: var(--bg);
}

.profile-bg {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  filter: saturate(0.58) contrast(1.12) brightness(0.72);
}

.profile-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 49, 88, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 49, 88, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, rgba(8, 6, 7, 0.58), transparent 28%, rgba(8, 6, 7, 0.28) 55%, var(--bg) 96%);
  background-size: 38px 38px, 38px 38px, auto;
}

.profile-overlay::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 44%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--lime), transparent);
  box-shadow: 0 0 15px var(--lime);
  opacity: 0.16;
}

.profile-char {
  position: absolute;
  left: 50%;
  bottom: 145px;
  width: min(82%, 360px);
  max-height: 61vh;
  object-fit: contain;
  transform: translateX(-50%);
  filter:
    contrast(1.08)
    drop-shadow(0 0 25px rgba(255, 49, 88, 0.32))
    drop-shadow(0 20px 30px rgba(0, 0, 0, 0.7));
  animation: character-in 0.5s ease;
}

@keyframes character-in {
  from { opacity: 0; transform: translateX(-50%) translateY(18px); }
}

.profile-top {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 8px;
  padding: 13px;
}

.profile-userbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(12, 9, 10, 0.84);
  backdrop-filter: blur(15px);
}

.profile-userbar > div {
  flex: 1;
}

.profile-userbar small,
.character-name small,
.level-badge small,
.shop-header small {
  color: var(--lime);
  font-size: 9px;
  letter-spacing: 0.15em;
}

.profile-userbar .name {
  font-family: var(--display);
  font-size: 12px;
}

.name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nick-edit-btn {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 10px;
  font-weight: 600;
}

.nick-edit {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  max-width: 220px;
}

.nick-edit-input {
  padding: 10px 12px;
  font-size: 14px;
}

.nick-edit-actions {
  display: flex;
  gap: 6px;
}

.nick-edit-actions .shop-action {
  flex: 1;
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
}

.profile-rank {
  padding: 7px 9px;
  border: 1px solid var(--line-accent);
  border-radius: 8px;
  color: var(--lime);
  font-family: var(--display);
  font-size: 11px;
}

.profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.profile-actions .btn-red {
  min-height: 42px;
  padding: 0 15px;
}

.character-name {
  position: absolute;
  z-index: 2;
  left: 17px;
  bottom: 194px;
  display: flex;
  flex-direction: column;
  padding-left: 10px;
  border-left: 2px solid var(--red-hot);
}

.character-name strong {
  font-family: var(--display);
  font-size: 22px;
}

.profile-stats {
  position: absolute;
  z-index: 3;
  left: 12px;
  right: 12px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 3px);
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line-accent);
  border-radius: 14px;
  background: rgba(12, 9, 10, 0.92);
  backdrop-filter: blur(18px);
}

.level-badge {
  display: flex;
  flex-direction: column;
  color: var(--lime);
  font-family: var(--display);
  font-size: 11px;
  text-transform: uppercase;
}

.profile-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  color: var(--muted);
  font-size: 10px;
}

.profile-metrics span {
  white-space: nowrap;
}

.profile-metrics b {
  color: var(--text);
  font-family: var(--display);
  font-size: 10px;
}

/* Shop */
.shop-page {
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 45px);
}

.shop-header {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
}

.shop-header h1 {
  font-family: var(--display);
  font-size: 20px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  min-width: 44px;
  min-height: 44px;
  font-size: 12px;
}

.back-btn svg {
  width: 20px;
  height: 20px;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.seg-btn {
  position: relative;
  padding: 10px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.seg-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--red-hot), var(--red-dark));
}

.badge {
  display: inline-grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  margin-left: 3px;
  border-radius: 50%;
  color: var(--text);
  background: var(--red-hot);
  font-size: 9px;
}

.filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 12px;
}

.filter-btn {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--surface);
  font-size: 10px;
}

.filter-btn.active {
  border-color: var(--line-accent);
  color: var(--red-hot);
  background: rgba(229, 47, 87, 0.08);
}

.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.shop-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.shop-card.owned {
  border-color: rgba(109, 255, 156, 0.2);
}

.shop-card.equipped {
  border-color: var(--line-accent);
  box-shadow: 0 0 22px rgba(255, 49, 88, 0.12);
}

.shop-card-media {
  position: relative;
  aspect-ratio: 1 / 1.08;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 49, 88, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 49, 88, 0.055) 1px, transparent 1px),
    #090b11;
  background-size: 22px 22px;
}

.shop-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.shop-card-media.bg img {
  object-fit: cover;
  object-position: center;
}

.shop-status {
  position: absolute;
  top: 7px;
  right: 7px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 6px;
  border-radius: 7px;
  color: var(--muted);
  background: rgba(7, 8, 13, 0.8);
  font-size: 9px;
  backdrop-filter: blur(8px);
}

.shop-status svg {
  width: 10px;
  height: 10px;
}

.shop-status.ok {
  color: var(--ok);
}

.rarity {
  position: absolute;
  left: 7px;
  bottom: 7px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 49, 88, 0.32);
  border-radius: 6px;
  color: #ff9aad;
  background: rgba(7, 8, 13, 0.75);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.shop-card-body {
  display: flex;
  min-height: 150px;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
}

.shop-card h3 {
  font-family: var(--display);
  font-size: 12px;
}

.shop-card-body p {
  min-height: 38px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.shop-price {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--lime);
  font-size: 9px;
}

.shop-price .coin {
  width: 11px;
  height: 11px;
}

.shop-action {
  width: 100%;
  min-height: 34px;
  margin-top: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--card-2);
  font-size: 10px;
  font-weight: 700;
}

.shop-action.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--red-hot), var(--red-dark));
}

.shop-action.danger {
  border-color: rgba(255, 71, 111, 0.25);
  color: var(--danger);
  background: rgba(255, 71, 111, 0.05);
}

.shop-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* History, points and rules */
.history-block {
  margin-top: 25px;
}

.history-block h2 {
  margin-bottom: 10px;
  font-family: var(--display);
  font-size: 18px;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.tab {
  padding: 8px 12px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 10px;
}

.tab.active {
  color: #fff;
  background: var(--red);
}

.history-list,
.rules-card {
  display: grid;
  gap: 6px;
}

.history-row,
.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  font-size: 10px;
}

.history-row div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-row small,
.history-row > span {
  color: var(--muted);
}

.points-scroll {
  overflow-x: auto;
  margin: 0 -16px 22px;
  padding: 0 16px 8px;
}

.points-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 10px;
}

.points-table th,
.points-table td {
  min-width: 50px;
  padding: 10px 7px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.points-table th {
  color: var(--lime);
  background: var(--card-2);
}

.points-table thead th:first-child,
.points-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
}

.rule-row {
  justify-content: start;
  align-items: start;
}

.rule-row b {
  color: var(--violet);
  font-family: var(--display);
  font-size: 11px;
}

.rule-row p {
  color: var(--muted);
  line-height: 1.45;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 38px 15px;
  color: var(--muted);
  text-align: center;
  font-size: 10px;
}

.empty-state span {
  display: block;
  margin-bottom: 6px;
  color: var(--lime);
  font-size: 25px;
}

/* Bottom navigation */
.bottom-nav {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(9px + var(--safe-bottom));
  width: min(448px, calc(100% - 18px));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  gap: 4px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(12, 9, 10, 0.94);
  backdrop-filter: blur(20px);
  transform: translateX(-50%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

.nav-btn {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 10px;
  color: #857b7f;
}

.nav-btn svg {
  width: 19px;
  height: 19px;
}

.nav-btn span {
  overflow: hidden;
  max-width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 9px;
  font-weight: 600;
}

.nav-btn.active {
  color: var(--red-hot);
  background: rgba(255, 49, 88, 0.055);
  box-shadow: none;
}

.nav-btn.active::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 24px;
  height: 2px;
  border-radius: 2px;
  background: var(--red-hot);
  box-shadow: 0 0 10px rgba(255, 49, 88, 0.45);
}

/* Feedback states */
.toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: calc(var(--nav-h) + 26px);
  max-width: 88vw;
  padding: 10px 14px;
  border: 1px solid var(--line-accent);
  border-radius: 10px;
  color: var(--text);
  background: rgba(16, 12, 14, 0.96);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(12px);
  transition: 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%);
}

.loading-screen {
  min-height: calc(100vh - var(--nav-h));
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
}

.loader-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-accent);
  border-radius: 14px;
  color: var(--lime);
  font-family: var(--display);
  animation: loader 1.3s ease-in-out infinite;
}

@keyframes loader {
  50% { transform: rotate(45deg) scale(0.88); }
}

.error-card {
  margin: 30vh 18px 0;
  padding: 22px;
  border: 1px solid rgba(255, 71, 111, 0.22);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
}

.error-card span {
  font-family: var(--display);
  font-size: 15px;
}

.error-card p {
  margin: 7px 0 15px;
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 370px) {
  .hero-copy h1 { font-size: 28px; }
  .hero-copy { width: 70%; padding-left: 17px; }
  .hero-character { right: -18px; width: 78%; }
  .profile-metrics { gap: 4px 6px; }
}

@media (max-width: 410px) {
  .shop-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .shop-card {
    display: grid;
    grid-template-columns: 43% 1fr;
  }

  .shop-card-media {
    min-height: 210px;
    aspect-ratio: auto;
  }

  .shop-card-body {
    min-height: 210px;
    padding: 13px;
  }
}
