:root {
  color-scheme: dark;

  /* Flat Matte Surfaces - ZERO GRADIENTS */
  --bg-base: #0a0c10;
  --bg-surface: #11141b;
  --bg-surface-elevated: #161a23;
  --bg-input: #1b202c;
  --bg-hover: #1f2533;

  /* Borders */
  --border: #212735;
  --border-focus: #374158;
  --border-subtle: #191e2a;

  /* Typography */
  --text-primary: #ffffff;
  --text-secondary: #9aa5b8;
  --text-muted: #5e697e;

  /* Minimal Accents */
  --gold: #e5b338;
  --gold-dim: #99741f;
  --red: #eb4b4b;
  --green: #2ecc71;

  /* Rarity Solid Accents */
  --rarity-milspec: #4b69ff;
  --rarity-restricted: #8847ff;
  --rarity-classified: #d32ce6;
  --rarity-covert: #eb4b4b;
  --rarity-special: #e5b338;

  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;

  /* Motion Timing Functions */
  --motion-fast: 120ms cubic-bezier(0.16, 1, 0.3, 1);
  --motion-base: 220ms cubic-bezier(0.16, 1, 0.3, 1);
  --motion-smooth: 350ms cubic-bezier(0.08, 0.98, 0.22, 1);
}

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

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Canvas Confetti */
#confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none !important;
  z-index: 9999;
}

/* Form Controls & Buttons Base */
button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  transition: transform var(--motion-fast), background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

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

/* HEADER */
header {
  height: 68px;
  padding: 0 clamp(16px, 3vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.4px;
  flex-shrink: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

.gold-text {
  color: var(--gold);
}

.version-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
}

/* Navigation */
nav {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 13px;
  position: relative;
  background: transparent;
  border: 1px solid transparent;
}

.nav-btn:hover {
  color: #fff;
  background: var(--bg-surface);
}

.nav-btn.active {
  color: #fff;
  background: var(--bg-surface-elevated);
  border-color: var(--border);
}

.count-pill {
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--bg-input);
  padding: 1px 6px;
  border-radius: 10px;
  color: var(--text-muted);
}

.alert-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

/* Header Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.btn-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.btn-toggle:hover {
  background: var(--bg-surface-elevated);
  color: #fff;
}

.toggle-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.toggle-indicator.on {
  background: var(--green);
}

.balance-display {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
}

.balance-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.balance-value {
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
}

.curr {
  font-size: 11px;
  color: var(--gold);
}

/* LIVE STRIP */
.live-strip {
  display: flex;
  align-items: center;
  height: 38px;
  background: #0d0f15;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 clamp(16px, 3vw, 40px);
  overflow: hidden;
}

.live-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  padding-right: 14px;
  flex-shrink: 0;
}

.radar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.live-ticker {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.live-ticker::-webkit-scrollbar {
  display: none;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: transform var(--motion-fast);
}

.live-pill:hover {
  transform: translateY(-1px);
  border-color: var(--border-focus);
}

.live-pill .u-tag {
  font-size: 10px;
  color: var(--text-muted);
}

.live-pill .u-tag.me {
  color: #000;
  background: var(--gold);
  font-weight: 800;
  padding: 0 4px;
  border-radius: 2px;
}

.live-pill .s-title {
  font-weight: 700;
  color: var(--item-color, #fff);
}

/* NOTICE BAR */
.notice-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px clamp(16px, 3vw, 40px);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
}

.notice-bar span {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--gold);
  border: 1px solid var(--border);
  padding: 1px 4px;
  border-radius: 2px;
}

/* MAIN */
main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 40px) 60px;
}

