/* Escape the Haunted Castle — play view.
   Fixed 900x660: a 900x600 canvas with a 60px item strip under it. */

.ehc {
  --stone:      #1b1a26;
  --stone-lit:  #2a2839;
  --mortar:     #12111a;
  --gold:       #e0b657;
  --gold-dim:   #8b7135;
  --ghost:      #9fd8e8;
  --torch:      #ff9d4d;
  --parchment:  #efe2c4;
  --ink:        #2c2216;
  --panel:      #221f30;

  position: relative;
  width: 900px;
  height: 660px;
  margin: 0 auto;
  background: var(--mortar);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55), inset 0 0 0 2px #3a3550;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--parchment);
  user-select: none;
}

.ehc-canvas {
  display: block;
  width: 900px;
  height: 600px;
}

/* ---------------------------------------------------------------- item strip */

.ehc-hud {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 900px;
  height: 60px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  background: linear-gradient(180deg, #262238, #17141f);
  border-top: 2px solid #3a3550;
}

.ehc-room {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--gold);
  white-space: nowrap;
}

.ehc-bag {
  display: flex;
  gap: 8px;
  flex: 1 1 auto;
  align-items: center;
  min-height: 40px;
}

.ehc-slot {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: #14121d;
  border: 2px solid #3a3550;
}

.ehc-slot img { width: 30px; height: 30px; object-fit: contain; display: block; }

.ehc-slot.filled {
  background: radial-gradient(circle at 50% 35%, #4a3f6b, #221d33);
  border-color: var(--gold-dim);
  box-shadow: 0 0 12px rgba(224, 182, 87, .28);
}

.ehc-moves {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: #b9b2cf;
  white-space: nowrap;
  text-align: right;
}

.ehc-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--parchment);
  background: linear-gradient(180deg, #3d3457, #2a2440);
  border: 2px solid #554a7a;
  border-radius: 9px;
  padding: 8px 11px;
  cursor: pointer;
  white-space: nowrap;
}

