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

html,
body {
  height: 100%;
  background: #000;
  color: #fff;
  overflow: hidden;
  touch-action: manipulation;
  -ms-touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-text-size-adjust: 100%;
  font-family: monospace;
  overscroll-behavior: none;
}

/* Kill iOS double-tap zoom on interactive UI */
button,
canvas,
.screen,
.wrap,
.skills {
  touch-action: manipulation;
}

.wrap {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  background: #000;
}

#game {
  width: min(96vw, calc(88vh * 0.8));
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: -moz-crisp-edges;
  background: #000;
}

.prompt {
  font-size: clamp(12px, 3.4vw, 15px);
  text-align: center;
  color: #e8e0d0;
  max-width: 22rem;
  line-height: 1.4;
  min-height: 2.4em;
  text-shadow: 1px 1px 0 #000;
}

.btn-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.skills-btn {
  font-family: monospace;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: #111;
  background: #e8c040;
  border: 3px solid #fff;
  box-shadow: 3px 3px 0 #333;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
}

.strains-btn {
  background: #6ec060;
}

.loc-btn {
  background: #6aa0e8;
}

.crew-btn {
  background: #e87898;
  color: #111;
}

.settings-btn {
  background: #888;
  color: #111;
}

body.compact-btns .skills-btn {
  font-size: 10px;
  padding: 0.4rem 0.55rem;
}

.screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem;
  background: #000;
  text-align: center;
}

.screen[hidden],
.wrap[hidden] {
  display: none !important;
}

.title {
  font-size: clamp(1.6rem, 8vw, 2.2rem);
  color: #e8c040;
  letter-spacing: 0.06em;
  text-shadow: 3px 3px 0 #333;
}

.title-sub {
  color: #8a8070;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.slot-list {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.slot-card {
  border: 3px solid #444;
  background: #151515;
  padding: 0.75rem;
  text-align: left;
}

.slot-card.active-slot {
  border-color: #e8c040;
}

.slot-card h3 {
  font-size: 0.85rem;
  color: #f0e6c8;
  margin-bottom: 0.3rem;
}

.slot-card p {
  font-size: 0.7rem;
  color: #8a8070;
  line-height: 1.35;
  margin-bottom: 0.5rem;
}

.slot-card .row-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.title-actions {
  margin-top: 0.75rem;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: #f0e6c8;
}

.toggle-row input {
  width: 1.1rem;
  height: 1.1rem;
}

.skill-item .row-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.skill-item select {
  font-family: monospace;
  font-size: 0.7rem;
  background: #222;
  color: #eee;
  border: 2px solid #555;
  padding: 0.3rem;
  max-width: 100%;
}

.pack-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 0.5rem 0 0.75rem;
}

.tcard {
  width: 108px;
  border: 3px solid #444;
  border-radius: 8px;
  padding: 0.45rem;
  background: #1a1a1a;
  text-align: center;
}

.tcard.common { border-color: #9aa0a6; }
.tcard.rare { border-color: #4ea1ff; box-shadow: 0 0 8px rgba(78, 161, 255, 0.35); }
.tcard.epic { border-color: #b14dff; box-shadow: 0 0 10px rgba(177, 77, 255, 0.4); }
.tcard.legendary {
  border-color: #ffc14d;
  box-shadow: 0 0 12px rgba(255, 193, 77, 0.55);
  background: linear-gradient(180deg, #2a2210, #1a1a1a);
}

.tcard .rarity {
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.tcard.common .rarity { color: #9aa0a6; }
.tcard.rare .rarity { color: #4ea1ff; }
.tcard.epic .rarity { color: #b14dff; }
.tcard.legendary .rarity { color: #ffc14d; }

.tcard h4 {
  font-size: 0.68rem;
  color: #f0e6c8;
  margin-bottom: 0.3rem;
  line-height: 1.25;
  min-height: 2.4em;
}

.tcard .stats {
  font-size: 0.58rem;
  color: #8a8070;
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.tcard .fx {
  font-size: 0.55rem;
  color: #7dcea0;
  line-height: 1.3;
  min-height: 2.2em;
  margin-bottom: 0.35rem;
}

.tcard button {
  font-family: monospace;
  font-size: 0.62rem;
  width: 100%;
  padding: 0.35rem 0.2rem;
  border: 2px solid #fff;
  background: #e8c040;
  color: #111;
  cursor: pointer;
}

.tcard button:disabled {
  background: #333;
  color: #777;
  border-color: #555;
}

.skills-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #333;
}

.skills-sub {
  color: #8a8070;
  font-size: 0.75rem;
  margin-bottom: 0.65rem;
  line-height: 1.35;
}

.skill-item.locked {
  opacity: 0.45;
}

.skill-item.next {
  border-color: #e8c040;
}

.skills {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.skills[hidden] {
  display: none;
}

.skills-card {
  width: min(420px, 100%);
  max-height: min(560px, 90vh);
  overflow: auto;
  background: #0a0a0a;
  border: 4px solid #e8c040;
  box-shadow: 0 0 0 3px #333;
  padding: 0.85rem;
}

.skills-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.skills-head h2 {
  font-size: 1rem;
  color: #e8c040;
  letter-spacing: 0.04em;
}

.skills-close {
  font-family: monospace;
  font-size: 14px;
  width: 32px;
  height: 32px;
  border: 2px solid #fff;
  background: #333;
  color: #fff;
  cursor: pointer;
}

.skills-cash {
  color: #e8c040;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.skills-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.skill-item {
  border: 2px solid #444;
  background: #151515;
  padding: 0.7rem;
  display: grid;
  gap: 0.35rem;
}

.skill-item.owned {
  border-color: #4aad40;
}

.skill-item h3 {
  font-size: 0.85rem;
  color: #f0e6c8;
}

.skill-item p {
  font-size: 0.72rem;
  color: #8a8070;
  line-height: 1.35;
}

.skill-item button {
  font-family: monospace;
  font-size: 0.75rem;
  justify-self: start;
  padding: 0.4rem 0.65rem;
  border: 2px solid #fff;
  background: #e8c040;
  color: #111;
  cursor: pointer;
}

.skill-item button:disabled {
  background: #333;
  color: #777;
  border-color: #555;
  cursor: default;
}
