:root {
  color-scheme: dark;
  --bg: #111716;
  --panel: rgba(29, 36, 33, 0.82);
  --panel-solid: #1d2421;
  --ink: #f4fbf6;
  --muted: #aab8af;
  --line: rgba(255, 255, 255, 0.13);
  --accent: #35e0a1;
  --accent-strong: #1dbb7f;
  --danger: #ff6969;
  --warn: #ffd166;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -4;
  background:
    radial-gradient(circle at 72% 24%, rgba(139, 196, 255, 0.24), transparent 32%),
    radial-gradient(circle at 28% 84%, rgba(79, 141, 63, 0.28), transparent 34%),
    linear-gradient(180deg, #8ab5d6 0%, #547d77 34%, #253b2a 60%, #14160f 100%);
  background-position: center;
  background-size: cover;
  filter: saturate(0.98) contrast(1.08);
}

.store-scene-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 1;
}

.bg-terrain,
.bg-embers {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.bg-terrain {
  opacity: 0.28;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 50% 74%, rgba(135, 186, 92, 0.2), transparent 36%);
  background-position:
    0 0,
    0 0,
    0 0;
  background-size:
    64px 64px,
    64px 64px,
    cover;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.38) 38%, rgba(0, 0, 0, 0.8));
  animation: terrain-drift 42s linear infinite;
}

.bg-embers {
  opacity: 0.5;
  background-image:
    radial-gradient(circle at 18% 26%, rgba(255, 255, 255, 0.22) 0 1px, transparent 2px),
    radial-gradient(circle at 76% 18%, rgba(255, 255, 255, 0.18) 0 1px, transparent 2px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 28%, rgba(0, 0, 0, 0.48) 100%);
  background-position:
    0 0,
    42px 28px,
    center;
  background-size:
    180px 180px,
    260px 260px,
    cover;
  animation: ember-rise 34s linear infinite;
}

.store-auth,
.store-app,
.toast {
  position: relative;
  z-index: 2;
}

@keyframes terrain-drift {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(-56px, 56px, 0);
  }
}

@keyframes ember-rise {
  from {
    transform: translate3d(0, 96px, 0);
  }

  to {
    transform: translate3d(0, -96px, 0);
  }
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.34);
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

button.primary {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #081512;
  font-weight: 800;
}

button.ghost {
  background: transparent;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(53, 224, 161, 0.18);
}

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

.store-auth {
  display: grid;
  align-content: center;
  min-height: 100vh;
  padding: 32px clamp(16px, 5vw, 72px);
}

.auth-brand {
  position: fixed;
  top: 22px;
  left: clamp(16px, 5vw, 72px);
  z-index: 2;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: end;
  gap: clamp(24px, 6vw, 92px);
  width: min(1120px, 100%);
  margin: 0 auto;
}

.auth-panel h1 {
  max-width: 700px;
}

.auth-panel .login-panel {
  align-self: stretch;
  min-height: 360px;
  align-content: center;
}

.store-app {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
}

.store-sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 18px;
  height: 100vh;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: rgba(13, 17, 16, 0.84);
  backdrop-filter: blur(16px);
}

.store-tabs {
  display: grid;
  gap: 8px;
}

.sidebar-combat {
  position: relative;
  display: block;
  align-self: end;
  width: 100%;
  min-height: 188px;
  margin-top: auto;
  border: 0;
  border-radius: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
  box-shadow: none;
}

.sidebar-combat:hover,
.sidebar-combat.fighting {
  border: 0;
  background: transparent;
}

.sidebar-combat-stage {
  position: relative;
  display: block;
  width: 100%;
  height: 188px;
  overflow: visible;
  background:
    radial-gradient(ellipse at 50% 78%, rgba(53, 224, 161, 0.22), transparent 52%),
    linear-gradient(180deg, transparent 26%, rgba(26, 51, 35, 0.18) 78%, transparent);
}

