/* ============================================
   BRO-BLOCKO — Neo-Brutalism Game Stylesheet
   ============================================ */

/* Google Fonts loaded via index.html <link> tag */

/* === Design Tokens === */
:root {
  /* 画布 */
  --bg-primary:     #FFFDF5;
  --bg-battlefield: #F5F0E8;
  --bg-card:        #FFFFFF;

  /* 角色色 */
  --color-warrior:  #FF6B6B;
  --color-shooter:  #4ECDC4;
  --color-engineer: #A8E6CF;

  /* 怪物色 */
  --color-enemy-basic:  #95E1D3;
  --color-enemy-fast:   #FF8B94;
  --color-enemy-ranged: #C3AED6;
  --color-boss:         #FFD93D;

  /* UI 强调色 */
  --color-accent:   #FF6B6B;
  --color-accent-2: #FFD93D;
  --color-accent-3: #4ECDC4;

  /* 稀有度 */
  --rarity-common: #FFFFFF;
  --rarity-rare:   #87CEEB;
  --rarity-epic:   #C3AED6;
  --rarity-legend: #FF6B6B;

  /* 文字 */
  --text-primary: #000000;
  --text-inverse: #FFFFFF;

  /* Neo-Brutalism 结构 */
  --neo-border-width: 4px;
  --neo-border-color: #000000;
  --neo-shadow-offset: 6px;
  --neo-shadow-color: #000000;
  --neo-radius: 0px;

  /* 字体 */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Space Mono', monospace;

  /* 间距 */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* 描边 */
  --border-thick: 4px solid var(--neo-border-color);
  --border-thin:  2px solid var(--neo-border-color);

  /* 阴影 */
  --shadow-hard:    6px 6px 0px var(--neo-shadow-color);
  --shadow-hard-sm: 3px 3px 0px var(--neo-shadow-color);
  --shadow-hard-lg: 8px 8px 0px var(--neo-shadow-color);
  --shadow-hard-xl: 10px 10px 0px var(--neo-shadow-color);

  /* 动画 */
  --duration-press: 100ms;
  --duration-hover: 150ms;
  --duration-enter: 300ms;
  --easing-press:   cubic-bezier(0.4, 0, 0.2, 1);
  --easing-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

body {
  background: var(--bg-primary);
  font-family: var(--font-body);
  color: var(--text-primary);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  cursor: default;
}

/* === Canvas === */
#gameCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
}

/* === Screen Layers === */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: var(--bg-primary);
}

.hidden {
  display: none !important;
}

.screen-inner {
  max-width: 720px;
  width: 90%;
  padding: var(--space-2xl);
}

.screen-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 36px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-xl);
  text-align: center;
}

/* === Menu === */
.menu-container {
  text-align: center;
}

.game-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 72px;
  text-transform: uppercase;
  letter-spacing: 0;
  line-height: 1;
  margin-bottom: var(--space-sm);
  /* 贴纸感：硬描边文字 */
  -webkit-text-stroke: 3px #000;
  paint-order: stroke fill;
  color: var(--color-accent);
  text-shadow: 6px 6px 0px #000;
}

.game-subtitle {
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-bottom: var(--space-2xl);
  color: var(--text-primary);
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

/* === Buttons === */
.neo-btn {
  display: inline-block;
  background: var(--color-accent);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard);
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: pointer;
  transition: transform var(--duration-press) var(--easing-press),
              box-shadow var(--duration-press) var(--easing-press);
  outline: none;
  user-select: none;
  min-width: 200px;
  text-align: center;
  position: relative;
}

.neo-btn::after {
  content: '';
  position: absolute;
  inset: 4px -8px -8px 4px;
  border-right: 2px solid rgba(0,0,0,0.18);
  border-bottom: 2px solid rgba(0,0,0,0.18);
  pointer-events: none;
}

.neo-btn:hover {
  transform: translate(2px, 2px);
  box-shadow: 4px 4px 0px #000;
}

.neo-btn:active {
  transform: translate(6px, 6px);
  box-shadow: 0px 0px 0px #000;
}

.neo-btn:focus-visible {
  outline: 3px dashed var(--color-accent-2);
  outline-offset: 4px;
}

.neo-btn-primary {
  background: var(--color-accent);
  color: var(--text-inverse);
}

.neo-btn-secondary {
  background: var(--color-accent-3);
  color: var(--text-primary);
}

.neo-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: var(--shadow-hard) !important;
}

/* === Cards === */
.neo-card {
  background: var(--bg-card);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard);
  padding: var(--space-lg);
  position: relative;
  transition: transform var(--duration-hover) var(--easing-press),
              box-shadow var(--duration-hover) var(--easing-press);
}

.neo-card:hover {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-hard-sm);
}

/* === Character Select === */
.char-cards {
  display: flex;
  gap: var(--space-lg);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-xl);
}

.char-card {
  width: 200px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transform: rotate(-1deg);
}

.char-card:nth-child(2) {
  transform: rotate(1deg);
}