/* VIEW CONTAINER MOTION */
.view {
  animation: viewFadeIn var(--motion-base) ease-out;
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.section-subtitle {
  display: block;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.8px;
  color: var(--gold);
  margin-bottom: 4px;
  font-weight: 700;
}

h1 {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 800;
  letter-spacing: -0.6px;
  color: #fff;
}

.btn-text-action {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
}

.btn-text-action:hover {
  color: #fff;
  border-color: var(--border-focus);
}

/* UPGRADE ARENA */
.upgrade-machine-container {
  display: grid;
  grid-template-columns: 1fr 320px 1fr;
  align-items: center;
  gap: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 30px 24px;
  margin-bottom: 24px;
}

.slot-box {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  transition: border-color var(--motion-fast);
}

.slot-box.has-item {
  border-color: var(--slot-color, var(--border-focus));
}

.slot-caption {
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.slot-placeholder {
  color: var(--text-muted);
  padding: 20px 0;
}

.placeholder-icon {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.slot-card-body h3 {
  font-size: 16px;
  font-weight: 800;
  margin-top: 6px;
}

.slot-card-body .s-skin {
  font-size: 12px;
  font-weight: 700;
  color: var(--slot-color, var(--text-secondary));
}

.slot-card-body .s-val {
  font-size: 13px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fff;
  margin-top: 8px;
  display: inline-block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: var(--radius-xs);
}

/* MACHINE CORE (DIAL) */
.machine-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.dial-container {
  width: 220px;
  height: 220px;
  position: relative;
}

.dial-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.dial-bg-track {
  fill: none;
  stroke: var(--bg-input);
  stroke-width: 10;
}

.dial-arc {
  fill: none;
  stroke: var(--gold);
  stroke-width: 10;
  stroke-linecap: square;
  transition: stroke-dasharray var(--motion-smooth);
}

.dial-inner-plate {
  fill: var(--bg-surface);
  stroke: var(--border);
  stroke-width: 1;
}

/* Needle Mount (Motion Graphics Engine) */
.dial-pointer-mount {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  will-change: transform;
}

.dial-needle-line {
  position: absolute;
  top: 14px;
  width: 2px;
  height: 95px;
  background: #ff4757;
}

.dial-needle-head {
  position: absolute;
  top: 10px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid #fff;
}

.dial-readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.readout-label {
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  color: var(--text-muted);
}

.readout-number {
  font-size: 32px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
  letter-spacing: -1px;
  line-height: 1;
  margin-top: 2px;
}

.readout-number small {
  font-size: 16px;
  color: var(--gold);
}

.readout-mult {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Multiplier Bar */
.multiplier-bar {
  display: flex;
  gap: 4px;
}

.btn-mult {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
}

.btn-mult:hover {
  background: var(--bg-hover);
  color: #fff;
  border-color: var(--border-focus);
}

/* Execute Button */
.btn-execute {
  width: 100%;
  background: var(--gold);
  color: #000;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.btn-execute:hover:not(:disabled) {
  background: #f0c34e;
}

.status-caption {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  min-height: 16px;
}

/* PANELS */
.dual-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-header h2 {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.badge {
  font-size: 11px;
  font-family: var(--font-mono);
  background: var(--bg-base);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
}

.btn-action-small {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
}

.btn-action-small:hover {
  color: #fff;
  border-color: var(--border-focus);
}

.filter-group {
  display: flex;
  gap: 6px;
}

.minimal-select, .minimal-search {
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  outline: none;
}

.minimal-select:focus, .minimal-search:focus {
  border-color: var(--border-focus);
}

.search-field {
  margin-bottom: 14px;
}

.search-field input {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  outline: none;
  font-size: 12px;
  color: #fff;
}

.search-field input:focus {
  border-color: var(--border-focus);
}

/* ITEMS GRID & CARDS */
.items-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.full-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  max-height: none;
  gap: 12px;
}

.item-card {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-bottom: 2px solid var(--item-color, var(--border));
  border-radius: var(--radius-xs);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform var(--motion-fast), border-color var(--motion-fast);
  cursor: pointer;
}

.item-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-focus);
}

.item-card.is-selected {
  border-color: var(--gold);
  background: #141822;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.card-price {
  color: #fff;
  font-weight: 700;
}

.card-rarity-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--item-color, var(--text-muted));
}

.card-img-box {
  width: 100%;
  height: 70px;
  display: grid;
  place-items: center;
  margin: 6px 0;
}

.card-name {
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

.card-skin {
  font-size: 10px;
  color: var(--item-color, var(--text-secondary));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.btn-card {
  flex: 1;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 3px;
  text-align: center;
}

.btn-card:hover {
  background: var(--bg-hover);
  color: #fff;
}

.btn-card.danger:hover {
  background: rgba(235, 75, 75, 0.15);
  border-color: var(--red);
  color: var(--red);
}

/* REAL CS2 WEAPON & CASE IMAGES */
.weapon-img-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.weapon-real-img {
  max-width: 95%;
  max-height: 90%;
  object-fit: contain;
  transition: transform var(--motion-fast);
  user-select: none;
  pointer-events: none;
}

.item-card:hover .weapon-real-img {
  transform: scale(1.08) translateY(-2px);
}

.slot-box .weapon-real-img {
  max-height: 115px;
  max-width: 250px;
}

.case-img-box {
  width: 100%;
  height: 140px;
  display: grid;
  place-items: center;
}

.case-real-img {
  max-width: 85%;
  max-height: 130px;
  object-fit: contain;
  transition: transform var(--motion-fast);
  user-select: none;
  pointer-events: none;
}

.case-card:hover .case-real-img {
  transform: scale(1.06) translateY(-2px);
}

/* CASES GRID */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.case-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform var(--motion-fast), border-color var(--motion-fast);
}

.case-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-focus);
}

.case-card h3 {
  font-size: 16px;
  font-weight: 800;
  margin: 10px 0 4px;
}

.case-desc {
  font-size: 11px;
  color: var(--text-muted);
  min-height: 32px;
  margin-bottom: 14px;
}

.btn-open-case {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--case-color, var(--border));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 16px;
  border-radius: var(--radius-xs);
}

