.title-card h1 {
  letter-spacing: -.025em;
  line-height: .94;
  transform: scaleX(.84);
  transform-origin: left center;
  width: 119%;
}

.dialogue button[hidden] { display: none; }
.eyebrow,
.chapter small,
.moment-copy small,
.success-panel > small,
.topbar small,
.dialogue span,
.task-card b {
  color: #555653;
}
.moment-copy p { font-size: 19px; }

.name-card {
  position: absolute;
  z-index: 2;
  left: 24px;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  padding: 28px 24px 22px;
  background: #fff7e8;
  border: 5px solid #17383b;
  box-shadow: 8px 8px 0 #d68576;
}

.name-card h2 {
  margin: 8px 0 26px;
  font: 700 34px/1.1 Georgia, serif;
}

.name-card label {
  display: block;
  margin: 0 0 7px;
  color: #17383b;
  font-size: 14px;
  font-weight: 900;
}

.name-card input {
  width: 100%;
  margin: 0 0 19px;
  padding: 13px 12px;
  border: 3px solid #17383b;
  border-radius: 0;
  background: #fff;
  color: #17383b;
  font: 700 17px "Trebuchet MS", Arial, sans-serif;
  outline: none;
}

.name-card input:focus {
  border-color: #d68576;
  box-shadow: 3px 3px 0 #17383b;
}

.name-card .primary { margin: 5px 0 0; }
.name-back {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 0;
  background: transparent;
  color: #17383b;
  font-size: 30px;
  cursor: pointer;
}

[hidden] { display: none !important; }

.level-brief {
  position: relative;
  height: calc(100% - 72px);
  background: #f1dfbd;
}

.brief-scene {
  height: 66%;
  background: url("assets/level01-room-atlas-clean-v2.png") 0 0 / 200% 200% no-repeat;
  image-rendering: pixelated;
  border-bottom: 5px solid #17383b;
}

.brief-dialogue {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 18px;
  padding: 17px 17px 14px;
  background: #fff7e8f4;
  border: 4px solid #17383b;
  box-shadow: 6px 6px 0 #d68576;
}

.brief-dialogue > span {
  color: #555653;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
}

.brief-dialogue p { margin: 8px 0 16px; font-size: 17px; line-height: 1.35; }
.brief-dialogue .primary { margin: 0; padding: 13px; }

.escape-game {
  height: calc(100% - 72px);
  display: flex;
  flex-direction: column;
  background: #fff7e8;
}