.char-card:nth-child(3) {
  transform: rotate(-0.5deg);
}

.char-card.selected {
  border-color: var(--color-accent-2);
  box-shadow: var(--shadow-hard-xl);
  transform: translate(-3px, -3px) rotate(0deg);
}

.char-card.selected::after {
  content: 'PICKED';
  position: absolute;
  top: -14px;
  right: -16px;
  background: var(--color-accent-2);
  border: var(--border-thin);
  box-shadow: var(--shadow-hard-sm);
  padding: 2px 8px;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  transform: rotate(5deg);
}

.char-card-preview {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-md);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(2deg);
}

.char-card-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.char-card-desc {
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.8;
}

/* === Level Up === */
.levelup-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  max-width: 500px;
  margin: 0 auto;
}

.levelup-option {
  cursor: pointer;
  text-align: center;
  padding: var(--space-lg);
  transition: transform var(--duration-press) var(--easing-press);
}

.levelup-option:hover {
  transform: translate(3px, 3px);
  box-shadow: 3px 3px 0px #000;
}

.levelup-option-icon {
  font-size: 32px;
  margin-bottom: var(--space-sm);
}

.levelup-option-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
}

.levelup-option-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-accent);
}

.levelup-option-current {
  font-size: 11px;
  opacity: 0.6;
  margin-top: var(--space-xs);
}

/* === Shop === */
.shop-layout {
  max-width: 880px;
  max-height: 78vh;
  display: flex;
  gap: var(--space-lg);
  align-items: stretch;
  overflow: hidden;
}

/* 左侧边栏 */
.shop-sidebar {
  width: 190px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  overflow-y: auto;
}

.shop-sidebar-card {
  background: var(--bg-card);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard-sm);
  padding: var(--space-sm) var(--space-md);
}

.shop-sidebar-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: var(--space-xs);
  opacity: 0.6;
}

.shop-gold {
  text-align: center;
  padding: var(--space-xs) 0;
}

.shop-gold-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  color: var(--color-accent-2);
  line-height: 1;
}

.shop-stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.shop-stats .neo-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  padding: 2px 6px;
}

.shop-stats .neo-badge svg {
  flex-shrink: 0;
}

/* 卖出列表 */
.shop-sell-item {
  cursor: pointer;
  border: 2px solid var(--color-accent);
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  transition: transform 100ms, box-shadow 100ms;
}

.shop-sell-item:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px #000;
}

.shop-sell-item span:first-child {
  font-weight: 700;
}

.shop-sell-item-price {
  margin-left: auto;
  color: var(--color-accent-3);
  font-weight: 700;
}

/* 右侧主区域（自滚动）*/
.shop-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding-right: var(--space-sm);
}

.shop-section {
  margin-bottom: var(--space-md);
}

.shop-section:last-child {
  margin-bottom: 0;
}

.shop-section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: var(--border-thin);
  display: inline-block;
  background: var(--color-accent-2);
  border: var(--border-thin);
  box-shadow: var(--shadow-hard-sm);
  padding: 3px 10px;
  transform: rotate(-1deg);
}

.shop-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.shop-item {
  text-align: center;
  cursor: pointer;
  padding: 12px 8px 14px;
  position: relative;
  min-height: 124px;
  overflow: visible;
}

.shop-item:nth-child(odd) {
  transform: rotate(-0.6deg);
}

.shop-item:nth-child(even) {
  transform: rotate(0.6deg);
}

.shop-item:hover {
  transform: translate(2px, 2px) rotate(0deg);
}

.shop-item::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 12px;
  width: 38px;
  height: 12px;
  background: rgba(255, 217, 61, 0.78);
  border: 2px solid #000;
  transform: rotate(-5deg);
}

.shop-item.sold {
  cursor: not-allowed;
  pointer-events: none;
}

.shop-item.sold::after {
  content: 'SOLD';
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-12deg);
  background: var(--color-accent);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard-sm);
  color: #fff;
  padding: 4px 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 2px;
}

.shop-item.unaffordable {
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.shop-item.unaffordable::after {
  content: '';
  position: absolute;
  inset: 8px;
  background: repeating-linear-gradient(
    -45deg,
    rgba(0,0,0,0.08) 0 8px,
    rgba(0,0,0,0) 8px 16px
  );
  pointer-events: none;
}

.shop-item-preview {
  width: 44px;
  height: 44px;
  margin: 0 auto var(--space-sm);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  transform: rotate(-2deg);
}

.shop-item-name {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-xs);
  min-height: 28px;
}

.shop-item-price {
  display: inline-block;
  background: var(--color-accent-2);
  border: var(--border-thin);
  box-shadow: 2px 2px 0 #000;
  padding: 1px 8px;
  font-weight: 700;
  font-size: 14px;
  color: #000;
  transform: rotate(1deg);
}

/* 底部吸底操作栏 */
.shop-footer {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
  border-top: var(--border-thick);
  margin-top: var(--space-md);
  background: var(--bg-primary);
}

.shop-sidebar .neo-btn {
  width: 100%;
}

