:root {
  --paper: #fff0d0;
  --paper-2: #f8e3b8;
  --ink: #4a3426;
  --ink-soft: #76513a;
  --accent: #e58a4b;
  --accent-dark: #c26a2f;
  --danger: #c95745;
  --grass: #91b85e;
  --sky: #f6d7a7;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--sky);
  font-family: 'Fredoka', system-ui, sans-serif;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
}

#app canvas {
  display: block;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

/* --- HUD ------------------------------------------------------------------ */

#hud {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
}

.hud-bar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 10px 24px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 5px 0 rgba(74, 52, 38, 0.3);
  white-space: nowrap;
}

.hud-flock,
.hud-wool {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-icon {
  font-size: 26px;
  line-height: 1;
}

.hud-value {
  font-weight: 700;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.hud-label {
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}

.hud-label .hud-value {
  font-size: 20px;
  text-transform: none;
}

.meter {
  width: 110px;
  height: 8px;
  margin-top: 3px;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  background: var(--grass);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.meter-fill.low {
  background: var(--danger);
}

.meter-fill.timer {
  background: var(--accent);
  transition: none;
}


.hud-buttons {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
}

.icon-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  font-size: 20px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 0 4px 0 rgba(74, 52, 38, 0.3);
  cursor: pointer;
}

.icon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(74, 52, 38, 0.3);
}

/* --- Screens -------------------------------------------------------------- */

.screen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(74, 52, 38, 0.18);
}

.panel {
  width: min(440px, 100%);
  padding: 28px 30px 24px;
  text-align: center;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 26px;
  box-shadow: 0 8px 0 rgba(74, 52, 38, 0.35);
  animation: pop-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes pop-in {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
}

h1,
h2 {
  margin: 0 0 8px;
  font-weight: 700;
  line-height: 1.05;
}

h1 {
  font-size: 44px;
  color: var(--accent-dark);
}

h2 {
  font-size: 32px;
}

.tagline {
  margin: 0 0 18px;
  font-size: 18px;
  color: var(--ink-soft);
}

.howto {
  margin: 0 0 22px;
  padding: 14px 16px;
  list-style: none;
  text-align: left;
  background: var(--paper-2);
  border-radius: 14px;
}

.howto li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 4px 0;
  font-size: 16px;
}

.howto span {
  flex: none;
  width: 24px;
  font-size: 18px;
}

.big-stat {
  margin: 8px 0 4px;
  font-size: 30px;
  font-weight: 700;
}

.reward {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-dark);
}

.small {
  margin: 10px 0 16px;
  font-size: 15px;
  color: var(--ink-soft);
}

.btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px 20px;
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  color: #fffaf0;
  background: var(--accent);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 5px 0 var(--accent-dark);
  cursor: pointer;
  transition: transform 0.08s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--accent-dark);
}

.btn-quiet {
  font-size: 18px;
  color: var(--ink);
  background: var(--paper-2);
  box-shadow: 0 4px 0 rgba(74, 52, 38, 0.3);
}

.btn:focus-visible,
.icon-btn:focus-visible {
  outline: 3px solid var(--accent-dark);
  outline-offset: 3px;
}

/* --- Banner --------------------------------------------------------------- */

#banner {
  position: fixed;
  top: 28%;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  opacity: 0;
}

#banner.show {
  animation: banner 2.2s ease forwards;
}

.banner-title {
  font-size: 72px;
  font-weight: 700;
  color: var(--paper);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-shadow: 0 4px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink), 0 8px 12px rgba(74, 52, 38, 0.35);
}

.banner-sub {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}

@keyframes banner {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  12% {
    opacity: 1;
    transform: scale(1.08);
  }
  20% {
    transform: scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* --- Floating text, indicators, flash ------------------------------------- */

#float-layer,
#indicator-layer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  overflow: hidden;
}

.float-text {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 700;
  font-size: 20px;
  white-space: nowrap;
  color: #fffaf0;
  text-shadow: 0 2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink);
  will-change: transform, opacity;
}

.float-text.woof {
  font-size: 18px;
  color: var(--paper);
}

.float-text.exclaim {
  font-size: 40px;
  color: #f2c14e;
}

