/* The Eighth Place: the Palace room, the Pocket, the map, the room under the city.
   Same cream, navy and burnt orange as the rest of the site, plus bronze and gold. */
:root { --bronze: #8a6a3c; --gold: #f2c14e; --brass: #c9a25a; }

/* ---------- the Pocket ---------- */
.pocket { position: fixed; left: 18px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 8; display: flex; align-items: center; gap: 6px; padding: 5px 13px 5px 6px; border: 0; border-radius: 999px; background: rgba(255, 248, 239, .94); box-shadow: 0 8px 24px -12px rgba(27, 29, 51, .5); font: 500 12px/1 var(--mono); letter-spacing: .06em; color: var(--ink); cursor: pointer; }
.pocket[hidden] { display: none; }
.pocket svg { width: 34px; height: 34px; }
.pocket.in-use { box-shadow: 0 0 0 3px var(--gold), 0 8px 24px -10px rgba(27, 29, 51, .5); }
.pocket.nudge { animation: pocketPop .7s cubic-bezier(.2, .8, .2, 1.4); }
@keyframes pocketPop { 0% { transform: scale(1); } 35% { transform: scale(1.22) rotate(-4deg); } 100% { transform: scale(1); } }
.pocket-pop { position: fixed; left: 18px; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 56px); z-index: 9; width: min(320px, calc(100vw - 36px)); padding: 16px; border-radius: 18px; background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .55); animation: rise .3s ease both; }
.pocket-pop[hidden] { display: none; }
.pp-item { display: flex; gap: 12px; align-items: flex-start; }
.pp-item svg { width: 54px; height: 54px; flex: none; }
.pp-item b { font: 500 17px/1.2 var(--serif); }
.pp-item p { margin: 4px 0 12px; font-size: 14.5px; line-height: 1.45; }
.pp-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pp-nudge { margin-top: 12px; padding: 6px 0; background: none; }
.pp-hint ol, .qv-hint ol { margin: 8px 0 0; padding-left: 20px; font-size: 14.5px; line-height: 1.45; }
.pp-hint .row, .qv-hint .row { margin-top: 8px; gap: 6px; }
.pp-hint .link, .qv-hint .link { background: rgba(27, 29, 51, .06); }

/* ---------- in the city ---------- */
.using { position: fixed; left: 50%; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 44px); transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 999px; background: rgba(255, 248, 239, .95); box-shadow: 0 0 0 2px var(--gold), 0 10px 30px -12px rgba(27, 29, 51, .5); font: 500 12px/1 var(--mono); white-space: nowrap; }
.using[hidden] { display: none; }
.act { position: fixed; left: 0; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 12px; border-radius: 999px; background: rgba(255, 248, 239, .95); box-shadow: 0 8px 24px -10px rgba(27, 29, 51, .45); font: 500 12px/1 var(--mono); white-space: nowrap; }
.act[hidden] { display: none; }
.act kbd { font: 400 10px/1 var(--mono); opacity: .7; margin-left: 4px; }
.qtoast { position: fixed; left: 50%; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 96px); transform: translate(-50%, 8px); z-index: 11; padding: 9px 15px; border-radius: 999px; background: var(--ink); color: var(--paper); font: 400 14px/1.3 var(--serif); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: calc(100vw - 40px); text-align: center; }
.qtoast.on { opacity: 1; transform: translate(-50%, 0); }
.found.grow { animation: grow 1.2s ease; }
@keyframes grow { 30% { transform: scale(1.18); box-shadow: 0 0 0 4px rgba(242, 193, 78, .7); } }
.dots i.gold { background: rgba(242, 193, 78, .35); }
.dots i.gold.on { background: var(--gold); box-shadow: 0 0 6px var(--gold); }