/* === Badges === */
.neo-badge {
  display: inline-block;
  padding: 2px 8px;
  border: 2px solid #000;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.neo-badge-common  { background: var(--rarity-common); color: #000; }
.neo-badge-rare    { background: var(--rarity-rare); color: #000; }
.neo-badge-epic    { background: var(--rarity-epic); color: #000; }
.neo-badge-legend  { background: var(--rarity-legend); color: #fff; }

/* === Health Bar === */
.neo-health-bar {
  width: 200px;
  height: 20px;
  background: var(--bg-primary);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard);
  overflow: hidden;
  transform: rotate(-0.4deg);
}

.neo-health-bar-fill {
  height: 100%;
  background: var(--color-accent);
  transition: width 200ms ease;
  width: 100%;
}

/* === HUD === */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}



.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-md);
}

.hud-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.hud-weapon-slots {
  display: flex;
  gap: 7px;
}

.hud-weapon-slot {
  min-width: 38px;
  height: 38px;
  padding: 0 4px;
  background: var(--bg-card);
  border: 3px solid #000;
  box-shadow: var(--shadow-hard-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  transform: rotate(2deg);
}

.hud-weapon-slot:nth-child(even) {
  transform: rotate(-2deg);
}

.hud-weapon-slot svg {
  filter: drop-shadow(1px 1px 0 #000);
}

.hud-right {
  text-align: right;
}

.hud-label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0.7;
  background: var(--bg-card);
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  padding: 1px 5px;
}

.hud-wave-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  margin-left: var(--space-xs);
}

.hud-timer {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 48px;
  line-height: 1;
  margin-top: var(--space-xs);
  /* 数字大字报风格 */
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
  color: var(--color-accent-2);
  text-shadow: 4px 4px 0 #000;
  transform: rotate(-2deg);
}

.hud-bottom {
  position: fixed;
  bottom: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: var(--space-xl);
  align-items: center;
  padding: 4px;
}

.hud-gold {
  background: var(--bg-card);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  transform: rotate(1deg);
}

.hud-gold-icon {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--color-accent-2);
}

.hud-gold-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
}


.hud-exp-bar {
  width: 240px;
  height: 24px;
  background: var(--bg-card);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard);
  position: relative;
  overflow: hidden;
  transform: rotate(-0.6deg);
}

.hud-exp-fill {
  height: 100%;
  background: var(--color-accent-3);
  transition: width 200ms ease;
  width: 0%;
}

.hud-exp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-primary);
  white-space: nowrap;
  pointer-events: none;
}

/* === Stats Panel === */
.stats-panel {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  pointer-events: none;
  background: var(--bg-card);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard);
  padding: var(--space-md);
  min-width: 300px;
  transform: translateX(-50%) rotate(-0.5deg);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.stats-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xs);
  font-size: 11px;
}

.stats-item-icon {
  font-size: 16px;
  margin-bottom: 2px;
}

.stats-item-value {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
}

.stats-item-label {
  font-size: 10px;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* === Game Over === */
.gameover-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.gameover-actions {
  text-align: center;
  margin-top: var(--space-lg);
}

.gameover-stat {
  background: var(--bg-card);
  border: var(--border-thin);
  box-shadow: var(--shadow-hard-sm);
  padding: var(--space-sm) var(--space-lg);
  display: flex;
  justify-content: space-between;
  width: 280px;
  font-size: 14px;
}

.gameover-stat-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.gameover-stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}

/* === How To Play === */
.howto-content {
  max-width: 560px;
}

.howto-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.howto-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.howto-card p {
  font-size: 13px;
  line-height: 1.5;
}

/* === Wave Announcement === */
.wave-announce {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 72px;
  text-transform: uppercase;
  -webkit-text-stroke: 3px #000;
  paint-order: stroke fill;
  color: var(--color-accent-2);
  text-shadow: 8px 8px 0px #000;
  animation: waveAnnounce 1.5s var(--easing-spring) forwards;
  pointer-events: none;
}