.float-text.good {
  color: #fff3b0;
}

.float-text.danger {
  color: #ffb4a6;
}

.float-text.big {
  font-size: 44px;
  color: var(--paper);
}

.indicator {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 3px solid var(--ink-soft);
  border-radius: 50%;
  opacity: 0.75;
}

.indicator .face {
  font-size: 22px;
}

.indicator .arrow {
  position: absolute;
  top: -12px;
  right: -12px;
  bottom: -12px;
  left: -12px;
}

.indicator .arrow::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  margin-top: -7px;
  border: 7px solid transparent;
  border-left: 10px solid var(--ink-soft);
  border-right: none;
}

.indicator.danger {
  opacity: 1;
  border-color: var(--danger);
  animation: pulse 0.6s ease-in-out infinite alternate;
}

.indicator.danger .arrow::after {
  border-left-color: var(--danger);
}

.indicator.runner.danger {
  animation-duration: 0.25s;
}

.indicator.brute {
  width: 54px;
  height: 54px;
  background: #e9dcc4;
}

.indicator.brute .face {
  font-size: 28px;
}

.indicator.alpha {
  width: 54px;
  height: 54px;
  border-color: #d9a441;
  box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.4);
}

.indicator.alpha .face {
  font-size: 28px;
}

.fear-meter {
  position: absolute;
  left: 0;
  top: 0;
  width: 64px;
  height: 12px;
  background: var(--paper-2);
  border: 3px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
}

.fear-fill {
  height: 100%;
  background: var(--accent);
  transform-origin: left;
}

.float-text.warn {
  font-size: 34px;
  color: #ffcf7a;
}

.float-text.note {
  font-size: 30px;
  color: #d9b8f2;
}

.float-text.love {
  font-size: 30px;
  color: #f4a7bb;
}

.float-text.stray {
  font-size: 30px;
  color: #fff3b0;
}

@keyframes pulse {
  to {
    box-shadow: 0 0 0 6px rgba(201, 87, 69, 0.3);
  }
}

#last-stand {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
  box-shadow: inset 0 0 160px 40px rgba(160, 36, 28, 0.55);
}

#last-stand.on {
  opacity: 1;
  animation: heartbeat 0.85s infinite;
}

body[data-effects='off'] #last-stand.on {
  animation: none;
}

@keyframes heartbeat {
  0%, 45%, 100% {
    box-shadow: inset 0 0 160px 40px rgba(160, 36, 28, 0.5);
  }
  10%, 30% {
    box-shadow: inset 0 0 190px 60px rgba(160, 36, 28, 0.7);
  }
}

#flash {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  opacity: 0;
}

#flash.on {
  animation: flash 0.35s ease-out;
}

@keyframes flash {
  from {
    opacity: var(--flash-max, 1);
  }
  to {
    opacity: 0;
  }
}

/* --- Small screens -------------------------------------------------------- */

@media (max-width: 600px) {
  .hud-bar {
    gap: 14px;
    padding: 8px 12px;
    top: 66px;
  }
  .meter {
    width: 64px;
  }
  .hud-icon {
    font-size: 20px;
  }
  .hud-value {
    font-size: 16px;
  }
  h1 {
    font-size: 34px;
  }
  .banner-title {
    font-size: 48px;
  }
}

/* --- Bestiary ------------------------------------------------------------- */