.btn-open-case:hover:not(:disabled) {
  background: var(--case-color, var(--gold));
  color: #000;
}

/* CONTRACTS */
.contract-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  margin-bottom: 24px;
}

.contract-board {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.contract-board-caption {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.contract-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.contract-slot {
  background: var(--bg-base);
  border: 1px dashed var(--border);
  border-radius: var(--radius-xs);
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  position: relative;
}

.contract-slot.has-item {
  border-style: solid;
  border-color: var(--item-color, var(--border));
}

.contract-slot .btn-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 2px;
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-size: 12px;
  display: grid;
  place-items: center;
}

.contract-slot .btn-del:hover {
  color: #fff;
}

.contract-summary {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.summary-line b {
  color: #fff;
  font-family: var(--font-mono);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: var(--radius-xs);
  text-align: center;
}

.btn-secondary:hover:not(:disabled) {
  color: #fff;
  border-color: var(--border-focus);
}

/* INVENTORY TOOLBAR */
.inventory-summary-pill {
  display: flex;
  gap: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.inventory-summary-pill b {
  color: #fff;
}

.inventory-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.pill {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-xs);
}

.pill:hover {
  color: #fff;
  border-color: var(--border-focus);
}

.pill.active {
  background: var(--bg-surface-elevated);
  border-color: var(--gold);
  color: #fff;
}

.inventory-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-danger {
  background: var(--bg-surface);
  border: 1px solid #4a2125;
  color: #ff6b81;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
}

.btn-danger:hover:not(:disabled) {
  background: #5a272c;
  color: #fff;
}

/* HISTORY */
.history-section {
  margin-top: 40px;
}

.history-section h3 {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 12px;
}

.history-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.history-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
}

.history-item:last-child {
  border-bottom: none;
}

.history-item .h-time {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* STATS & ACHIEVEMENTS */
.stats-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

.stats-panel, .achievements-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.stats-panel h3, .achievements-panel h3 {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 14px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-muted);
}

.stat-row b {
  color: #fff;
  font-family: var(--font-mono);
}

.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ach-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
}

.ach-item.done {
  border-color: var(--gold-dim);
}

.ach-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.ach-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.ach-reward-val {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--gold);
}

.btn-ach-claim {
  background: var(--gold);
  color: #000;
  font-size: 11px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
}

.btn-ach-claim:disabled {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
}

/* MINIMAL DIALOG (Modals) */
dialog:not([open]) {
  display: none !important;
  pointer-events: none !important;
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

.minimal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0;
  max-width: 840px;
  width: 92%;
  color: #fff;
  margin: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.minimal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
}

.dialog-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-header h2 {
  font-size: 18px;
  font-weight: 800;
}

.btn-close {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
}

.btn-close:hover {
  color: #fff;
}

/* ROULETTE STAGE */
.roulette-stage {
  position: relative;
  height: 160px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.roulette-needle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: var(--gold);
  z-index: 10;
  pointer-events: none;
}

.roulette-needle::before, .roulette-needle::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.roulette-needle::before {
  top: 0;
  border-top: 8px solid var(--gold);
}

.roulette-needle::after {
  bottom: 0;
  border-bottom: 8px solid var(--gold);
}

.roulette-strip {
  display: flex;
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  padding: 8px 0;
  will-change: transform;
}

.roulette-card {
  width: 130px;
  height: 100%;
  flex-shrink: 0;
  margin: 0 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-bottom: 2px solid var(--card-color, var(--border));
  border-radius: var(--radius-xs);
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
}

.roulette-status-bar {
  text-align: center;
  min-height: 40px;
}

.roulette-msg {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.roulette-btn-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* 3D INSPECT CARD */
.inspect-card-box {
  background: var(--bg-base);
  border: 1px solid var(--inspect-color, var(--border));
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
}

.inspect-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  margin-top: 14px;
}

.inspect-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.dialog-text-content {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* TOAST */
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-focus);
  padding: 10px 20px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  z-index: 10000;
  display: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* FOOTER */
footer {
  border-top: 1px solid var(--border);
  background: var(--bg-base);
  padding: 30px clamp(16px, 3vw, 40px);
}

.footer-content {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-left p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 4px;
}

.footer-right {
  display: flex;
  gap: 10px;
}

/* RESPONSIVE */
@media (max-width: 1050px) {
  .upgrade-machine-container {
    grid-template-columns: 1fr;
  }
  .machine-core {
    order: -1;
  }
  .dual-panels {
    grid-template-columns: 1fr;
  }
  .contract-container {
    grid-template-columns: 1fr;
  }
  .stats-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  header {
    height: auto;
    padding: 10px 14px;
    flex-wrap: wrap;
  }
  nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .header-controls {
    gap: 6px;
  }
  .btn-toggle {
    display: none;
  }
  .contract-slots {
    grid-template-columns: repeat(2, 1fr);
  }
}
