/* Operation Ho Ho Ho - styles just for this game.
   Anything here only affects this page, so go wild. */

.ohhh {
  --navy: #10213f;
  --navy-2: #172d55;
  --navy-3: #22407a;
  --bp: #1b4a96;
  --line: #e9f2ff;
  --gold: #ffd84d;
  --pink: #ff7bd5;
  --cyan: #7fe3ff;
}

.wrap--game {
  max-width: 84rem;
}

/* The shared .stage is a centred box; the game needs it to be a normal block. */
.stage.stage--game {
  display: block;
  place-items: normal;
  min-height: 0;
  padding: 0;
  background: var(--ink);
}

#game-root.ohhh {
  position: relative;
  width: 100%;
  min-height: 46rem;
  color: var(--line);
}

/* ---------- buttons ---------- */
.obtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 800;
  line-height: 1.15;
  color: var(--ink);
  background: var(--sun);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.1s ease;
}

.obtn:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

.obtn:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.obtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.obtn--small {
  padding: 0.35rem 0.7rem;
  font-size: 0.9rem;
}

.obtn--go {
  background: var(--mint);
  font-size: 1.05rem;
}

.obtn--ghost {
  background: var(--card);
}

.on-dark .obtn {
  border-color: var(--ink);
}

.obtn[aria-pressed="true"][data-speed] {
  background: var(--mint);
}

.obtn kbd,
.how kbd {
  font: 700 0.75rem/1 ui-monospace, Menlo, monospace;
  padding: 0.2rem 0.35rem;
  border: 2px solid currentColor;
  border-radius: 6px;
  opacity: 0.75;
}

.linkish {
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: none;
  border: 0;
  padding: 0.2rem 0.4rem;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- HUD ---------- */
.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.4rem;
  padding: 0.7rem 1rem;
  background: var(--navy-2);
  border-bottom: 3px solid var(--navy-3);
}

.hud__item {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 1.05rem;
}

.hud__item strong {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--sun);
}

.hud__item--mission strong {
  color: var(--line);
}

.hud__label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.hud__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-left: auto;
}

/* ---------- board + side panel ---------- */
.play {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: 1rem;
  padding: 1rem;
}

.board {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 20rem;
}

.board canvas {
  display: block;
  border-radius: 10px;
  box-shadow: 0 0 0 3px var(--navy-3), 0 10px 30px rgba(0, 0, 0, 0.45);
  cursor: crosshair;
  touch-action: manipulation;
}

.board canvas:focus-visible {
  outline: 4px solid var(--sun);
  outline-offset: 4px;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.side__title {
  font-size: 1.1rem;
  color: var(--sun);
}

.side__sub {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  font-family: var(--font-body);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}

.notes {
  display: grid;
  gap: 0.3rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.35;
  border: 2px dashed var(--navy-3);
  border-radius: 10px;
}

.notes[hidden] {
  display: none;
}

.notes strong {
  color: var(--sun);
}

.notes .is-done strong {
  color: var(--mint);
}

.side__tip {
  min-height: 4.2em;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.4;
  background: var(--navy-2);
  border-radius: 10px;
}

.side__actions {
  display: grid;
  gap: 0.5rem;
}

#plan-panel,
#night-panel {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

#plan-panel[hidden],
#night-panel[hidden] {
  display: none;
}

/* trap picker */
.trap-list {
  display: grid;
  gap: 0.4rem;
}

.trap {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.2rem 0.5rem 0.2rem 0.25rem;
  font: inherit;
  color: var(--line);
  text-align: left;
  background: var(--navy-2);
  border: 2px solid var(--navy-3);
  border-radius: 12px;
  cursor: pointer;
}

.trap:hover:not(:disabled) {
  border-color: var(--sky);
}

.trap[aria-pressed="true"] {
  background: var(--navy-3);
  border-color: var(--sun);
  box-shadow: 0 0 0 2px var(--sun);
}

.trap:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.trap.is-poor .trap__cost {
  color: #ff8a7a;
}

.trap__icon {
  width: 2.2rem;
  height: 2.2rem;
  background: var(--bp);
  border-radius: 8px;
}

.trap__text {
  display: grid;
  min-width: 0;
}

.trap__name {
  font-weight: 800;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trap__meta {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.72rem;
}

.trap__role {
  padding: 0.05rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--line);
  border-radius: 999px;
}

