:root {
  --ink: #22223b;
  --paper: #fbf8ef;
  --paper2: #f1ecdc;
  --red: #e63946;
  --blue: #4d96ff;
  --green: #43aa8b;
  --yellow: #f9c74f;
  --purple: #9d4edd;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--paper);
  font-family: "Patrick Hand", "Comic Sans MS", "Segoe Print", cursive;
  color: var(--ink);
  user-select: none;
}
#game { display: block; width: 100vw; height: 100vh; cursor: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(251, 248, 239, 0.78); pointer-events: auto; cursor: default;
}
.overlay.hidden { display: none; }
.panel {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  padding: 20px 28px;
  max-width: 1150px; width: 94vw; max-height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: 5px 5px 0 var(--ink);
}
.menu-panel { max-width: 700px; }
h1 {
  font-family: "Caveat", "Patrick Hand", cursive; font-size: 78px; margin: 0; letter-spacing: 1px;
  transform: rotate(-2deg); line-height: 1;
}
h2 { font-family: "Caveat", "Patrick Hand", cursive; font-size: 42px; margin: 0; }
h3 { margin: 10px 0 6px; font-size: 24px; }
.tagline { font-size: 22px; margin: 8px 0 4px; }
.btn {
  font-family: inherit; font-size: 20px;
  background: var(--paper); color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  padding: 6px 16px; cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform .05s;
}
.btn:hover:not(:disabled) { transform: translate(-1px, -1px) rotate(-1deg); box-shadow: 3px 3px 0 var(--ink); background: #fff; }
.btn:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.big { font-size: 26px; padding: 8px 26px; background: var(--yellow); margin: 10px 0; }
.btn.primary { background: #bde0fe; }
.btn.danger { background: #ffd6d6; }
.btn.sm { font-size: 15px; padding: 2px 10px; box-shadow: 1px 1px 0 var(--ink); }
.tabs { display: flex; gap: 8px; margin: 12px 0 8px; flex-wrap: wrap; }
.tabs .btn.active, .btn.active { background: var(--yellow); }
#shop-body { overflow: auto; flex: 1; padding: 4px 6px 4px 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card {
  border: 2px solid var(--ink);
  border-radius: 15px 255px 15px 225px / 225px 15px 255px 15px;
  padding: 10px 12px; background: #fff; position: relative;
  display: flex; flex-direction: column; gap: 4px;
}
.card.owned { background: #e9f5e1; }
.card.locked { opacity: .55; }
.card.maxed { background: #fff3c4; }
.card h4 { margin: 0; font-size: 22px; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.tag { font-size: 13px; border: 1.5px solid var(--ink); border-radius: 10px; padding: 0 7px; background: var(--paper2); white-space: nowrap; }
.tag.t1 { background: #e9f5e1; } .tag.t2 { background: #dbeafe; } .tag.t3 { background: #ede4ff; } .tag.t4 { background: #ffd6d6; }
.stats { display: grid; grid-template-columns: 1fr 1fr; font-size: 15px; gap: 0 10px; }
.stats span { display: flex; justify-content: space-between; }
.stats span b { margin-left: 6px; }
.desc { font-size: 15px; font-style: italic; opacity: .85; min-height: 2.2em; }
.row { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: auto; flex-wrap: wrap; }
.center-row { justify-content: center; margin-top: 10px; }
.pips { display: flex; gap: 3px; flex-wrap: wrap; }
.pip { width: 12px; height: 12px; border: 1.5px solid var(--ink); border-radius: 50%; }
.pip.on { background: var(--ink); }
.cost { font-weight: bold; white-space: nowrap; }
.cost.poor { color: var(--red); }
.shop-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.ink { font-size: 28px; }
.slots { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.slot {
  border: 2px dashed var(--ink); border-radius: 12px; padding: 8px 12px; min-width: 170px;
  background: var(--paper2); display: flex; flex-direction: column; gap: 4px;
}
.slot.filled { border-style: solid; background: #fff; }
.slot .btn { align-self: flex-start; }
.slot-title { font-size: 20px; }
.controls-box { margin-top: 14px; }
.controls { columns: 2; font-size: 18px; text-align: left; }
.controls div { break-inside: avoid; padding: 2px 0; }
kbd { border: 1.5px solid var(--ink); border-radius: 5px; padding: 0 6px; background: #fff; font-family: inherit; margin-right: 2px; }
.cat-filter { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.small { font-size: 15px; }
.replace-box { background: #fff3c4; border: 2px solid var(--ink); padding: 8px 12px; border-radius: 10px; margin-bottom: 10px; }
.center { text-align: center; }
.weapon-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.weapon-tabs .btn.active { background: #bde0fe; }
.statpanel {
  border: 2px solid var(--ink); border-radius: 10px; background: var(--paper2);
  padding: 8px 12px; margin-bottom: 12px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 2px 14px; font-size: 16px;
}
.statpanel span { display: flex; justify-content: space-between; }
.stats-box { font-size: 20px; margin: 8px 0; }
.stats-box div { display: flex; justify-content: space-between; gap: 30px; }
.fx { color: var(--purple); font-size: 14px; }
.hint { font-size: 15px; opacity: .8; margin: 0 0 8px; }
.online-box { margin-top: 10px; border: 2px dashed var(--ink); border-radius: 12px; padding: 8px 14px 4px; background: var(--paper2); }
.online-box h3 { margin: 4px 0 8px; }
.form-row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
input {
  font-family: inherit; font-size: 18px; padding: 5px 10px; width: 180px;
  border: 2px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink);
}
input.room-input { width: 240px; text-transform: uppercase; letter-spacing: 1px; text-align: center; }
.msg { color: var(--red); min-height: 1.4em; font-size: 16px; }
.room-code {
  font-family: "Caveat", "Patrick Hand", cursive; font-size: 48px; letter-spacing: 3px; margin: 4px 0; max-width: 100%; overflow-wrap: anywhere;
  border: 3px solid var(--ink); border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  display: inline-block; padding: 0 28px; background: #fff3c4; user-select: text;
}
.lobby-players { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 10px 0; }
.lobby-players .slot { min-width: 140px; text-align: center; }
.ready-box { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ready-list { display: flex; gap: 6px; flex-wrap: wrap; font-size: 15px; }
.ready-list .tag { border-width: 2px; }