.panel-wide {
  width: min(880px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  text-align: left;
}

.bestiary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.bestiary-head .small {
  margin: 0;
}

.bestiary-body {
  display: flex;
  gap: 20px;
  min-height: 0;
  flex: 1;
}

.bestiary-lists {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.bestiary-lists h3 {
  margin: 10px 0 8px;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.bestiary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.beast-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  color: var(--ink);
  background: var(--paper-2);
  border: 3px solid transparent;
  border-radius: 14px;
  cursor: pointer;
}

.beast-card img {
  width: 72px;
  height: 72px;
}

.beast-card:hover {
  border-color: rgba(74, 52, 38, 0.3);
}

.beast-card.selected {
  border-color: var(--ink);
}

.beast-card:focus-visible {
  outline: 3px solid var(--accent-dark);
  outline-offset: 2px;
}

/* Locked: a dark silhouette and "???" */
.locked img {
  filter: brightness(0) opacity(0.35);
}

.beast-card.locked span {
  color: var(--ink-soft);
  opacity: 0.7;
}

.bestiary-detail {
  width: 280px;
  flex: none;
  padding: 12px 16px;
  background: var(--paper-2);
  border-radius: 18px;
  overflow-y: auto;
}

.bestiary-detail img {
  display: block;
  width: 180px;
  height: 180px;
  margin: 0 auto;
}

.bestiary-detail h3 {
  margin: 4px 0 0;
  font-size: 24px;
  text-align: center;
}

.beast-side {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.beast-text {
  margin: 0 0 8px;
  font-size: 15px;
}

.beast-tip {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-dark);
}

.beast-tip:empty {
  display: none;
}

@media (max-width: 700px) {
  .bestiary-body {
    flex-direction: column-reverse;
  }
  .bestiary-detail {
    width: auto;
    display: grid;
    grid-template-columns: 96px 1fr;
    column-gap: 12px;
    align-items: start;
  }
  .bestiary-detail img {
    width: 96px;
    height: 96px;
    grid-row: span 4;
  }
  .bestiary-detail h3,
  .beast-side {
    text-align: left;
  }
}

/* --- Unlock toast --------------------------------------------------------- */

#toast-layer {
  position: fixed;
  left: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 6px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(74, 52, 38, 0.3);
  cursor: pointer;
  animation: toast-in 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
  transition: opacity 0.4s, transform 0.4s;
}

.toast.out {
  opacity: 0;
  transform: translateX(-30px);
}

.toast img {
  width: 56px;
  height: 56px;
}

.toast small {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
}

.toast strong {
  font-size: 18px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
}

.indicator.howler {
  border-color: #7d7a8a;
  border-style: dashed;
}

.float-text.bonk {
  font-size: 28px;
  color: #ffe08a;
}

.float-text.zzz {
  font-size: 18px;
  color: #d8e4ff;
}

.btn-small {
  width: auto;
  margin: 10px auto 0;
  padding: 6px 16px;
  font-size: 15px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

#hint {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 10px 20px;
  font-size: 18px;
  font-weight: 700;
  background: var(--paper);
  border: 3px solid var(--accent-dark);
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(74, 52, 38, 0.3);
  pointer-events: none;
  animation: pulse-hint 1s ease-in-out infinite alternate;
}

@keyframes pulse-hint {
  to {
    transform: translateX(-50%) translateY(-4px);
  }
}

/* --- Combo ---------------------------------------------------------------- */

.hud-combo {
  position: absolute;
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 14px 6px;
  background: var(--accent);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(74, 52, 38, 0.3);
}

.hud-combo.bump {
  animation: combo-bump 0.3s cubic-bezier(0.2, 1.8, 0.4, 1);
}

@keyframes combo-bump {
  from {
    transform: translateX(-50%) scale(1.5);
  }
}

#hud-combo-n {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: #fffaf0;
  text-shadow: 0 2px 0 var(--accent-dark);
}

.combo-bar {
  width: 48px;
  height: 5px;
  background: rgba(255, 250, 240, 0.4);
  border-radius: 3px;
  overflow: hidden;
}

#hud-combo-bar {
  height: 100%;
  background: #fffaf0;
  transform-origin: left;
}

.float-text.combo {
  color: #ffe08a;
}

@media (max-width: 600px) {
  .hud-combo {
    top: 124px;
  }
}

/* --- Achievements --------------------------------------------------------- */

.btn-row {
  display: flex;
  gap: 8px;
}

.btn-row .btn {
  flex: 1;
  font-size: 16px;
}

.achievements-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.achievements-list h3 {
  margin: 12px 0 6px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.achievement {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--paper-2);
  border: 3px solid #d9a441;
  border-radius: 14px;
}

.achievement strong {
  display: block;
  font-size: 15px;
}

.achievement small {
  display: block;
  font-size: 12.5px;
  line-height: 1.25;
  color: var(--ink-soft);
}

.achievement-icon {
  flex: none;
  width: 40px;
  font-size: 30px;
  text-align: center;
}