.escape-game .objective {
  height: 42px;
  flex: 0 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.escape-game .objective strong { color: #555653; font-size: 12px; letter-spacing: .08em; }

.room-window {
  position: relative;
  flex: 1 1 auto;
  min-height: 300px;
  overflow: hidden;
  background: #17383b;
}

.room-view {
  position: absolute;
  inset: 0;
  background-image: url("assets/level01-room-atlas-clean-v2.png");
  background-size: 200% 200%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  transition: transform .28s ease;
}

.view-counter { background-position: 0 0; }
.view-prep { background-position: 100% 0; }
.view-dining { background-position: 0 100%; }
.view-window { background-position: 100% 100%; }
.room-window.zoomed .room-view { transform: scale(1.48); }

.zoom-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 5px;
  z-index: 5;
}

.zoom-controls button {
  width: 34px;
  height: 34px;
  border: 2px solid #f1dfbd;
  background: #17383be8;
  color: #fff7e8;
  font-size: 20px;
  cursor: pointer;
}

.object-pin {
  position: absolute;
  z-index: 4;
  width: 31px;
  height: 31px;
  padding: 0;
  border: 3px solid #fff7e8;
  border-radius: 50%;
  background: #2e6663e8;
  color: #fff;
  box-shadow: 0 2px 0 #17383b, 0 0 0 3px #17383b77;
  font-size: 19px;
  cursor: pointer;
  animation: object-breathe 1.8s ease-in-out infinite;
}

.object-pin span {
  display: none;
  position: absolute;
  top: 34px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 7px;
  background: #17383b;
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
}

.object-pin:hover span,.object-pin:focus-visible span { display: block; }
.pin-ticket { left: 58%; top: 53%; }
.pin-tray { left: 75%; top: 52%; }
.pin-drinks { left: 42%; top: 56%; }
.pin-divider { left: 67%; top: 47%; }
.pin-mat { left: 65%; top: 70%; }
.pin-table { left: 77%; top: 56%; }
.pin-grip { left: 34%; top: 42%; }

.room-window .task-card {
  z-index: 6;
  bottom: 10px;
  pointer-events: none;
}

.direction-pad {
  height: 57px;
  flex: 0 0 57px;
  display: grid;
  grid-template-columns: repeat(4,1fr);
  border-top: 3px solid #17383b;
  border-bottom: 2px solid #17383b;
}

.direction-pad button {
  border: 0;
  border-right: 1px solid #c8b999;
  background: #fff7e8;
  color: #555653;
  cursor: pointer;
}

.direction-pad button.active { background: #2e6663; color: #fff; }
.direction-pad i { display: block; font-style: normal; font-weight: 900; }
.direction-pad span { font-size: 10px; }

.escape-inventory {
  min-height: 66px;
  height: 66px;
  flex: 0 0 66px;
  display: flex;
  gap: 6px;
  align-items: stretch;
  padding: 7px;
  overflow-x: auto;
  border: 0;
}

.escape-inventory button {
  min-width: 68px;
  border: 2px solid #17383b;
  background: #f1dfbd;
  color: #17383b;
  cursor: pointer;
}

.escape-inventory button.selected { background: #2e6663; color: #fff; box-shadow: inset 0 0 0 2px #fff7e8; }
.escape-inventory button i { display: block; font-style: normal; font-size: 19px; line-height: 1; }
.escape-inventory button span { font-size: 9px; }
.empty-slot { margin: auto; color: #77736d; font-size: 12px; }
.combine-help { height: 23px; flex: 0 0 23px; margin: 0; text-align: center; font-size: 10px; line-height: 23px; color: #555653; }
.escape-game .hint { flex: 0 0 35px; }

@keyframes object-breathe { 50% { transform: scale(1.12); filter: brightness(1.15); } }

@media (prefers-reduced-motion: reduce) {
  .object-pin { animation: none; }
  .room-view { transition: none; }
}

/* Inventory uses the objects themselves, not framed symbol tiles. */
.escape-inventory {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 138px;
  height: 138px;
  flex-basis: 138px;
  padding: 4px 10px 2px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 0;
  background: #fff7e8;
}

.escape-inventory button {
  position: relative;
  flex: 0 0 108px;
  height: 132px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #17383b;
  cursor: pointer;
}

.escape-inventory button + button { border: 0; }
.escape-inventory button span {
  position: absolute;
  left: 50%;
  bottom: 1px;
  transform: translateX(-50%);
  display: block;
  padding: 3px 7px;
  border-radius: 10px;
  background: #17383be8;
  color: #fff7e8;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.escape-inventory button.selected {
  background: transparent;
  color: #17383b;
  box-shadow: none;
}

.escape-inventory button.selected .item-icon {
  filter: drop-shadow(0 7px 5px #17383b42);
  transform: translateY(-7px) scale(1.04);
}

.escape-inventory button.selected::after {
  content: none;
}

.empty-slot {
  color: #77736d;
  font-size: 11px;
  letter-spacing: .05em;
}

.escape-inventory .item-icon,
.combine-reveal .item-icon {
  position: relative;
  display: block;
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin: 0 auto;
  image-rendering: pixelated;
  border: 0;
  outline: 0;
  box-shadow: none;
  transition: transform .16s ease, filter .16s ease;
}

.room-item { position:absolute; z-index:3; object-fit:contain; pointer-events:none; filter:drop-shadow(0 3px 2px #17383b55); image-rendering:pixelated; animation:level-one-item-float 1.8s ease-in-out infinite; }
.room-item-ticket { left:54%; top:43%; width:54px; height:54px; }
.room-item-tray { left:66%; top:43%; width:104px; height:62px; }
.room-item-drinks { left:33%; top:34%; width:96px; height:78px; }
.room-item-grip { left:27%; top:33%; width:66px; height:66px; }

@keyframes level-one-item-float { 50% { transform: translateY(-3px); } }

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

.room-edge {
  position: absolute;
  z-index: 8;
  top: 45%;
  width: 42px;
  height: 68px;
  transform: translateY(-50%);
  border: 0;
  background: #17383bcc;
  color: #fff7e8;
  font: 700 42px/1 Georgia,serif;
  cursor: pointer;
  box-shadow: 0 3px 0 #0d2527;
}

.room-edge-left { left: 0; border-radius: 0 24px 24px 0; }
.room-edge-right { right: 0; border-radius: 24px 0 0 24px; }
.room-edge:hover,.room-edge:focus-visible { background: #2e6663; }

.combine-reveal {
  position: absolute;
  z-index: 20;
  left: 50%;
  top: 48%;
  width: 168px;
  min-height: 154px;
  transform: translate(-50%,-50%) scale(.76);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border: 4px solid #17383b;
  background: #fff7e8f2;
  box-shadow: 8px 8px 0 #d68576;
  opacity: 0;
  pointer-events: none;
}

.combine-reveal.show { animation: item-created 1.35s ease both; }

.screen.active .success-animation,.l2-success-animation,.screen.active .l3-success-frame,.l4-success-art.playing,.interlude-screen.playing .interlude-frames img,.interlude-screen.playing .interlude-day,.interlude-screen.playing .interlude-line{animation:none!important}
.success-animation,.l2-success-animation,.l3-success-animation,.l4-success-art,.interlude-frames{position:relative;outline:none}
.story-step-button{position:absolute;z-index:12;inset:0;width:100%;height:100%;padding:0;border:0;background:transparent;cursor:pointer;touch-action:manipulation}
.story-step-button:focus-visible{outline:4px solid #fff7e8;outline-offset:-7px;box-shadow:inset 0 0 0 10px #d68576}
.story-step-button:disabled{cursor:default}
.story-complete .ending-panel>.primary,.story-complete .ending-panel>.secondary{position:relative;z-index:30;pointer-events:auto}
.story-tap-hint{position:absolute;right:8px;bottom:8px;padding:7px 9px;background:#17383be8;color:#fff7e8;border:2px solid #fff7e8;font-size:11px;font-weight:900;letter-spacing:.04em;pointer-events:none}
.combine-reveal .item-icon { width: 90px; height: 76px; }
.combine-reveal > span { margin-top: 3px; color: #555653; font-size: 10px; font-weight: 900; letter-spacing: .18em; }
.combine-reveal > strong { margin-top: 4px; font: 700 18px Georgia,serif; }

@keyframes item-created {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.72); }
  18%,78% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-55%) scale(.94); }
}

.play-guide {
  position: absolute;
  z-index: 18;
  left: 22px;
  right: 22px;
  top: 96px;
  padding: 20px 18px 16px;
  border: 4px solid #17383b;
  background: #fff7e8f7;
  box-shadow: 8px 8px 0 #d68576;
}

.play-guide > span { color: #555653; font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.play-guide h3 { margin: 6px 0 14px; font: 700 24px Georgia,serif; }
.play-guide ul { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 0 0 17px; padding: 0; list-style: none; }
.play-guide li { display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 7px; }
.play-guide li i { grid-row: 1 / 3; display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: #2e6663; color: #fff; font-style: normal; font-size: 17px; }
.play-guide li b { font-size: 12px; }
.play-guide li small { color: #555653; font-size: 9px; line-height: 1.15; }
.play-guide .primary { margin: 0; padding: 12px; }

@media (prefers-reduced-motion: reduce) {
  .combine-reveal.show { animation-duration: .01ms; }
}
.level-select { margin-top: 12px; padding-top: 11px; border-top: 1px solid #f1dfbd55; }
.level-select > span { display: block; margin-bottom: 8px; color: #f1dfbd99; font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.level-select > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.level-select button { min-height: 36px; padding: 7px 9px; border: 2px solid #f1dfbd88; background: #0d252766; color: #f1dfbd; font-size: 13px; font-weight: 900; cursor: pointer; }
.level-select button:hover,.level-select button:focus-visible { background: #f1dfbd; color: #17383b; }
.level-select button:disabled{display:flex;align-items:center;justify-content:space-between;border-color:#f1dfbd33;background:#0d252744;color:#f1dfbd66;cursor:not-allowed}.level-select button:disabled:hover{background:#0d252744;color:#f1dfbd66}.level-select button:disabled b{font-size:12px}.level-select button:disabled small{font-size:9px;letter-spacing:.1em}
@media(max-height:720px){#titleScreen .title-card{top:3%}#titleScreen .title-card h1{font-size:64px;margin:12px 0}#titleScreen .tagline{margin:14px 0 20px}#titleScreen .primary{padding:12px 16px;margin-bottom:8px}.level-select{margin-top:8px;padding-top:8px}.level-select>div{gap:5px}.level-select button{min-height:31px;padding:5px 8px}}

/* The full level list is taller than a phone viewport. Keep game screens fixed,
   but let the title / level-select screen form its own safe scrolling page. */
#titleScreen.active {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(circle at 78% 18%,#f1dfbd22 0 2px,transparent 3px) 0 0/25px 25px,
    radial-gradient(circle at 26% 73%,#d6857633 0 3px,transparent 4px) 0 0/37px 37px,
    linear-gradient(140deg,#2e6663,#183b3d 58%,#0f2a2d);
}
#titleScreen .grain { display: none; }
#titleScreen .title-card {
  position: relative;
  inset: auto;
  width: 100%;
  padding: clamp(64px,14vh,120px) 28px 24px;
}
#titleScreen .build {
  position: relative;
  inset: auto;
  display: block;
  padding: 2px 20px calc(28px + env(safe-area-inset-bottom));
}
@media(max-height:720px){
  #titleScreen .title-card{top:auto;padding-top:32px}
}