@keyframes waveAnnounce {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(2); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* === Tutorial Hint === */
.tutorial-hint {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
}

.tutorial-hint-text {
  background: var(--bg-card);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 1px;
  white-space: nowrap;
  animation: tutorialFade 6s ease forwards;
  transform: rotate(-0.7deg);
}

.tutorial-hint-text strong {
  display: inline-block;
  background: var(--color-accent-2);
  border: 2px solid #000;
  padding: 0 3px;
  line-height: 1.2;
}

@keyframes tutorialFade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

@media (max-width: 520px) {
  .hud-top {
    padding: 10px 12px;
  }

  .hud-left {
    gap: 8px;
  }

  .neo-health-bar {
    width: 202px;
    height: 21px;
  }

  .hud-weapon-slot {
    min-width: 36px;
    height: 36px;
  }

  .hud-right {
    transform: translateY(-2px);
  }

  .hud-label {
    font-size: 10px;
    letter-spacing: 1px;
  }

  .hud-wave-num {
    font-size: 18px;
  }

  .hud-timer {
    font-size: 44px;
  }

  .hud-bottom {
    width: calc(100vw - 40px);
    bottom: 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: end;
  }

  .hud-exp-bar {
    width: 100%;
    min-width: 0;
  }

  .hud-gold {
    min-width: 76px;
    justify-content: center;
    padding: 7px 10px;
  }

  .tutorial-hint {
    bottom: 108px;
    width: calc(100vw - 24px);
  }

  .tutorial-hint-text {
    max-width: 100%;
    padding: 7px 8px;
    font-size: 10px;
    letter-spacing: 0;
    text-align: center;
    white-space: normal;
    line-height: 1.45;
    overflow: visible;
  }
}

/* === Refined Flat Brutalist Pass === */
.neo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.neo-btn .btn-icon {
  flex: 0 0 auto;
  transition: transform var(--duration-hover) var(--easing-spring);
}

.neo-btn:hover .btn-icon {
  transform: translateX(2px);
}

.char-card,
.char-card:nth-child(2),
.char-card:nth-child(3) {
  transform: none;
}

.char-card:hover {
  transform: translate(2px, 2px);
}

.char-card.selected {
  transform: translate(-2px, -2px);
}

.char-card-preview,
.shop-section-title,
.shop-item,
.shop-item:nth-child(odd),
.shop-item:nth-child(even),
.shop-item-preview,
.shop-item-price,
.neo-health-bar,
.hud-weapon-slot,
.hud-weapon-slot:nth-child(even),
.hud-timer,
.hud-gold,
.hud-exp-bar,
.tutorial-hint-text {
  transform: none;
}

.shop-section-title {
  background: #000;
  color: #fff;
  box-shadow: 4px 4px 0 #000;
}

.shop-item {
  min-height: 132px;
  height: 154px;
  padding: 18px 10px 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.96)),
    linear-gradient(135deg, rgba(0,0,0,0.05) 0 25%, transparent 25% 50%, rgba(0,0,0,0.05) 50% 75%, transparent 75%);
  background-size: auto, 18px 18px;
  overflow: hidden;
}

.shop-item:hover {
  transform: translate(2px, 2px);
}

.shop-item::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  width: auto;
  height: 7px;
  border: 0;
  background: #000;
  transform: none;
}

.shop-item-tier-1::before { background: #000; }
.shop-item-tier-2::before { background: var(--rarity-rare); }
.shop-item-tier-3::before { background: var(--rarity-epic); }
.shop-item-tier-4::before { background: var(--rarity-legend); }

.shop-item-rarity {
  position: absolute;
  top: 13px;
  right: 10px;
  padding: 1px 5px;
  font-size: 8px;
  letter-spacing: 1px;
  z-index: 1;
}

.shop-item-preview {
  width: 48px;
  height: 48px;
  margin-top: 8px;
  background: #fff;
  transition: transform var(--duration-hover) var(--easing-spring);
}

.shop-item:hover .shop-item-preview {
  transform: translateY(-2px);
}

.shop-item-preview svg,
.levelup-option-icon svg,
.hud-weapon-slot svg,
.hud-gold-icon svg,
.shop-item-price svg,
.shop-sell-item-price svg,
.shop-item-merge svg {
  display: block;
}

.shop-item-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.shop-item-price svg {
  width: 14px;
  height: 14px;
}

.shop-item-desc {
  margin-top: 5px;
  height: 22px;
  font-size: 9px;
  line-height: 1.25;
  opacity: 0.68;
  overflow: hidden;
}

.shop-item-merge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 2px 6px;
  background: var(--color-accent);
  border: 2px solid #000;
  box-shadow: 2px 2px 0 #000;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

.shop-sell-item-price {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.hud-top {
  padding: 18px;
}

.hud-weapon-slot {
  position: relative;
  border-color: #000 !important;
}

.hud-weapon-slot::before {
  content: '';
  position: absolute;
  inset: 3px auto auto 3px;
  width: 7px;
  height: 7px;
  background: var(--color-accent-2);
  border: 1px solid #000;
}

.hud-weapon-slot svg {
  filter: none;
}

.hud-gold-icon {
  display: flex;
  align-items: center;
}

.hud-gold-icon svg {
  width: 22px;
  height: 22px;
}

.levelup-option {
  display: grid;
  grid-template-columns: 52px 1fr;
  grid-template-areas:
    "icon name"
    "icon value"
    "icon current";
  align-items: center;
  text-align: left;
  gap: 2px 12px;
}

.levelup-option-icon {
  grid-area: icon;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent-2);
  border: var(--border-thick);
  box-shadow: var(--shadow-hard-sm);
  margin: 0;
}

.levelup-option-icon svg {
  width: 28px;
  height: 28px;
}

.levelup-option-name { grid-area: name; margin: 0; }
.levelup-option-value { grid-area: value; }
.levelup-option-current { grid-area: current; }

.levelup-option:hover .levelup-option-icon,
.shop-item:hover .shop-item-preview svg,
.hud-weapon-slot:hover svg {
  animation: flatIconPop 420ms var(--easing-spring);
}

.tutorial-hint-text {
  background: #fff;
}

@keyframes flatIconPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.12) translateY(-1px); }
  100% { transform: scale(1); }
}