.achievement.locked {
  border-color: transparent;
  opacity: 0.6;
}

.achievement.locked .achievement-icon {
  filter: grayscale(1) brightness(0.6);
  opacity: 0.5;
}

.toast-icon {
  width: 56px;
  font-size: 36px;
  text-align: center;
}

.achievement-toast {
  border-color: #d9a441;
}

/* --- Victory -------------------------------------------------------------- */

.victory-panel {
  border-color: #d9a441;
  box-shadow: 0 8px 0 rgba(217, 164, 65, 0.5), 0 0 0 6px rgba(217, 164, 65, 0.25);
}

.victory-kicker {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-dark);
}

.victory-stars {
  margin: 4px 0;
  font-size: 56px;
  line-height: 1;
  letter-spacing: 6px;
  color: #e5a33b;
  text-shadow: 0 3px 0 var(--ink);
}

/* --- Boss ----------------------------------------------------------------- */

.hud-boss {
  position: absolute;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 16px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  color: #fffaf0;
  background: var(--danger);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(74, 52, 38, 0.3);
}

#banner.boss .banner-title {
  color: #ffd9cf;
}

/* The BOSS card when a boss turns up */
#boss-intro {
  position: fixed;
  top: 20%;
  left: 50%;
  width: min(560px, calc(100% - 32px));
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

#boss-intro.show {
  animation: boss-intro 4.2s ease forwards;
}

.boss-tag {
  display: inline-block;
  padding: 2px 22px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #fffaf0;
  background: var(--danger);
  border: 3px solid var(--ink);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
}

.boss-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  text-align: left;
  background: var(--paper);
  border: 4px solid var(--danger);
  outline: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 8px 0 rgba(74, 52, 38, 0.3);
}

.boss-icon {
  font-size: 58px;
  line-height: 1;
}

.boss-name {
  font-size: 32px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--danger);
}

.boss-tagline {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

@keyframes boss-intro {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(1.6) rotate(-4deg);
  }
  8% {
    opacity: 1;
    transform: translateX(-50%) scale(0.94) rotate(1deg);
  }
  14% {
    transform: translateX(-50%) scale(1) rotate(0);
  }
  85% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-24px);
  }
}

@media (max-width: 600px) {
  .boss-icon {
    font-size: 40px;
  }
  .boss-name {
    font-size: 22px;
  }
  .boss-tagline {
    font-size: 14px;
  }
}

/* Push the combo badge below the boss bar while both are showing */
.hud-boss:not(.hidden) ~ .hud-combo {
  top: 132px;
}

.indicator.boss {
  width: 62px;
  height: 62px;
  border-color: var(--danger);
  border-width: 4px;
}

.indicator.boss .face {
  font-size: 32px;
}

@media (max-width: 600px) {
  .hud-boss {
    top: 120px;
  }
  .hud-boss:not(.hidden) ~ .hud-combo {
    top: 160px;
  }
}

/* --- First-time tips ------------------------------------------------------ */

.tip {
  position: fixed;
  right: 16px;
  bottom: 128px;
  z-index: 20;
  width: min(400px, calc(100% - 32px));
  padding: 12px 18px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  color: var(--ink);
  background: #fffaf0;
  border: 3px solid var(--accent);
  border-radius: 16px;
  box-shadow: 0 6px 0 rgba(74, 52, 38, 0.3);
  cursor: pointer;
}

.tip.pop {
  animation: tip-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes tip-pop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
}

