@font-face {
  font-family: "Barlow Condensed";
  src: url("assets/barlow-condensed-900.woff2") format("woff2");
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #141914;
  --deep: #101510;
  --cream: #f5e8ce;
  --muted: #c6c1a5;
  --amber: #ffc369;
  --outline: #464f41;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --display: "Barlow Condensed", Impact, "Arial Narrow", sans-serif;
  --edge: clamp(.8rem, 2.5vw, 2.1rem);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--deep); }
body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font: 500 .79rem/1.35 var(--mono);
}
h1, h2, p { margin: 0; }
button { color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.top-bar, .bottom-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  background: var(--ink);
  padding-inline: max(var(--edge), env(safe-area-inset-left)) max(var(--edge), env(safe-area-inset-right));
}
.top-bar {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  column-gap: 1rem;
  min-height: 3.55rem;
  border-bottom: 1px solid var(--outline);
  padding-top: env(safe-area-inset-top);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .68rem;
  font: 900 1.62rem/.95 var(--display);
  letter-spacing: .055em;
  text-transform: uppercase;
  white-space: nowrap;
}
.brand img { border: 1px solid #68583f; object-fit: cover; }

.contract {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: .72rem;
  min-width: 0;
  max-width: 100%;
  min-height: 2.2rem;
  padding: .32rem .65rem;
  border: 1px solid #555941;
  background: #1b2119;
  font-size: .68rem;
}
.contract-label { color: var(--amber); letter-spacing: .08em; }
.contract-address {
  overflow: hidden;
  min-width: 0;
  color: var(--cream);
  font: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}
.contract-address[data-address=""] { color: var(--muted); user-select: auto; }
.contract-copy {
  flex: none;
  padding: .2rem 0 .2rem .65rem;
  border: 0;
  border-left: 1px solid #555941;
  background: none;
  color: var(--amber);
}
.contract-copy:hover { text-decoration: underline; text-underline-offset: .2em; }
.header-actions { display: flex; justify-self: end; align-items: center; gap: .48rem; }

.sound-button, .x-account, .arrow-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .58rem;
  min-height: 2.2rem;
  border: 1px solid #555941;
  background: #1b2119;
  color: var(--muted);
  padding: .36rem .64rem;
  font-size: .68rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.sound-button:hover, .sound-button[aria-pressed="true"], .arrow-button:hover { color: var(--amber); border-color: var(--amber); }
.x-account { text-decoration: none; text-transform: none; white-space: nowrap; }
.x-account:hover { color: var(--amber); border-color: var(--amber); }
.x-icon { color: var(--cream); font: 600 .85rem/1 system-ui, sans-serif; }
.sound-icon { display: flex; gap: 2px; align-items: center; height: .78rem; }
.sound-icon i { width: 2px; height: 42%; background: currentColor; }
.sound-icon i:nth-child(2) { height: 78%; }
.sound-icon i:nth-child(3) { height: 100%; }
.sound-icon i:nth-child(4) { height: 60%; }

.checkout {
  position: relative;
  display: grid;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background: #31392d url("assets/checkout-scene.webp") center / cover no-repeat;
}
.checkout.is-ready { background-image: none; }
.camera {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.camera.is-dragging { cursor: grabbing; }
.world {
  position: absolute;
  top: 0;
  left: 0;
  width: 1672px;
  height: 941px;
  transform-origin: top left;
  visibility: hidden;
}
.is-ready .world { visibility: visible; }
.shop-art { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; pointer-events: none; }
.scanner-light {
  position: absolute;
  left: 18%;
  top: 77%;
  width: 11%;
  height: 11%;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(ellipse, #ff5d4e7a, transparent 65%);
  transform: translate(-50%, -50%) rotate(-20deg);
  pointer-events: none;
}
.scanner-light.is-flashing { animation: scanner-flash .45s ease-out; }
@keyframes scanner-flash {
  20% { opacity: .92; }
  100% { opacity: 0; }
}

.items { position: absolute; inset: 0; pointer-events: none; }
.items[inert] { visibility: hidden; }
.item-hit {
  position: absolute;
  display: block;
  left: var(--item-left);
  top: var(--item-top);
  width: var(--item-width);
  height: var(--item-height);
  border: 1px solid transparent;
  padding: 0;
  background: transparent;
  pointer-events: auto;
  touch-action: none;
}
.item-hit:focus-visible { z-index: 2; outline-offset: 1px; }
.item-hit::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 12px;
  width: 15px;
  height: 15px;
  border: 2px solid var(--amber);
  background: #1a1c13d9;
  box-shadow: 0 0 0 1px #171b14, 0 0 10px #ffb34958;
  transform: translate(-50%, -50%) rotate(45deg);
  pointer-events: none;
}
.item-hit.is-seen::before { border-color: #d5dfb0; box-shadow: 0 0 0 1px #172015; }
.item-hint {
  position: absolute;
  z-index: 3;
  bottom: calc(100% + 5px);
  left: 50%;
  display: block;
  padding: 6px 9px;
  border: 1px solid #caa35f;
  background: #1a2118f2;
  color: var(--cream);
  font: 500 16px/1.15 var(--mono);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%);
}
.item-hit:focus-visible .item-hint { opacity: 1; }
@media (hover: hover) {
  .item-hit:hover { z-index: 2; }
  .item-hit:hover .item-hint { opacity: 1; }
  .item-hit:hover::before, .item-hit:focus-visible::before { background: var(--amber); }
}
.is-dragging .item-hint { opacity: 0; }

.screen-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(0deg, #10130c63, transparent 18%, transparent 90%, #0c130b33);
  box-shadow: inset 0 0 75px #10120e52;
}
.reticle {
  position: absolute;
  left: 50%;
  top: 49.5%;
  width: 16px;
  height: 16px;
  opacity: .65;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.reticle i { position: absolute; display: block; }
.reticle i:first-child {
  inset: 0 7px;
  border-block: 4px solid #fff1c8;
}
.reticle i:last-child {
  inset: 7px 0;
  border-inline: 4px solid #fff1c8;
}
.checkout:not(.is-ready) .reticle, .checkout.is-inspecting .reticle { visibility: hidden; }

.inspection {
  position: absolute;
  right: var(--edge);
  bottom: var(--edge);
  width: min(29rem, 48%);
  padding: clamp(.95rem, 2.1vw, 1.35rem);
  border: 1px solid #d2a759;
  background: #151c14f0;
  box-shadow: 5px 5px 0 #080d09a6;
  animation: panel-in .26s ease-out both;
}
.inspection.details-left { right: auto; left: var(--edge); }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(.55rem); }
  to { opacity: 1; transform: none; }
}
.item-category {
  margin-bottom: .32rem;
  color: #c4c5a6;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .11em;
}
.inspection h2 {
  margin-bottom: .43rem;
  font: 900 clamp(1.85rem, 4vw, 3.15rem)/.92 var(--display);
  letter-spacing: .025em;
  text-transform: uppercase;
}
.item-description { color: var(--cream); font-size: clamp(.81rem, 1.25vw, .98rem); }
.type-line { display: grid; }
.type-line::before, .typed-copy { grid-area: 1 / 1; }
.type-line::before { content: attr(data-full-text); visibility: hidden; }
.typed-copy.is-typing::after {
  position: absolute;
  width: .36em;
  height: .75em;
  margin: .13em 0 0 .13em;
  background: var(--amber);
  content: "";
}
.back-button {
  display: inline-flex;
  gap: .62rem;
  align-items: center;
  min-height: 2.35rem;
  border: 0;
  margin-top: .62rem;
  padding: .2rem .12rem;
  background: none;
  color: var(--amber);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.back-button:hover { text-decoration: underline; text-underline-offset: .27em; }

.bottom-bar {
  min-height: 2.8rem;
  border-top: 1px solid var(--outline);
  padding-bottom: env(safe-area-inset-bottom);
}
.controls, .progress, .look-controls { display: flex; align-items: center; gap: .7rem; }
.hint, .progress {
  color: var(--muted);
  font-size: .67rem;
  letter-spacing: .075em;
  text-transform: uppercase;
}
.hint span { color: var(--amber); }
.hint-touch, .look-controls { display: none; }
.progress { flex: none; white-space: nowrap; }
.progress-marks { display: flex; gap: 3px; }
.progress-marks i { width: 9px; height: 4px; background: #495342; }
.progress-marks i.is-seen { background: var(--amber); }
.arrow-button { min-width: 2.05rem; padding: .3rem; }
.arrow-button i { width: 6px; height: 6px; border: solid currentColor; border-width: 1px 1px 0 0; transform: rotate(45deg); }
.arrow-left i { transform: rotate(-135deg); }
.is-inspecting + .bottom-bar .controls { visibility: hidden; }

@media (max-width: 700px), (pointer: coarse) {
  .look-controls { display: flex; gap: .24rem; }
  .hint-touch { display: block; }
  .hint-desktop { display: none; }
  .reticle { opacity: .35; }
}
@media (max-width: 700px) {
  .top-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .42rem .55rem;
    min-height: 0;
    padding-top: calc(.48rem + env(safe-area-inset-top));
    padding-bottom: .45rem;
  }
  .brand { gap: .48rem; font-size: 1.42rem; }
  .brand img { width: 29px; height: 29px; }
  .header-actions { grid-column: 2; grid-row: 1; gap: .36rem; }
  .contract { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; min-height: 1.8rem; }
  .contract-address { flex: 1; }
  .sound-button, .x-account { font-size: .61rem; min-height: 1.95rem; gap: .38rem; padding-inline: .48rem; }
  .bottom-bar { min-height: 3rem; }
  .controls, .progress { gap: .45rem; }
  .hint, .progress { font-size: .58rem; letter-spacing: .015em; }
  .progress-marks { display: none; }
  .inspection, .inspection.details-left {
    left: var(--edge);
    right: var(--edge);
    bottom: var(--edge);
    width: auto;
  }
}
@media (max-width: 360px) {
  .x-handle { display: none; }
  .x-account { min-width: 1.95rem; }
}
@media (prefers-reduced-motion: reduce) {
  .inspection, .scanner-light.is-flashing { animation: none; }
}