@media (max-width: 520px) {
  .hud-top {
    padding: 10px 12px;
  }

  .hud-bottom {
    width: calc(100vw - 40px);
    bottom: 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: end;
  }

  .hud-exp-bar {
    width: 100%;
  }

  .tutorial-hint {
    bottom: 108px;
    width: calc(100vw - 24px);
  }

  .tutorial-hint-text {
    white-space: normal;
    line-height: 1.45;
  }

  .levelup-options {
    grid-template-columns: 1fr;
  }

  .levelup-option {
    grid-template-columns: 46px 1fr;
  }
}

/* === Refined Toy-Brutalism Polish === */
:root {
  --bg-primary: #fffaf0;
  --bg-battlefield: #f6efe2;
  --bg-card: #fffefa;
  --ink: #18130f;
  --ink-soft: rgba(24, 19, 15, 0.82);
  --paper: #fffefa;
  --paper-warm: #fff2d1;
  --paper-cool: #e9fbf6;
  --color-accent: #ff6469;
  --color-accent-2: #ffd84d;
  --color-accent-3: #46d6c8;
  --neo-border-width: 2px;
  --neo-border-color: var(--ink);
  --neo-shadow-color: rgba(24, 19, 15, 0.92);
  --neo-shadow-offset: 3px;
  --neo-radius: 6px;
  --font-body: 'Space Mono', "Microsoft YaHei", "PingFang SC", sans-serif;
  --border-thick: 3px solid var(--ink);
  --border-thin: 2px solid var(--ink);
  --shadow-hard: 3px 3px 0 var(--neo-shadow-color);
  --shadow-hard-sm: 2px 2px 0 var(--neo-shadow-color);
  --shadow-hard-lg: 4px 4px 0 var(--neo-shadow-color);
  --shadow-hard-xl: 5px 5px 0 var(--neo-shadow-color);
}

body {
  background:
    linear-gradient(rgba(24, 19, 15, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 19, 15, 0.035) 1px, transparent 1px),
    var(--bg-primary);
  background-size: 44px 44px, 44px 44px, auto;
  color: var(--ink);
}

.screen {
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 216, 77, 0.26), transparent 26%),
    radial-gradient(circle at 84% 78%, rgba(70, 214, 200, 0.18), transparent 24%),
    var(--bg-primary);
}

.game-title {
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 4px 4px 0 var(--ink);
}

.screen-title {
  color: var(--ink);
  letter-spacing: 0;
}

.neo-btn {
  border: 3px solid var(--ink);
  border-radius: 7px;
  box-shadow: var(--shadow-hard-lg);
  letter-spacing: 1px;
  color: var(--ink);
}

.neo-btn-primary {
  color: #fff;
}

.neo-btn::after {
  inset: auto;
  border: 0;
}

.neo-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: var(--shadow-hard);
}

.neo-btn:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

.neo-btn:disabled {
  box-shadow: var(--shadow-hard-lg) !important;
}

.neo-btn svg,
.btn-icon {
  stroke-width: 2.35;
}

.neo-card {
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow-hard-lg);
  background: var(--paper);
}

.neo-card:hover {
  transform: translate(1px, 1px);
  box-shadow: var(--shadow-hard);
}

.neo-badge {
  border: 2px solid var(--ink);
  border-radius: 4px;
  letter-spacing: 0.8px;
}

.char-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,250,240,0.96)),
    var(--paper);
}

.char-card.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--color-accent-2), var(--shadow-hard-lg);
}

.char-card.selected::after {
  border: 2px solid var(--ink);
  border-radius: 4px;
  box-shadow: var(--shadow-hard-sm);
}

.char-card-preview,
.levelup-option-icon {
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: var(--shadow-hard-sm);
}

.shop-layout {
  max-width: 920px;
  gap: 22px;
}

.shop-sidebar {
  width: 204px;
}

.shop-sidebar-card {
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow-hard);
  background: rgba(255, 254, 250, 0.94);
}

.shop-sidebar-card h3 {
  color: var(--ink-soft);
  opacity: 1;
  letter-spacing: 1px;
}

.shop-gold-amount {
  color: var(--ink);
  text-shadow: 2px 2px 0 var(--color-accent-2);
}

.shop-stats .neo-badge {
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  background: #fff;
  font-size: 9px;
}

.shop-sell-item {
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: var(--paper-cool);
}

.shop-section {
  margin-bottom: 18px;
}

.shop-section-title {
  background: var(--ink);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 5px;
  box-shadow: 3px 3px 0 rgba(24, 19, 15, 0.55);
  font-size: 13px;
  letter-spacing: 1px;
  padding: 4px 12px;
}

.shop-items {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 14px;
}