.link-btn {
  display: block;
  margin: 10px auto 0;
  padding: 2px 4px;
  font: inherit;
  font-size: 14px;
  color: var(--ink-soft);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

/* --- Run summary ---------------------------------------------------------- */

.run-summary {
  margin: 10px 0 12px;
  text-align: left;
}

.summary-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.summary-tile {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: 'icon value' 'icon label';
  column-gap: 8px;
  align-items: center;
  padding: 6px 10px;
  background: var(--paper-2);
  border-radius: 12px;
}

.summary-icon {
  grid-area: icon;
  font-size: 22px;
}

.summary-tile strong {
  grid-area: value;
  font-size: 18px;
  line-height: 1.1;
}

.summary-tile small {
  grid-area: label;
  font-size: 11.5px;
  line-height: 1.15;
  color: var(--ink-soft);
}

.summary-lines {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  margin: 8px 2px 0;
  font-size: 13px;
}

.summary-lines dt {
  font-weight: 700;
  color: var(--ink-soft);
}

.summary-lines dd {
  margin: 0;
}

#screen-over .panel,
.victory-panel {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

@media (max-width: 480px) {
  .summary-tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Difficulty (summer) picker ------------------------------------------- */

.summer-picker {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
  padding: 8px;
  background: var(--paper-2);
  border-radius: 14px;
}

.summer-picker strong {
  display: block;
  font-size: 20px;
}

.summer-picker small {
  display: block;
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--ink-soft);
}

.summer-picker .icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.victory-unlock {
  margin: 4px 0 8px;
  padding: 8px 12px;
  font-weight: 700;
  color: var(--ink);
  background: #fdebc8;
  border-radius: 12px;
}


/* Any panel taller than the screen scrolls instead of being cut off */
.panel {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

#play-btn.armed {
  font-size: 16px;
  color: #fffaf0;
  background: var(--danger);
  box-shadow: 0 4px 0 #8f3a2c;
}

/* --- Wardrobe ------------------------------------------------------------- */

.wardrobe-body {
  display: flex;
  gap: 18px;
  min-height: 0;
  flex: 1;
}

.wardrobe-current {
  flex: none;
  width: 220px;
  padding: 12px;
  text-align: center;
  background: var(--paper-2);
  border-radius: 18px;
}

.wardrobe-current img {
  display: block;
  width: 190px;
  height: 190px;
  margin: 0 auto;
}

.wardrobe-current strong {
  display: block;
  font-size: 15px;
}

.wardrobe-slots {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.wardrobe-slots h3 {
  margin: 8px 0 6px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.wardrobe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.wardrobe-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px 8px;
  font: inherit;
  text-align: center;
  color: var(--ink);
  background: var(--paper-2);
  border: 3px solid transparent;
  border-radius: 14px;
  cursor: pointer;
}

.wardrobe-item img {
  width: 72px;
  height: 72px;
}

.wardrobe-item .swatch {
  width: 64px;
  height: 64px;
  margin: 4px 0;
  border: 2px solid rgba(74, 52, 38, 0.2);
  border-radius: 50%;
}

.wardrobe-item strong {
  font-size: 13px;
  line-height: 1.1;
}

.wardrobe-item small {
  font-size: 11px;
  line-height: 1.15;
  color: var(--ink-soft);
}

.wardrobe-item.selected {
  border-color: var(--ink);
  background: #fffaf0;
}

.wardrobe-item.locked {
  cursor: default;
}

.wardrobe-item.locked img,
.wardrobe-item.locked .swatch {
  filter: grayscale(1) brightness(0.3) opacity(0.4);
}

@media (max-width: 700px) {
  .wardrobe-body {
    flex-direction: column;
  }
  .wardrobe-current {
    width: auto;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .wardrobe-current img {
    width: 90px;
    height: 90px;
    margin: 0;
  }
}

/* --- Shepherd's quota ----------------------------------------------------- */

.meter {
  position: relative;
}


.hud-value.short {
  color: var(--danger);
}




/* --- End-of-wave shop (Balatro style) ------------------------------------- */

/* While shopping the wave HUD steps aside; the sidebar shows what matters. */
body.shopping .hud-bar,
body.shopping #hud-combo,
body.shopping #hud-boss,
body.shopping .hud-buttons,
body.shopping #indicator-layer,
body.shopping #last-stand,
body.shopping #hint {
  display: none;
}

.shop-screen {
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 16px;
  padding: 18px 20px 24px;
  overflow-y: auto;
  background: rgba(46, 32, 22, 0.6);
}

.shop-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.collar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border: 3px dashed rgba(255, 240, 208, 0.45);
  border-radius: 20px;
  background: rgba(255, 240, 208, 0.08);
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}

.collar.drop-hot {
  transform: scale(1.03);
  border-color: #f2c14e;
  border-style: solid;
  background: rgba(242, 193, 78, 0.22);
}

.collar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--paper);
  white-space: nowrap;
}

