.card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.92)),
    url('../marker_texture.png') center/220px repeat;
  /* Squiggly border look */
  border-radius: 2px 3px 2px 4px / 15px 4px 18px 5px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  box-shadow:
    3px 6px 12px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.5);
  padding: 12px 14px;
  position: relative;
  transform: rotate(-0.5deg);
}

/* Player cards get colored edges by layout column */
#leftPanel #p1Card {
  border-color: var(--blue);
  transform: rotate(-1.5deg);
  box-shadow:
    4px 6px 0px rgba(0, 79, 255, 0.1),
    2px 4px 10px rgba(0, 0, 0, 0.1);
}

#rightPanel #p2Card {
  border-color: var(--pink);
  transform: rotate(1.2deg);
  box-shadow:
    -4px 6px 0px rgba(182, 23, 75, 0.1),
    -2px 4px 10px rgba(0, 0, 0, 0.1);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 900;
  font-family: 'Cexsons', 'Lokka', system-ui;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.bar {
  height: 18px;
  border-radius: 4px;
  border: 3px solid rgba(0, 0, 0, 0.3);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.6);
  position: relative;
}

.bar > i {
  display: block;
  height: 100%;
  width: 50%;
  background: var(--green);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.1);
  transform-origin: left center;
}

/* Slight crayon outline on bars */
.bar::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px dashed rgba(0, 0, 0, 0.25);
  mix-blend-mode: multiply;
}

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

.small {
  font-size: 18px;
  opacity: 0.9;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.pips {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pip {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  border: 3px solid rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.05);
  position: relative;
}

.pip.on {
  background: var(--yellow);
  border-color: var(--orange);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

/* Crayon scribble hint inside pips */
.pip.on::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.btnrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-icon {
  height: 28px;
  width: auto;
  display: block;
  margin: 0 auto;
  pointer-events: none;
}

.flip-h {
  transform: scaleX(-1);
}

.flip-v {
  transform: scaleY(-1);
}

/* Buttons reimagined as chunky fridge magnets */
button {
  cursor: pointer;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 900;
  font-size: 13px;
  border: 4px solid rgba(0, 0, 0, 0.2);
  background: #fff;
  box-shadow: 
    0 4px 0 rgba(0, 0, 0, 0.2),
    0 8px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  user-select: none;
  position: relative;
  text-transform: uppercase;
}

button::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px; right: 2px; height: 40%;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  pointer-events: none;
}

/* Primary colored actions */
#fireBtn {
  background: var(--orange);
  color: #fff;
  border-color: #cc7a00;
}

#moveLBtn,
#moveRBtn {
  background: var(--teal);
  color: #fff;
  border-color: #1a7a72;
}

#aimUpBtn,
#aimDownBtn {
  background: var(--blue);
  color: #fff;
  border-color: #0037b3;
}

/* End turn button base */
#endBtn {
  border-style: dashed;
  border-color: rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.2s ease, transform 0.12s ease;
}

/* Urgent animated state when player has 0 AP */
@keyframes endPulse {
  0% {
    box-shadow: 0 6px 0 rgba(0,0,0,0.18), 0 0 0 0 rgba(255, 160, 36, 0.0), 0 0 0 0 rgba(42,82,190,0.0);
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    box-shadow: 0 6px 0 rgba(0,0,0,0.18), 0 6px 18px rgba(255,160,36,0.20), 0 6px 28px rgba(42,82,190,0.12);
    transform: translateY(-3px) rotate(-1deg);
  }
  100% {
    box-shadow: 0 6px 0 rgba(0,0,0,0.18), 0 0 0 0 rgba(255,160,36,0.0), 0 0 0 0 rgba(42,82,190,0.0);
    transform: translateY(0) rotate(-1deg);
  }
}

#endBtn.urgent {
  background: linear-gradient(135deg, #fbb13c, #ff9f1c);
  color: #191716;
  border-color: rgba(0,0,0,0.45);
  animation: endPulse 1.2s ease-in-out infinite, reticle 1.2s ease-out infinite;
  will-change: transform, box-shadow;
  transform-origin: center;
}

/* Slight subtle hue shift for added color life while pulsing */
#endBtn.urgent::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px; right: 2px; height: 40%;
  background: linear-gradient(90deg, rgba(255,255,255,0.12), rgba(255,255,255,0.02));
  border-radius: 6px;
  pointer-events: none;
}

@keyframes reticle {
  0% {
    box-shadow: 0 0 0 0 rgba(251, 177, 60, 0.7), 0 0 0 0 rgba(251, 177, 60, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(251, 177, 60, 0), 0 0 0 20px rgba(251, 177, 60, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(251, 177, 60, 0), 0 0 0 0 rgba(251, 177, 60, 0);
  }
}

/* Modal buttons */
#startGameBtn {
  border-color: var(--nearly-black);
}

#rerollBtn {
  border-color: var(--yellow);
  background: linear-gradient(135deg, rgba(251, 177, 60, 0.25), rgba(255, 255, 255, 0.96));
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.14),
    0 10px 16px rgba(0, 0, 0, 0.16);
}

button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.14),
    0 4px 10px rgba(0, 0, 0, 0.12);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow:
    0 3px 0 rgba(0, 0, 0, 0.08),
    0 6px 10px rgba(0, 0, 0, 0.08);
}

.btnwide {
  grid-column: 1/-1;
}

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

.upgrade {
  border: 2px dashed rgba(0, 0, 0, .3);
  border-radius: 18px;
  padding: 10px 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9)),
    url('../marker_texture.png') center/200px repeat;
  box-shadow: 0 6px 12px var(--shadow);
}

.upgrade .name {
  font-weight: 900;
  font-size: 20px;
  margin-bottom: 4px;
  font-family: 'Cexsons', 'Lokka', system-ui;
}

.upgrade .desc {
  font-size: 20px;
  opacity: 0.9;
  font-weight: 800;
}

.upgrade button {
  margin-top: 6px;
  width: 100%;
  padding: 8px;
  border-style: solid;
}

.upgrade .tag {
  font-size: 11px;
  opacity: .75;
  margin-left: 6px;
}

.floaters {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.floater {
  position: absolute;
  font-weight: 1000;
  font-size: 22px;
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.8), 0 3px 6px rgba(0, 0, 0, 0.25);
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
  filter: saturate(1.3);
}