.sidebar-combat-stage::before {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 10px;
  height: 46px;
  background:
    linear-gradient(90deg, rgba(62, 116, 45, 0.56), rgba(38, 82, 42, 0.6)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 20px);
  border-radius: 50%;
  filter: blur(0.2px);
  transform: perspective(220px) rotateX(58deg);
  transform-origin: bottom;
}

.duel-scene-canvas {
  position: absolute;
  inset: -8px -18px 0;
  width: calc(100% + 36px);
  height: 196px;
  pointer-events: auto;
  image-rendering: auto;
}

.store-tab {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 6px 10px;
  text-align: left;
  color: var(--muted);
}

.store-tab:hover,
.store-tab.active {
  border-color: rgba(53, 224, 161, 0.55);
  background: rgba(53, 224, 161, 0.12);
  color: var(--ink);
}

.store-tab.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.tab-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
  font-weight: 900;
}

.sidebar-logout {
  width: 100%;
  margin-top: 4px;
}

.store-content {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 22px clamp(16px, 4vw, 42px) 52px;
}

.store-market-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.store-market-panels {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.store-right-menu {
  position: sticky;
  top: 104px;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.store-content-topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: rgba(13, 17, 16, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.store-auth-actions {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.store-auth-actions button {
  flex: 0 0 auto;
}

.store-auth-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.store-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 16px clamp(16px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: rgba(13, 17, 16, 0.78);
  backdrop-filter: blur(16px);
}

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

.brand-logo {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.store-nav {
  display: flex;
  flex: 1 1 auto;
  gap: 8px;
  overflow-x: auto;
}

.store-nav a {
  flex: 0 0 auto;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 700;
}

.store-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.account-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-weight: 800;
}

.store-shell {
  display: grid;
  gap: 22px;
  max-width: 1420px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 52px) 56px;
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 22px;
  align-items: end;
  min-height: 360px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(53, 224, 161, 0.18), transparent 44%),
    rgba(29, 36, 33, 0.76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(34px, 5vw, 72px);
  line-height: 0.98;
}

.intro-copy {
  max-width: 560px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.login-panel,
.dashboard-strip,
.shop-section,
.library-block,
.showcase-card,
.biome-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-panel {
  display: grid;
  gap: 13px;
  padding: 18px;
}

.login-panel label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.login-panel label span,
.dashboard-strip span,
.product-meta,
.library-muted {
  color: var(--muted);
  font-size: 13px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title h2 {
  font-size: 24px;
}

.section-title span {
  color: var(--muted);
  font-weight: 700;
}

.dashboard-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.dashboard-strip div {
  min-width: 0;
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.dashboard-strip strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.showcase-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(74, 46, 24, 0.48), transparent 40%),
    linear-gradient(20deg, rgba(53, 224, 161, 0.2), transparent 52%),
    rgba(18, 22, 20, 0.82);
}

.showcase-canvas {
  display: block;
  width: 100%;
  height: 300px;
  min-height: 300px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(40, 62, 72, 0.5), rgba(26, 24, 18, 0.84)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 18px);
  cursor: grab;
}

.showcase-canvas:active {
  cursor: grabbing;
}

.showcase-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.showcase-copy span,
.biome-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.showcase-copy strong,
.biome-card strong {
  overflow-wrap: anywhere;
  font-size: 20px;
}

.showcase-copy small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.showcase-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.showcase-actions button {
  min-height: 38px;
  padding-inline: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-weight: 800;
}

.showcase-actions button.active,
.showcase-actions button:hover {
  border-color: rgba(53, 224, 161, 0.62);
  background: rgba(53, 224, 161, 0.15);
  color: var(--ink);
}

.biome-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  background:
    linear-gradient(90deg, rgba(67, 119, 58, 0.22), transparent),
    rgba(18, 22, 20, 0.78);
}

.shop-section {
  display: grid;
  gap: 16px;
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 36%),
    rgba(29, 36, 33, 0.3);
}

.tab-panel {
  min-width: 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.rank-grid {
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.product-card {
  position: relative;
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  overflow: hidden;
  backdrop-filter: blur(8px);
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--card-accent, var(--accent)) 16%, transparent), transparent 42%),
    rgba(255, 255, 255, 0.035);
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.product-card:hover {
  border-color: color-mix(in srgb, var(--card-accent, var(--accent)) 65%, rgba(255, 255, 255, 0.18));
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--card-accent, var(--accent)) 22%, transparent), transparent 46%),
    rgba(255, 255, 255, 0.055);
  transform: translateY(-2px);
}