.collar-slots {
  display: flex;
  gap: 10px;
}

.shop-wool {
  padding: 6px 18px;
  font-size: 30px;
  font-weight: 700;
  color: var(--paper);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
}

.shop-main {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
}

.shop-side {
  flex: none;
  width: 230px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  text-align: center;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25);
}

.shop-side h2 {
  margin: 0;
  font-size: 26px;
}

.side-flock {
  padding: 8px;
  border: 3px dashed transparent;
  border-radius: 16px;
  background: var(--paper-2);
  transition: transform 0.15s, background 0.15s;
}

.side-flock.drop-hot {
  transform: scale(1.04);
  border-color: #5f8a32;
  background: #eef5dd;
}

.side-flock-n {
  font-size: 34px;
  font-weight: 700;
}

.side-flock small {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.side-line {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #4d7a2a;
}

.side-line:empty {
  display: none;
}

/* Heads-up in the shop when the next wave has a boss */
.side-next {
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--ink);
  background: #fbe3dc;
  border: 2px solid var(--danger);
  border-radius: 10px;
}

.side-next b {
  display: block;
  font-size: 14px;
  color: var(--danger);
}

.side-breakdown {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.side-breakdown li {
  display: flex;
  justify-content: space-between;
  padding: 1px 4px;
  color: var(--ink-soft);
}

.side-breakdown .total {
  margin-top: 4px;
  padding-top: 6px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  border-top: 2px dashed rgba(74, 52, 38, 0.3);
}

/* The dog's own column, right of the shop: its stats, upgraded with wool a level at a time. */
.shop-dog {
  flex: none;
  width: 240px;
  padding: 14px 12px 12px;
  background: #f3eefb;
  border: 4px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25);
}

.shop-dog h2 {
  margin: 0;
  font-size: 22px;
  text-align: center;
}

.shop-dog-hint {
  margin: 2px 0 8px;
  font-size: 12px;
  text-align: center;
  color: var(--ink-soft);
}

/* One row per stat: icon, name over its level dots, and the + button for the next level. */
.dog-stats {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dog-stat {
  display: grid;
  grid-template-columns: 26px 1fr 62px;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  border-radius: 10px;
}

.dog-stat:hover {
  background: rgba(255, 250, 240, 0.7);
}

.dog-stat.deny {
  animation: shake-no 0.3s;
}

.dog-stat-icon {
  font-size: 18px;
  text-align: center;
}

.dog-stat-body {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  cursor: help;
}

.dog-stat-name {
  font-size: 13px;
  font-weight: 700;
}

.dog-stat-dots {
  font-size: 9px;
  letter-spacing: 0;
  white-space: nowrap;
}

.dog-stat-dots b {
  font-weight: normal;
  color: #7d62b8;
}

.dog-stat-dots i {
  font-style: normal;
  color: rgba(74, 52, 38, 0.35);
}

.dog-stat-buy {
  padding: 3px 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: #fffaf0;
  background: #7d62b8;
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 2px 0 rgba(74, 52, 38, 0.3);
  cursor: pointer;
}

.dog-stat-buy.short {
  color: rgba(255, 250, 240, 0.7);
  background: #b8aacf;
}

.dog-stat-buy:disabled {
  color: var(--ink-soft);
  background: #e2dcea;
  cursor: default;
}

.side-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.shop-tray {
  position: relative;
  flex: 0 1 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 20px;
  background: #6b4a33;
  border: 4px solid var(--ink);
  border-radius: 24px;
  box-shadow: inset 0 0 0 4px rgba(255, 240, 208, 0.1), 0 8px 0 rgba(0, 0, 0, 0.25);
}

.tray-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.tray-title {
  margin: 0;
  font-size: 20px;
  color: var(--paper);
  text-align: center;
}

.card-row {
  display: flex;
  gap: 18px;
  justify-content: center;
  align-items: flex-start;
}

.tray-divider {
  width: 3px;
  align-self: stretch;
  border-radius: 2px;
  background: rgba(255, 240, 208, 0.2);
}

.tray-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  width: 100%;
  margin-top: 4px;
}