.shop-item {
  height: 184px;
  min-height: 184px;
  padding: 17px 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  box-shadow: var(--shadow-hard);
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.98), rgba(255, 248, 232, 0.98)),
    var(--paper);
}

.shop-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.shop-item:hover {
  transform: translate(1px, 1px);
  box-shadow: var(--shadow-hard-sm);
}

.shop-item::before {
  height: 5px;
  border-radius: 9px 9px 0 0;
  background: var(--ink);
}

.shop-item.unaffordable {
  opacity: 0.84;
  filter: saturate(0.82);
}

.shop-item.unaffordable::after {
  inset: 0;
  background: rgba(255, 250, 240, 0.22);
}

.shop-item.sold::after {
  border: 2px solid var(--ink);
  border-radius: 5px;
  box-shadow: var(--shadow-hard);
}

.shop-item-rarity {
  top: 11px;
  right: 46px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  font-size: 8px;
  background: #fff;
}

.shop-item-preview {
  width: 50px;
  height: 50px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  box-shadow: var(--shadow-hard-sm);
  background: #fff;
}

.shop-item-body {
  display: flex;
  min-height: 112px;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding-top: 4px;
}

.shop-item-preview svg,
.levelup-option-icon svg,
.hud-weapon-slot svg,
.hud-gold-icon svg,
.shop-item-price svg,
.shop-sell-item-price svg,
.shop-item-merge svg {
  stroke-width: 2.35;
}

.shop-item-name {
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0;
  color: var(--ink);
  min-height: 18px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-item-meta {
  min-height: 14px;
  color: rgba(24, 19, 15, 0.62);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.shop-item-footer {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  padding-bottom: 12px;
}

.shop-item-price {
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 rgba(24, 19, 15, 0.72);
  padding: 2px 9px;
  background: var(--color-accent-2);
}

.shop-item-desc {
  color: rgba(24, 19, 15, 0.7);
  max-width: 100%;
}

.shop-item-merge {
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 rgba(24, 19, 15, 0.72);
  margin-top: 0;
  background: var(--color-accent-3);
  color: var(--ink);
}

.shop-item-note {
  width: 100%;
  color: rgba(24, 19, 15, 0.62);
  font-size: 8px;
  font-weight: 700;
}

.shop-item.merge-ready {
  box-shadow: 0 0 0 3px rgba(70, 214, 200, 0.38), var(--shadow-hard);
}

.shop-item.slots-full {
  cursor: not-allowed;
}

.shop-item.locked {
  box-shadow: 0 0 0 3px rgba(255, 216, 77, 0.55), var(--shadow-hard);
}

.shop-lock-btn {
  position: absolute;
  top: 10px;
  right: 9px;
  z-index: 2;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper-warm);
  color: var(--ink);
  padding: 2px 7px;
  font-family: var(--font-body);
  font-size: 8px;
  font-weight: 700;
  cursor: pointer;
}

.shop-item.locked .shop-lock-btn {
  background: var(--color-accent-2);
}

.shop-wave-preview {
  grid-column: 1 / -1;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper-cool);
  box-shadow: var(--shadow-hard-sm);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
}

.shop-wave-preview span {
  color: rgba(24, 19, 15, 0.58);
}

.shop-wave-preview strong {
  font-family: var(--font-display);
  font-size: 15px;
}

.shop-wave-preview em {
  margin-left: auto;
  font-style: normal;
}

.shop-footer {
  border-top: 2px solid rgba(24, 19, 15, 0.8);
  background: transparent;
}

.shop-loadout-card h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.shop-loadout-card h3 span {
  color: var(--ink);
  font-family: var(--font-body);
}

.shop-main > .shop-loadout-card {
  margin-bottom: 16px;
}

.shop-loadout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.shop-loadout-slot {
  position: relative;
  min-height: 46px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
  border: 1.5px solid var(--ink);
  border-radius: 7px;
  background: #fff;
}

.shop-loadout-slot::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 7px 0 0 7px;
  background: var(--ink);
}

.shop-loadout-tier-2::before { background: var(--rarity-rare); }
.shop-loadout-tier-3::before { background: var(--rarity-epic); }
.shop-loadout-tier-4::before { background: var(--rarity-legend); }

.shop-loadout-slot.can-merge {
  background: linear-gradient(90deg, rgba(70, 214, 200, 0.24), #fff 42%);
}

.shop-loadout-slot.empty {
  min-height: 34px;
  display: flex;
  justify-content: center;
  border-style: dashed;
  color: rgba(24, 19, 15, 0.42);
  background: rgba(255, 255, 255, 0.54);
}

.shop-loadout-slot.empty::before {
  display: none;
}

.shop-loadout-empty {
  font-size: 9px;
  font-weight: 700;
}

.shop-loadout-icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 3px;
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  background: var(--paper-cool);
}

.shop-loadout-icon svg {
  width: 20px;
  height: 20px;
}

.shop-loadout-info {
  min-width: 0;
}

.shop-loadout-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
}

.shop-loadout-meta {
  color: rgba(24, 19, 15, 0.58);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.shop-loadout-merge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--color-accent-3);
}