/* ---------- the views ---------- */
.qv { position: fixed; inset: 0; z-index: 6; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: #1d2240; color: var(--cream); }
.qv[hidden] { display: none; }
.qv.in { animation: fade .45s ease both; }
.qv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 18px 8px; }
.qv-place { margin: 0 0 4px; font: 500 11.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--amber); }
.qv-goal { margin: 0; font: 400 clamp(20px, 3.4vw, 28px)/1.15 var(--serif); letter-spacing: -.01em; }
.qv-tools { display: flex; align-items: center; gap: 8px; }
.qv .close { position: static; background: rgba(255, 248, 239, .14); color: var(--cream); }
.qv-sound { background: rgba(255, 248, 239, .12); color: var(--cream); }
.qv-stage { position: relative; display: grid; place-items: center; padding: 0 12px; min-height: 0; overflow: hidden; }
.qv-stage > svg { display: block; max-width: 100%; max-height: 100%; width: auto; height: 100%; border-radius: 14px; }
.qv-bot { padding: 10px 18px max(16px, env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; text-align: center; }
.qv-msg { margin: 0; min-height: 1.4em; font: 400 16.5px/1.4 var(--serif); max-width: 640px; }
.qv-msg.bump { animation: msgBump .4s ease; }
@keyframes msgBump { 0% { opacity: .2; transform: translateY(4px); } }
.qv-ctl { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; min-height: 48px; }
.qv .btn { border-color: var(--cream); color: var(--cream); }
.qv .btn.primary { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.qv .link { background: rgba(255, 248, 239, .12); color: var(--cream); }
.btn.turn { width: 48px; height: 48px; padding: 0; justify-content: center; font-size: 22px; }
.qv-sel { font: 500 13px/1 var(--mono); letter-spacing: .06em; min-width: 140px; }
.qv-sel.dim { opacity: .7; min-width: 0; }
.qv-hint { max-width: 560px; text-align: left; padding: 10px 14px; border-radius: 14px; background: rgba(255, 248, 239, .08); }
.qv-hint[hidden] { display: none; }
.dpad { display: grid; grid-template-columns: repeat(4, 48px); gap: 6px; }

/* the Palace scene */
.pv-svg { touch-action: manipulation; }
.pv-svg .br { fill: #8a6a3c; stroke: #523c20; stroke-width: 2; }
.pv-svg .br2 { fill: #76592f; stroke: #523c20; stroke-width: 2; }
.pv-svg .hl { fill: none; stroke: #e2c487; stroke-width: 3; stroke-linecap: round; opacity: .8; }
.pv-svg .fl { stroke: #523c20; stroke-width: 1.6; opacity: .55; }
.pv-svg .pat { fill: #6f9078; opacity: .85; }
.pv-svg .pivot { fill: var(--brass); stroke: #523c20; stroke-width: 2; }
.pv-svg .rf { fill: #4f4026; stroke: #b0915a; stroke-width: 2.5; opacity: .92; }
.pv-svg .rg { fill: none; stroke: #c9ad7a; stroke-width: 3; stroke-linecap: round; }
.pv-sculpt, .pv-hit { cursor: pointer; outline: none; }
.pv-sel { fill: none; stroke: #ffcf7a; stroke-width: 3; stroke-dasharray: 8 7; opacity: 0; transition: opacity .2s; }
.pv-sculpt.on .pv-sel, .pv-sculpt:focus-visible .pv-sel { opacity: 1; }
.pv-sculpt:hover .pv-rot { filter: brightness(1.12); }
.pv-hit:focus-visible { outline: 3px solid #ffcf7a; }
#pv-door:focus-visible { stroke: #ffcf7a; stroke-width: 4; }
.pv-sh { fill: #eef7f8; opacity: .45; animation: shimmer 5s ease-in-out infinite; }
@keyframes shimmer { 50% { transform: translateX(26px); opacity: .15; } }
.pv-plaque-t { font: 500 15px var(--mono); letter-spacing: .12em; fill: #3b2a17; }
.formed #pv-key { animation: keyGlow 1.8s ease-in-out infinite; }
@keyframes keyGlow { 50% { filter: brightness(1.12); } }
.settled .pv-sh { display: none; }

/* the office window */
.ov-svg { border-radius: 14px; }

/* the map */
.qv[data-view="map"] { background: #2a3150; }
.map-svg { background: #9fc8d8; touch-action: none; }
.map-st text { font-family: var(--mono); fill: rgba(27, 29, 51, .42); letter-spacing: .04em; }
.map-lb text { font-family: var(--serif); font-style: italic; fill: #1b1d33; }
.map-film { cursor: grab; outline: none; }
.map-film.drag { cursor: grabbing; }
.map-film:focus-visible rect:nth-of-type(2) { stroke: var(--gold); stroke-width: 2.4; }
.qv-stage[data-away]:not([data-away=""])::after { content: "you're out of town. the map shows the city."; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); padding: 6px 12px; border-radius: 999px; background: rgba(255, 248, 239, .9); color: var(--ink); font: 400 12px/1 var(--mono); }

/* inspecting something */
.qi { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(15, 17, 34, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .3s ease both; }
.qi[hidden] { display: none; }
.qi-panel { position: relative; width: min(560px, 100%); max-height: calc(100svh - 40px); overflow: auto; padding: 26px 24px 22px; border-radius: 24px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); }
.qi-panel h2 { margin: 0 40px 14px 0; font: 400 26px/1.1 var(--serif); }
.qi-panel p { font-size: 16.5px; line-height: 1.5; margin: 12px 0 16px; }
.qi-row { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.qi-art { position: relative; border-radius: 6px; overflow: hidden; }
.qi-key svg { width: 200px; height: 200px; }
.qi-film { width: min(300px, 70vw); box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .5); transform: rotate(-3deg); }
.qi-film svg { display: block; width: 100%; height: auto; }
.qi-dark { position: absolute; inset: 0; background: rgba(18, 22, 40, .72); }
.qi-sleeve { width: 170px; padding: 10px 10px 8px; background: #f4ead6; border: 1px solid #d8c4a0; border-radius: 3px; text-align: center; transform: rotate(2deg); }
.qi-sleeve svg { width: 100%; display: block; }
.qi-sleeve i { display: block; margin-top: 4px; font: italic 400 15px/1.2 var(--serif); color: #5b4426; }

/* the room under the city */
.qv[data-view="room"] { background: #2c1f17; }
.qv[data-view="room"] .qv-stage { padding: 0; }
.rv-svg { position: absolute; inset: 0; width: 100% !important; height: 100% !important; max-width: none !important; max-height: none !important; border-radius: 0 !important; }
.rv-text { position: absolute; right: max(20px, 4vw); bottom: 20px; width: min(430px, calc(100% - 40px)); padding: 22px 22px 18px; border-radius: 22px; background: rgba(255, 248, 239, .95); color: var(--ink); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .7); animation: rise .8s .3s cubic-bezier(.2, .8, .2, 1) both; }
.rv-text h2 { margin: 0 0 10px; font: 400 clamp(24px, 3.6vw, 30px)/1.1 var(--serif); letter-spacing: -.01em; }
.rv-text p { margin: 0 0 14px; font-size: 16.5px; line-height: 1.5; }
.rv-text .btn { color: var(--ink); border-color: var(--ink); }
.rv-text .btn.primary { background: var(--ink); color: var(--paper); }
.rv-text .row[hidden] { display: none; }
.rv-new { font: 500 12px/1.5 var(--mono) !important; letter-spacing: .06em; color: #b14a17; }
.rv-count { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: #fff0d4; }
.rv-count.flip { animation: flip .6s ease; }
@keyframes flip { 0% { transform: rotateX(90deg); } 100% { transform: none; } }
.qv[data-view="room"] .qv-top { position: relative; z-index: 1; }

@media (max-width: 640px) {
  .qv-top { padding: max(10px, env(safe-area-inset-top)) 12px 4px; }
  .qv-stage { padding: 0 6px; }
  .qv-stage > svg { height: auto; width: 100%; }
  .qv-msg { font-size: 15px; }
  .dpad { grid-template-columns: repeat(4, 44px); }
  .btn.turn { width: 44px; height: 44px; }
  .rv-text { left: 12px; right: 12px; width: auto; bottom: 12px; padding: 18px 16px 14px; }
  .pocket { left: 12px; }
  .pocket-pop { left: 12px; }
  .using { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 52px); }
}
@media (prefers-reduced-motion: reduce) {
  .pv-sh { animation: none; }
  .formed #pv-key, .pocket.nudge, .found.grow, .rv-count.flip, .qv.in, .rv-text { animation: none; }
}

/* the corner got a map button; on narrower screens lift the controls hint above the buttons */
@media (max-width: 1180px) and (min-width: 641px) { .hint { bottom: 62px; } }
body:not(.riding) .pocket, body:not(.riding) .act { display: none; }   /* nothing of the escape game shows during the intro */
body:has(.using:not([hidden])) .hint { opacity: 0; }   /* the "using it" bar takes the hint's spot */