.tray-actions .btn {
  width: auto;
  margin: 0;
}

.btn-reroll {
  white-space: nowrap;
  font-size: 18px;
  background: #5f8a32;
  box-shadow: 0 5px 0 #43651f;
}

.btn-next {
  flex: 0 1 260px;
}

.tray-hint {
  max-width: 520px;
  min-height: 1.3em;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  color: var(--paper);
}

.tray-hint.pop {
  animation: tip-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.sell-zone {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  color: #fffaf0;
  background: rgba(201, 87, 69, 0.8);
  border: 4px dashed #fffaf0;
  border-radius: 20px;
  transition: transform 0.15s, background 0.15s;
}

.sell-zone.drop-hot {
  transform: scale(1.02);
  background: rgba(201, 87, 69, 0.95);
}

.collar.deny,
.side-flock.deny {
  animation: shake-no 0.3s;
}

/* Cards: an icon and a short name; everything else is in the tooltip. */
.card-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.card {
  position: relative;
  width: 96px;
  height: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 6px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.28);
  cursor: grab;
  outline: none;
  transition: transform 0.15s cubic-bezier(0.2, 1.4, 0.4, 1), box-shadow 0.15s;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-8px) rotate(-1.5deg);
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.22);
}

.card-slot.selected .card {
  transform: translateY(-10px);
  box-shadow: 0 0 0 4px #f2c14e, 0 14px 0 rgba(0, 0, 0, 0.22);
}

.card.dragging {
  opacity: 0.3;
}

.card-ghost {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  transform: rotate(-4deg) scale(1.06);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35);
}

.card-group {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 13px;
}

.card-icon {
  font-size: 44px;
  line-height: 1;
}

.card-icon img {
  width: 64px;
  height: 64px;
}

.card-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.card-pips {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent-dark);
}

.card-pips:empty {
  display: none;
}

.card-slot.big .card {
  width: 120px;
  height: 160px;
}

.card-slot.big .card-icon {
  font-size: 58px;
}

.card-slot.big .card-name {
  font-size: 15px;
}

.card-slot.small .card {
  width: 64px;
  height: 84px;
  padding: 4px;
  border-width: 3px;
  border-radius: 11px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
}

.card-slot.small .card-icon {
  font-size: 30px;
}

.card-slot.small .card-name {
  font-size: 9.5px;
}

.card-slot.small .card-group {
  display: none;
}

.card-empty,
.card-slot.empty .card {
  width: 96px;
  height: 128px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: rgba(255, 240, 208, 0.6);
  background: transparent;
  border: 3px dashed rgba(255, 240, 208, 0.35);
  box-shadow: none;
  cursor: default;
  transform: none;
}

.collar .card-slot.empty .card {
  width: 64px;
  height: 84px;
}

.card.rarity-uncommon {
  border-color: #3f73b8;
  background: #eef4fc;
}

.card.rarity-rare {
  border-color: #c48a1e;
  background: #fff4d8;
}

.card.rarity-legendary {
  border-color: #b8862b;
  background: linear-gradient(160deg, #fff4d8, #f7d98a);
}

.card.rarity-livestock {
  border-color: #5f8a32;
  background: #f3f8e6;
}

.card.frozen {
  border-color: #5a9bd4;
  background: #e4f1fb;
}

.card.frozen::after {
  content: '❄️';
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 14px;
}

.card-price {
  padding: 2px 10px;
  font-size: 14px;
  font-weight: 700;
  background: #f2c14e;
  border: 3px solid var(--ink);
  border-radius: 12px;
}

.card-price.short {
  color: rgba(74, 52, 38, 0.55);
  background: #d9c7a6;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
}

.card-actions {
  display: flex;
  gap: 6px;
}

.card-slot.small .card-actions {
  position: absolute;
  top: calc(100% + 6px);
  z-index: 5;
}

.card-actions .btn {
  width: auto;
  margin: 0;
  padding: 5px 12px;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--accent-dark);
}

.card-actions .btn:disabled {
  opacity: 0.45;
}