.shop-loadout-merge svg {
  width: 12px;
  height: 12px;
}

.shop-loadout-sell {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: rgba(255, 216, 77, 0.42);
  color: var(--ink);
  padding: 2px 5px;
  font-family: var(--font-body);
  font-size: 8px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.78;
}

.shop-loadout-sell:hover {
  opacity: 1;
  background: var(--color-accent-2);
}

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

.neo-health-bar {
  width: 210px;
  height: 18px;
  border: 3px solid var(--ink);
  border-radius: 5px;
  box-shadow: var(--shadow-hard);
  background: #fff;
}

.neo-health-bar-fill {
  background: linear-gradient(90deg, #ff6469, #ff7f83);
}

.hud-top {
  padding: 16px 18px;
}

.hud-weapon-slots {
  gap: 8px;
}

.hud-weapon-slot {
  min-width: 36px;
  height: 36px;
  border: 2px solid var(--ink) !important;
  border-radius: 6px;
  box-shadow: var(--shadow-hard-sm);
  background: rgba(255, 254, 250, 0.94);
}

.hud-weapon-slot::before {
  width: 6px;
  height: 6px;
  border: 1px solid var(--ink);
  border-radius: 2px;
}

.hud-label {
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: 2px 2px 0 rgba(24, 19, 15, 0.58);
  background: rgba(255, 254, 250, 0.92);
  opacity: 1;
}

.hud-wave-num {
  color: var(--ink);
}

.hud-timer {
  -webkit-text-stroke: 1.4px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
}

.hud-bottom {
  gap: 20px;
}

.hud-exp-bar {
  width: 250px;
  height: 22px;
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow: var(--shadow-hard);
  background: rgba(255, 254, 250, 0.94);
}

.hud-exp-fill {
  background: linear-gradient(90deg, var(--color-accent-3), #8df0df);
}

.hud-gold {
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow-hard);
  background: rgba(255, 254, 250, 0.94);
}

.stats-panel,
.tutorial-hint-text,
.gameover-stat {
  border: 2px solid var(--ink);
  border-radius: 7px;
  box-shadow: var(--shadow-hard);
}

.tutorial-hint-text strong {
  border: 1.5px solid var(--ink);
  border-radius: 3px;
}

.levelup-option {
  border: 2px solid var(--ink);
  border-radius: 9px;
  box-shadow: var(--shadow-hard);
}

.levelup-option:hover {
  transform: translate(1px, 1px);
  box-shadow: var(--shadow-hard-sm);
}

@media (max-width: 520px) {
  .neo-health-bar {
    width: 190px;
    height: 18px;
  }

  .hud-top {
    padding: 10px 12px;
  }

  .hud-weapon-slot {
    min-width: 34px;
    height: 34px;
  }

  .hud-timer {
    font-size: 40px;
  }

  .hud-bottom {
    gap: 10px;
  }

  .hud-exp-bar {
    height: 22px;
  }

  .shop-layout {
    width: calc(100vw - 28px);
    max-height: calc(100vh - 178px);
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    align-items: stretch;
    padding: 18px 10px 24px;
  }

  .shop-sidebar {
    width: 100%;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr;
  }

  .shop-sidebar .screen-title {
    margin-bottom: 0;
  }

  .shop-main {
    width: 100%;
    overflow: visible;
    padding-right: 0;
  }

  .shop-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .shop-item {
    height: 174px;
    min-height: 174px;
  }

  .shop-item-body {
    min-height: 100px;
  }

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

  .shop-loadout-slot {
    min-height: 42px;
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .shop-loadout-merge,
  .shop-loadout-sell {
    grid-column: 2;
    justify-self: start;
  }

  .shop-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 12px 14px;
    margin-top: 0;
    gap: 10px;
    background: linear-gradient(180deg, rgba(255,250,240,0), var(--bg-primary) 24%);
  }

  .shop-footer .neo-btn {
    min-width: 0 !important;
    flex: 1 1 0;
    padding: 10px 12px !important;
  }
}

/* === Scrollbar (hide) === */
::-webkit-scrollbar { display: none; }
body { -ms-overflow-style: none; scrollbar-width: none; }

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* === Button Shake (金币不足反馈) === */
@keyframes btnShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* === Shop Single-Screen Decision Layout === */
#shopScreen {
  justify-content: flex-start;
  padding-top: 28px;
}

#shopScreen .shop-layout {
  width: min(1180px, calc(100vw - 56px));
  max-width: none;
  height: calc(100vh - 150px);
  max-height: 620px;
  padding: 0;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  min-height: 0;
  overflow: hidden;
}

#shopScreen .shop-sidebar {
  width: 224px;
  max-height: 100%;
  overflow: visible;
  gap: 10px;
}

#shopScreen .shop-sidebar .screen-title {
  margin-bottom: 4px !important;
}

#shopScreen .shop-sidebar-card {
  padding: 10px 14px;
}

#shopScreen .shop-gold {
  padding: 3px 0 5px;
}