.trap__role--slow { background: #ffb36b; }
.trap__role--stick { background: #f2e6b8; }
.trap__role--ranged { background: var(--pink); }
.trap__role--lure { background: #e0b088; }
.trap__role--burst { background: var(--gold); }
.trap__role--boost { background: var(--cyan); }
.trap__role--gag { background: #ffb3c7; }
.trap__role--chill { background: #bfe9ff; }

.trap__lv {
  opacity: 0.75;
}

.trap__cost {
  display: grid;
  justify-items: end;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--sun);
}

.trap__key {
  font: 700 0.65rem/1 ui-monospace, Menlo, monospace;
  color: var(--line);
  opacity: 0.6;
}

/* night panel */
.speed {
  display: flex;
  gap: 0.4rem;
}

.chips,
.combos-tonight {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  --chip: var(--line);
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--ink);
  background: var(--chip);
  border-radius: 999px;
}

.chip--plain {
  color: var(--line);
  background: var(--navy-2);
}

.combos-tonight li {
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--ink);
  background: var(--sun);
  border-radius: 8px;
}

.combos-tonight li.muted {
  color: var(--line);
  background: transparent;
  opacity: 0.6;
  padding-left: 0;
}

/* ---------- catch meter ---------- */
.meter {
  position: absolute;
  top: 0.6rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: min(30rem, 90%);
  padding: 0.45rem 0.8rem;
  background: rgba(16, 33, 63, 0.88);
  border: 3px solid var(--sun);
  border-radius: 999px;
  pointer-events: none;
}

.meter[hidden] {
  display: none;
}

.meter__label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.meter__bar {
  position: relative;
  flex: 1;
  height: 0.9rem;
  overflow: hidden;
  background: var(--navy-3);
  border-radius: 999px;
}

.meter__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: repeating-linear-gradient(-45deg, var(--red) 0 10px, #ff6b57 10px 20px);
  border-radius: 999px;
  transition: width 0.15s linear;
}

.meter.is-full .meter__fill {
  background: var(--mint);
}

.meter {
  transition: transform 0.15s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.meter.is-close {
  animation: meter-pulse 0.5s ease-in-out infinite alternate;
}

.meter.is-bump {
  transform: translateX(-50%) scale(1.08);
}

@keyframes meter-pulse {
  from { box-shadow: 0 0 0 0 rgba(255, 200, 61, 0); }
  to { box-shadow: 0 0 0 6px rgba(255, 200, 61, 0.45); }
}

/* "so close" bar on the escape screen */
.near {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.2rem 0 0.9rem;
}

.near__bar {
  position: relative;
  flex: 1;
  max-width: 26rem;
  height: 1.3rem;
  overflow: hidden;
  background: #e6e0d0;
  border: 3px solid var(--ink);
  border-radius: 999px;
}

.near__fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: repeating-linear-gradient(-45deg, var(--red) 0 10px, #ff6b57 10px 20px);
}

.near__pct {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
}

.totals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  margin-bottom: 0.8rem;
}

.totals__item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.7rem;
  font-size: 0.88rem;
  font-weight: 800;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.mission__right {
  display: grid;
  justify-items: end;
  gap: 0.15rem;
}

.secret,
.secret-line {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.secret.is-done,
.secret-line.is-done strong {
  color: #12805c;
}

.secret-line {
  font-size: 0.9rem;
}

.meter__pct {
  min-width: 3ch;
  font-family: var(--font-display);
  color: var(--sun);
  text-align: right;
}

/* ---------- toast ---------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: 0.8rem;
  max-width: min(34rem, 92%);
  padding: 0.6rem 1rem;
  font-weight: 800;
  text-align: center;
  color: var(--ink);
  background: var(--sun);
  border: 3px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- overlay screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: start center;
  padding: clamp(0.75rem, 3vw, 2rem);
  overflow-y: auto;
  background: rgba(10, 22, 44, 0.78);
  backdrop-filter: blur(3px);
}

.screen[hidden] {
  display: none;
}

.screen__card {
  width: min(100%, 46rem);
  padding: clamp(1.1rem, 3vw, 2rem);
  color: var(--ink);
  background: var(--card);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-big);
}

#screen-workshop .screen__card,
#screen-case .screen__card,
#screen-missions .screen__card,
#screen-result .screen__card {
  width: min(100%, 56rem);
}

.kicker {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
}

.screen__title {
  margin: 0.2rem 0 0.6rem;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.lede {
  margin-bottom: 1rem;
  color: var(--ink-soft);
}

.screen__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

.fine {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* missions */
.missions {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mission {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 0.5rem 0.9rem;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.mission:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.mission:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.mission__num {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  font-family: var(--font-display);
  color: var(--line);
  background: var(--bp);
  border-radius: 10px;
}

.mission__text {
  display: grid;
}

.mission__text span {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.stars {
  display: inline-flex;
  gap: 0.1rem;
  font-size: 1.5rem;
  line-height: 1;
}

.star {
  color: #d7d2c4;
}

.star.is-on {
  color: #f5b400;
  text-shadow: 0 2px 0 var(--ink);
}

/* workshop */
.shop-list,
.combo-list,
.case-list {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shop {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0.9rem;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
}

.shop.is-locked {
  background: #f1ede2;
}

.shop__icon {
  width: 4rem;
  height: 4rem;
  background: var(--bp);
  border-radius: 10px;
}

.shop__text h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.05rem;
}

.shop__lv {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.shop__text p {
  font-size: 0.92rem;
}

.shop__stats {
  margin-top: 0.2rem;
  font-size: 0.8rem !important;
  color: var(--ink-soft);
}

.shop__stats--next {
  color: #12805c;
  font-weight: 700;
}

.shop__buy {
  display: grid;
  justify-items: end;
  gap: 0.35rem;
}

.shop__cost {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.badge-max {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: #12805c;
}

/* combos */
.combo-list {
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.combo {
  padding: 0.8rem 1rem;
  background: #f1ede2;
  border: 3px dashed var(--ink-soft);
  border-radius: 14px;
}

.combo.is-known {
  background: #fff;
  border-style: solid;
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--sun);
}

.combo h3 {
  font-size: 1.05rem;
}

.combo p {
  font-size: 0.9rem;
  margin-top: 0.3rem;
}

.combo__recipe {
  font-weight: 800;
  color: var(--red-dark);
}

/* case file + polaroids */
.case-list {
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1.2rem;
  margin-top: 0.6rem;
}

.polaroid {
  margin: 0;
  padding: 0.6rem 0.6rem 0.8rem;
  background: #fff;
  border: 2px solid #d8d2c2;
  box-shadow: 0 6px 14px rgba(16, 33, 63, 0.25);
  transform: rotate(-1.5deg);
}

.case-list .polaroid:nth-child(2n) {
  transform: rotate(1.5deg);
}

.polaroid img,
.polaroid__blank {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  background: #0d1f14;
}

.polaroid__blank {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: #6a7d70;
}

.polaroid.is-missing {
  opacity: 0.7;
}

.polaroid__caption {
  margin-top: 0.55rem;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
}

.case-solved {
  margin-top: 1.2rem;
  padding: 1rem;
  font-weight: 800;
  background: var(--sun);
  border: 3px solid var(--ink);
  border-radius: 12px;
}

/* result */
.result {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
}

.result .credits {
  margin-top: 0.2rem;
  font-size: 0.92rem;
}

.polaroid--big {
  transform: rotate(-2deg);
  animation: photo-in 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes photo-in {
  from { transform: rotate(-12deg) scale(0.6); opacity: 0; }
  to { transform: rotate(-2deg) scale(1); opacity: 1; }
}

.result__side {
  display: grid;
  gap: 0.7rem;
}

.result .stars {
  font-size: 2.4rem;
}

.result__note {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.clue {
  padding: 0.8rem 1rem;
  background: #fff4c2;
  border: 3px dashed var(--ink);
  border-radius: 12px;
}

.tip-box {
  padding: 0.8rem 1rem;
  font-weight: 700;
  background: #e5f4ff;
  border: 3px solid var(--ink);
  border-radius: 12px;
}

.credits {
  display: grid;
  gap: 0.25rem;
  max-width: 24rem;
  margin: 1.1rem 0 0;
  padding: 0;
  list-style: none;
}

.credits li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.credits strong {
  font-family: var(--font-display);
  font-weight: 400;
  color: #12805c;
}

.credits__total {
  margin-top: 0.25rem;
  padding-top: 0.35rem;
  border-top: 2px solid var(--ink);
  font-weight: 800;
}

.credits__total strong {
  color: var(--ink);
}

/* how to play */
.how {
  margin: 2rem 0 1rem;
  max-width: 48rem;
}

.how h2 {
  font-size: 1.4rem;
  margin-bottom: 0.6rem;
}

.how ol {
  display: grid;
  gap: 0.5rem;
  padding-left: 1.3rem;
}

.noscript {
  padding: 2rem;
  text-align: center;
}

@media (min-width: 52rem) {
  .missions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- smaller screens ---------- */
@media (max-width: 62rem) {
  .play {
    grid-template-columns: 1fr;
  }

  .trap-list {
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  }

  .hud__buttons {
    margin-left: 0;
  }
}

@media (max-width: 40rem) {
  .result {
    grid-template-columns: 1fr;
  }

  .shop {
    grid-template-columns: 3rem minmax(0, 1fr);
  }

  .shop__icon {
    width: 3rem;
    height: 3rem;
  }

  .shop__buy {
    grid-column: 1 / -1;
    justify-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .polaroid--big {
    animation: none;
  }

  .toast,
  .obtn,
  .mission,
  .meter,
  .meter__fill {
    transition: none;
  }

  .meter.is-close {
    animation: none;
  }
}