/* The tooltip beside a card. */
.card-tip {
  position: fixed;
  z-index: 70;
  width: 230px;
  padding: 10px 14px 12px;
  font-size: 14px;
  line-height: 1.35;
  background: #fffaf0;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.card-tip strong {
  display: block;
  font-size: 17px;
}

.card-tip small {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
}

.card-tip p {
  margin: 4px 0 0;
}

.tip-catch {
  font-style: italic;
  color: var(--danger);
}

.tip-foot {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark);
}

.card-tip p:empty,
.card-tip small:empty {
  display: none;
}

/* Charms in the top bar during a wave. */
.hud-charms {
  display: flex;
  gap: 2px;
  padding-left: 12px;
  border-left: 2px solid rgba(74, 52, 38, 0.2);
}

.hud-charm {
  font-size: 20px;
  pointer-events: auto;
  cursor: help;
}

/* Toasts: small pills. */
.toast {
  gap: 8px;
  padding: 4px 14px 4px 4px;
  border-radius: 14px;
}

.toast img {
  width: 36px;
  height: 36px;
}

.toast-icon {
  width: 36px;
  font-size: 24px;
}

.toast small {
  font-size: 10px;
}

.toast strong {
  font-size: 15px;
}

@media (max-width: 860px) {
  .shop-main {
    flex-direction: column;
    align-items: center;
  }
  .shop-side {
    width: min(640px, 100%);
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
  }
  .shop-tray,
  .shop-dog {
    width: min(640px, 100%);
    flex: none;
  }
}

@media (max-width: 560px) {
  .card {
    width: 78px;
    height: 106px;
  }
  .card-icon {
    font-size: 36px;
  }
  .card-slot.big .card {
    width: 96px;
    height: 128px;
  }
  .card-slot.small .card,
  .collar .card-slot.empty .card {
    width: 50px;
    height: 68px;
  }
  .card-slot.small .card-name {
    display: none;
  }
  .card-row {
    gap: 10px;
  }
  .collar-title {
    display: none;
  }
  .shop-screen {
    padding: 10px 10px 18px;
    gap: 10px;
  }
  .shop-side {
    gap: 6px 12px;
    padding: 10px;
  }
  .shop-side h2 {
    font-size: 20px;
  }
  .side-flock-n {
    font-size: 24px;
  }
  .side-breakdown li:not(.total) {
    display: none;
  }
  .shop-wool {
    font-size: 22px;
  }
  .tray-actions .btn {
    font-size: 17px;
    white-space: nowrap;
  }
  body.shopping #toast-layer {
    top: 8px;
    bottom: auto;
  }
}

@keyframes shake-no {
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

/* Error banner: shown if something breaks, so it can be reported. */
.error-banner {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 100;
  width: min(560px, calc(100% - 24px));
  padding: 10px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  color: #fffaf0;
  background: var(--danger);
  border: 3px solid var(--ink);
  border-radius: 12px;
  transform: translateX(-50%);
  cursor: pointer;
}

/* Augments on charm cards (like Balatro's editions). */
.card.aug-ghostly {
  background: rgba(214, 228, 245, 0.55);
  border-color: #7f9cc2;
  border-style: dashed;
}

.card.aug-ghostly .card-icon {
  opacity: 0.75;
}

.card.aug-gilded {
  background: linear-gradient(135deg, #fff4d8 0%, #f7d98a 35%, #fffaf0 50%, #f2c14e 70%, #fff4d8 100%);
}

.card.aug-polished {
  border-color: transparent;
  background:
    linear-gradient(var(--paper), var(--paper)) padding-box,
    conic-gradient(#e58a4b, #f2c14e, #91b85e, #5a9bd4, #9b7fd0, #e58a4b) border-box;
}

.card.aug-blessed {
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.28), 0 0 14px 4px rgba(255, 238, 170, 0.85);
}

.card[class*='aug-']::before {
  position: absolute;
  top: -10px;
  right: -8px;
  font-size: 16px;
}

.card.aug-ghostly::before {
  content: '🌫️';
}

.card.aug-gilded::before {
  content: '✨';
}

.card.aug-polished::before {
  content: '🌈';
}

.card.aug-blessed::before {
  content: '🕊️';
}

.tip-aug {
  font-weight: 700;
  color: #6a4fa8;
}