#shopScreen .shop-gold-amount {
  font-size: 34px;
}

#shopScreen .shop-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

#shopScreen .shop-stats .neo-badge {
  min-height: 30px;
  padding: 3px 7px;
  font-size: 9px;
}

#shopScreen .shop-stats .neo-badge:nth-child(n + 7) {
  display: none;
}

#shopScreen .shop-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding-right: 0;
}

#shopScreen .shop-main > .shop-loadout-card {
  margin-bottom: 14px;
  padding: 9px 12px 10px;
}

#shopScreen .shop-loadout-card h3 {
  margin-bottom: 7px;
}

#shopScreen .shop-loadout {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

#shopScreen .shop-loadout-slot {
  min-height: 58px;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 6px;
  padding: 6px 7px;
}

#shopScreen .shop-loadout-slot.empty {
  min-height: 58px;
}

#shopScreen .shop-loadout-icon {
  width: 30px;
  height: 30px;
}

#shopScreen .shop-loadout-name {
  font-size: 8px;
}

#shopScreen .shop-loadout-merge,
#shopScreen .shop-loadout-sell {
  position: absolute;
  right: 5px;
  bottom: 4px;
}

#shopScreen .shop-offers-section {
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#shopScreen .shop-section-title {
  margin-bottom: 10px;
}

#shopScreen .shop-offers {
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, 176px);
  grid-auto-rows: 168px;
  align-content: start;
  justify-content: start;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 8px 96px 2px;
  scrollbar-gutter: stable;
}

#shopScreen .legacy-shop-items {
  display: none !important;
}

#shopScreen .shop-item {
  width: 176px;
  height: 168px;
  min-height: 0;
  padding: 17px 10px 11px;
  gap: 6px;
}

#shopScreen .shop-item-body {
  min-height: 92px;
  display: flex;
  align-content: center;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
}

#shopScreen .shop-item-preview {
  width: 46px;
  height: 46px;
  margin-top: 4px;
  flex: 0 0 auto;
}

#shopScreen .shop-item-name {
  min-height: 16px;
  font-size: 12px;
  text-align: center;
}

#shopScreen .shop-item-meta,
#shopScreen .shop-item-desc {
  min-height: 13px;
  font-size: 9px;
  text-align: center;
}

#shopScreen .shop-item-footer {
  min-height: 31px;
  padding: 0 0 5px;
  justify-content: center;
}

#shopScreen .shop-item-kind {
  position: absolute;
  top: 10px;
  left: 9px;
  padding: 1px 6px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: var(--paper-cool);
  font-family: var(--font-body);
  font-size: 8px;
  font-weight: 700;
}

#shopScreen .shop-item-consumable .shop-item-kind {
  background: var(--paper-warm);
}

#shopScreen .shop-footer {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 48px));
  margin: 0;
  padding: 12px 0 0;
  gap: 18px;
  border-top: 2px solid rgba(24, 19, 15, 0.75);
  background: linear-gradient(180deg, rgba(255,250,240,0), var(--bg-primary) 34%);
}

#shopScreen .shop-footer .neo-btn {
  flex: 1 1 0;
  min-width: 0 !important;
}

@media (max-width: 760px) {
  #shopScreen {
    padding-top: 18px;
  }

  #shopScreen .shop-layout {
    width: calc(100vw - 28px);
    height: calc(100vh - 126px);
    max-height: none;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    overflow-y: auto;
    padding-bottom: 10px;
  }

  #shopScreen .shop-sidebar {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #shopScreen .shop-sidebar-card:nth-of-type(2) {
    display: none;
  }

  #shopScreen .shop-main {
    height: auto;
    display: block;
  }

  #shopScreen .shop-loadout {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #shopScreen .shop-loadout-slot,
  #shopScreen .shop-loadout-slot.empty {
    min-height: 48px;
  }

  #shopScreen .shop-offers {
    height: auto;
    grid-template-columns: repeat(2, 156px);
    grid-auto-rows: 158px;
    justify-content: center;
    gap: 12px;
    overflow: visible;
    padding-bottom: 78px;
  }

  #shopScreen .shop-item {
    width: 156px;
    height: 158px;
    padding: 14px 9px 10px;
  }

  #shopScreen .shop-item-body {
    min-height: 82px;
    display: flex;
    grid-template-columns: none;
    grid-template-areas: none;
    text-align: center;
    justify-content: center;
    gap: 5px;
  }

  #shopScreen .shop-item-preview {
    width: 44px;
    height: 44px;
    justify-self: auto;
  }

  #shopScreen .shop-item-name,
  #shopScreen .shop-item-meta,
  #shopScreen .shop-item-desc {
    text-align: center;
  }

  #shopScreen .shop-item-footer {
    min-height: 30px;
    padding-bottom: 5px;
    justify-content: center;
    padding-left: 0;
  }

  #shopScreen .shop-footer {
    bottom: 0;
    width: 100%;
    padding: 10px 12px 14px;
    gap: 10px;
  }
}