.product-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 3px solid var(--card-accent, var(--accent));
  opacity: 0.85;
  pointer-events: none;
}

.product-media {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--card-accent, var(--accent)) 25%, rgba(255, 255, 255, 0.08));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 44%),
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--card-accent, var(--accent)) 24%, transparent), transparent 62%),
    rgba(0, 0, 0, 0.14);
}

.skin-grid .product-media {
  height: 190px;
}

.product-media .product-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
  transform: scale(1.01);
  transition: transform 180ms ease;
}

.product-card:hover .product-art {
  transform: scale(1.04);
}

.skin-grid .product-media img {
  max-height: 180px;
}

.product-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.product-title h3 {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.price {
  flex: 0 0 auto;
  color: var(--warn);
  font-weight: 900;
}

.product-desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-list span {
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.product-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.product-actions button {
  flex: 1 1 auto;
}

.library-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 14px;
}

.library-block {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 14px;
}

.owned-list,
.history-list {
  display: grid;
  gap: 8px;
}

.owned-item,
.history-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.owned-row,
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.owned-row strong,
.history-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #07100d;
  color: var(--ink);
  box-shadow: var(--shadow);
}

@media (max-width: 940px) {
  .store-topbar,
  .section-title,
  .product-title,
  .owned-row,
  .history-row {
    align-items: stretch;
    flex-direction: column;
  }

  .intro-band,
  .dashboard-strip,
  .library-layout,
  .store-market-layout {
    grid-template-columns: 1fr;
  }

  .store-right-menu {
    position: static;
    order: -1;
  }

  .showcase-card {
    grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1fr);
    align-items: center;
  }

  .showcase-canvas {
    height: 240px;
    min-height: 240px;
  }

  .showcase-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .store-nav {
    order: 3;
    width: 100%;
  }

  .store-auth {
    align-content: start;
    padding-top: 24px;
  }

  .auth-brand {
    position: static;
    margin-bottom: 54px;
  }

  .auth-panel,
  .store-app {
    grid-template-columns: 1fr;
  }

  .auth-panel .login-panel {
    min-height: auto;
  }

  .store-sidebar {
    position: sticky;
    z-index: 6;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .store-tabs {
    grid-template-columns: repeat(4, minmax(112px, 1fr));
    overflow-x: auto;
  }

  .store-tab {
    grid-template-columns: 1fr;
    justify-items: center;
    min-width: 112px;
    text-align: center;
  }

  .store-tab.active {
    box-shadow: inset 0 -3px 0 var(--accent);
  }

  .store-content {
    padding: 14px;
  }

  .store-content-topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .store-auth-actions {
    width: 100%;
  }

  .store-auth-actions #openLoginBtn {
    flex: 1 1 auto;
  }
}

@media (max-width: 560px) {
  .store-shell {
    padding-inline: 12px;
  }

  .intro-band,
  .shop-section,
  .showcase-card {
    padding: 14px;
  }

  .product-grid,
  .rank-grid {
    grid-template-columns: 1fr;
  }

  .store-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .showcase-card,
  .showcase-actions {
    grid-template-columns: 1fr;
  }

  .showcase-canvas {
    height: 220px;
    min-height: 220px;
  }

  .store-tab {
    min-width: 0;
  }

  h1 {
    font-size: 34px;
  }
}