.ehc-btn:hover { background: linear-gradient(180deg, #4a3f6b, #332c4d); border-color: var(--gold-dim); }
.ehc-btn:active { transform: translateY(1px); }
.ehc-btn[disabled] { opacity: .4; cursor: default; transform: none; }

/* ------------------------------------------------------------------- overlays */

.ehc-veil {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(9, 8, 14, .72);
  backdrop-filter: blur(2px);
  z-index: 5;
}

.ehc-veil.on { display: grid; }

/* The title and end screens sit above the toast and the watching banner, which are pinned
   near the top of the same box. Everything else is fine underneath them. */
.ehc-front { z-index: 9; }

.ehc-panel {
  width: 380px;
  padding: 22px;
  border-radius: 16px;
  background: linear-gradient(180deg, #2d2843, var(--panel));
  border: 2px solid var(--gold-dim);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  text-align: center;
}

.ehc-panel h2 {
  margin: 0 0 12px;
  font-size: 20px;
  letter-spacing: .05em;
  color: var(--gold);
}

/* Notes read as parchment so a clue never looks like game chrome. */
.ehc-note {
  width: 430px;
  background: linear-gradient(180deg, #f6ecd4, #e2d2ae);
  border: 2px solid #a98f5b;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.55;
  padding: 26px 26px 20px;
}

.ehc-note h2 { color: #6b4f22; }

.ehc-keypad-read {
  font-size: 32px;
  letter-spacing: .34em;
  font-variant-numeric: tabular-nums;
  height: 52px;
  line-height: 52px;
  margin: 0 0 14px;
  border-radius: 10px;
  background: #100e18;
  border: 2px solid #4a4168;
  color: var(--gold);
  text-indent: .34em;
}

.ehc-keypad-read.bad {
  color: #ff8080;
  border-color: #8c3b3b;
  animation: ehc-shake .32s;
}

@keyframes ehc-shake {
  25% { transform: translateX(-7px); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
}

.ehc-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.ehc-key {
  font: inherit;
  font-size: 21px;
  font-weight: 700;
  padding: 13px 0;
  border-radius: 10px;
  color: var(--parchment);
  background: linear-gradient(180deg, #443a64, #2c2643);
  border: 2px solid #5a4f82;
  cursor: pointer;
}

.ehc-key:hover { border-color: var(--gold-dim); }
.ehc-key:active { transform: translateY(1px); }
.ehc-key.wide { grid-column: span 1; font-size: 15px; }

.ehc-hint {
  margin: 14px 0 0;
  font-size: 13px;
  color: #9d95b8;
}

/* --------------------------------------------------- title screen + end screen */

/* The title sits over the establishing shot of the whole castle, so the veil behind it is
   thinner than the others: the point is to look at the place you are about to break out of. */
.ehc-veil[data-veil="menu"] { background: rgba(9, 8, 14, .55); }

.ehc-title { width: 470px; padding: 30px 30px 26px; }

.ehc-title h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: .02em;
  color: var(--gold);
  text-shadow: 0 2px 0 #6b5322, 0 0 26px rgba(224, 182, 87, .35);
}

.ehc-tagline {
  margin: 0 0 20px;
  font-size: 14.5px;
  line-height: 1.55;
  color: #cfc7e4;
}

.ehc-menu-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.ehc-btn.ehc-big {
  font-size: 17px;
  padding: 12px 34px;
  background: linear-gradient(180deg, #6a5a9e, #463c6e);
  border-color: var(--gold);
}

.ehc-btn.ehc-big:hover { background: linear-gradient(180deg, #7b69b5, #52467f); }

.ehc-best {
  margin: 18px 0 0;
  font-size: 13.5px;
  color: #9d95b8;
}

.ehc-best b { color: var(--parchment); }

.ehc-how { width: 470px; text-align: left; }

.ehc-how dl { margin: 0 0 18px; }

.ehc-how dt {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-top: 12px;
}

.ehc-how dd {
  margin: 3px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: #cfc7e4;
}

.ehc-how dd b { color: var(--gold); }
.ehc-how > .ehc-btn { display: block; margin: 0 auto; }

.ehc-end { width: 420px; }

/* The two numbers the leaderboard is built from, side by side and the same size, because
   neither one is the score on its own. */
.ehc-tally {
  display: flex;
  gap: 14px;
  margin: 4px 0 16px;
}

.ehc-tally > div {
  flex: 1 1 0;
  padding: 14px 6px 11px;
  border-radius: 12px;
  background: #14121d;
  border: 2px solid #3a3550;
}

.ehc-num {
  display: block;
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  line-height: 1.1;
}

.ehc-cap {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: #8b7fae;
}

/* The one number the leaderboard actually carries, shown next to the two it is made of so a
   board full of them is not a wall of numbers nobody can read. */
.ehc-end-score {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--parchment);
}

.ehc-end-best {
  margin: 0 0 18px;
  font-size: 13.5px;
  color: #9d95b8;
  min-height: 18px;
}

.ehc-end-best.new {
  color: var(--gold);
  font-weight: 700;
  letter-spacing: .04em;
}

.ehc-clock {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: #b9b2cf;
  white-space: nowrap;
}

.ehc-build {
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: #5f5980;
  letter-spacing: .04em;
}

/* Shown only when the page has caught itself running old code. */
.ehc-stale {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 11px 16px;
  z-index: 20;
  background: linear-gradient(180deg, #8c3b3b, #66292c);
  border-bottom: 2px solid #ff9b9b;
  color: #ffe9e9;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.ehc-watching {
  position: absolute;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  display: none;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(20, 17, 28, .94);
  border: 2px solid var(--ghost);
  color: var(--ghost);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .03em;
  pointer-events: none;
  z-index: 7;
}

.ehc-toast {
  position: absolute;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(20, 17, 28, .92);
  border: 2px solid var(--gold-dim);
  color: var(--parchment);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
  z-index: 6;
}

.ehc-toast.on { opacity: 1; }
