*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: #8d8d8d;
  color: #141414;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.counter {
  position: fixed; top: 20px; left: 24px; z-index: 20;
  font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; color: #fff;
}
.counter #count { font-size: 28px; font-weight: 300; margin-left: 6px; letter-spacing: 0; }

.layout { display: flex; min-height: 100vh; }
.stage {
  --gap: 8px;
  --size: clamp(44px, calc((100vw - 340px - 100px - 8 * var(--gap)) / 9), 124px);
  flex: 1; min-width: 0;
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 90px 24px 28px 76px;
  gap: var(--gap);
}
.row { display: grid; grid-template-columns: repeat(9, var(--size)); gap: var(--gap); }

.cell { position: relative; width: var(--size); height: var(--size); }
.cube {
  position: absolute; inset: 0; border-radius: 7%;
  background: linear-gradient(150deg, #ffffff 0%, #f6f6f6 45%, #dcdcdc 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset, 0 -3px 6px rgba(0,0,0,0.10) inset, 0 6px 12px -4px rgba(0,0,0,0.35);
  overflow: hidden;
}
/* gloss: a soft diagonal highlight and a small specular spot */
.cube::before {
  content: ""; position: absolute; top: -20%; left: -35%; width: 70%; height: 140%;
  background: linear-gradient(100deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.95) 50%, rgba(255,255,255,0) 100%);
  transform: rotate(8deg); opacity: 0.55;
}
.cube::after {
  content: ""; position: absolute; top: 8%; left: 10%; width: 22%; height: 14%;
  border-radius: 50%; background: radial-gradient(closest-side, rgba(255,255,255,1), rgba(255,255,255,0));
}
.cell.sold { cursor: default; outline: none; }
.cube { transition: transform 90ms ease-out; transform-origin: 50% 100%; }

.card {
  position: absolute; bottom: calc(100% + 10px + var(--size) * (var(--s, 1) - 1)); left: 0; z-index: 10;
  width: 230px; padding: 14px 16px; background: #fff; color: #141414;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity 120ms ease, transform 120ms ease;
}
.cell.right .card { left: auto; right: 0; }
.cell.sold:hover .card, .cell.sold:focus-visible .card { opacity: 1; transform: none; }
.card-name { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: #666; margin: 0 0 6px; }
.card-contents { font-size: 20px; line-height: 1.25; margin: 0 0 8px; overflow-wrap: anywhere; }
.card-cost { font-size: 14px; color: #444; margin: 0; }

/* the cube on offer: greyed, shows only "buy now" until it is hovered */
.cell.next .cube {
  background: linear-gradient(150deg, #c9c9c9 0%, #bdbdbd 60%, #aaaaaa 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 6px 12px -6px rgba(0,0,0,0.25);
}
.cell.next .cube::before, .cell.next .cube::after { display: none; }
.buy-label {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #8a8a8a; letter-spacing: 0.05em; font-size: calc(var(--size) * 0.115); transition: opacity 120ms ease;
}
.buy-price { font-size: 0.9em; }
.cell.next:hover .buy-label, .cell.next:focus-within .buy-label { opacity: 0; }
.panel {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 5px; padding: 8%;
  opacity: 0; pointer-events: none; transition: opacity 120ms ease;
}
.cell.next:hover .panel, .cell.next:focus-within .panel { opacity: 1; pointer-events: auto; }
.panel input[type="text"] {
  width: 100%; min-width: 0; font: inherit; font-size: calc(var(--size) * 0.097); padding: 0.35em 0.45em;
  border: 1px solid #7a7a7a; border-radius: 6px; background: rgba(255,255,255,0.85); color: #141414; transition: width 80ms ease-out;
}
.panel input::placeholder { color: #6a6a6a; }
.panel button {
  font: inherit; font-size: calc(var(--size) * 0.097); letter-spacing: 0.03em; padding: 0.4em 0.35em;
  background: #1f9d55; color: #fff; border: 1px solid #1f9d55; border-radius: 6px; cursor: pointer; width: 100%;
}
.panel button:disabled { background: #5fae80; border-color: #5fae80; cursor: default; }
.panel .note { font-size: calc(var(--size) * 0.077); margin: 0; color: #444; min-height: 0; line-height: 1.2; }
.panel .note.error { color: #9b0018; }
.cell.next:focus-within .cube { transform: scale(1.6); }
.cell.next .cube { overflow: visible; }
.cell.right.next .panel { align-items: flex-end; }
.cell.next:hover, .cell.next:focus-within { z-index: 60 !important; }
input:focus-visible, button:focus-visible, .cell.sold:focus-visible { outline: 2px solid #111; outline-offset: 2px; }

.status { color: #fff; font-size: 14px; align-self: center; margin: 0; }

.feed {
  width: 300px; flex: none; position: sticky; top: 0; align-self: flex-start; height: 100vh;
  display: flex; flex-direction: column; background: rgba(0,0,0,0.18); border-left: 1px solid rgba(255,255,255,0.18);
}
.feed-head {
  padding: 18px 18px 12px; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.18);
}
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2ee66b; margin-right: 8px; }
.feed-scroll { flex: 1; overflow-y: auto; padding: 0 18px 18px; scroll-behavior: smooth; display: flex; flex-direction: column; }
.feed-list { list-style: none; margin: auto 0 0; padding: 0; }
.feed-list li { padding: 8px 0; font-size: 14px; line-height: 1.35; color: #fff; overflow-wrap: anywhere; }
.feed-list .feed-num { color: rgba(255,255,255,0.65); margin-right: 8px; font-size: 12px; }

@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .stage { --size: clamp(30px, calc((100vw - 32px - 8 * var(--gap)) / 9), 80px); padding: 80px 16px 20px; min-height: 70vh; }
  .feed { position: static; width: 100%; height: 260px; border-left: 0; border-top: 1px solid rgba(255,255,255,0.18); }
}
.counter .total { margin-top: 6px; }
.counter #total { font-size: 28px; font-weight: 300; margin-left: 6px; letter-spacing: 0; }

.cell.sold .card { display: none; }
.face-text { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8%; opacity: 0; transition: opacity 120ms ease-out; pointer-events: none; color: #141414; }
.cell.sold:hover .face-text, .cell.sold:focus-visible .face-text { opacity: 1; }
.face-contents { font-size: calc(var(--size) * 0.12); line-height: 1.2; margin: 0; overflow-wrap: anywhere; }
.face-name, .face-cost { position: absolute; left: 10%; margin: 0; font-size: calc(var(--size) * 0.082); letter-spacing: 0.06em; text-transform: uppercase; color: #666; }
.face-name { top: 9%; }
.face-cost { top: 9%; left: auto; right: 10%; }

.face-text { padding: 20% 10%; }

.counter, .counter .counter-label, .counter #count, .counter #total { font-family: inherit; font-size: 13px; font-weight: normal; letter-spacing: 0.1em; text-transform: uppercase; color: #fff; }
.counter #count, .counter #total { margin-left: 8px; }

.counter .total { position: fixed; top: 20px; right: 324px; margin: 0; z-index: 20; }
@media (max-width: 820px) { .counter .total { right: 16px; } }

.buy-label, .panel button { text-transform: uppercase; }

.cell.sold { cursor: pointer; }
.viewer { --vs: 240px; position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: #787878; opacity: 0; pointer-events: none; transition: opacity 320ms ease; }
.viewer.open { opacity: 1; pointer-events: auto; }
.viewer-body { display: flex; align-items: center; gap: 88px; transform: scale(0.5); transition: transform 480ms cubic-bezier(.2,.8,.2,1); }
.viewer.open .viewer-body { transform: scale(1); }
.viewer-stage { position: relative; width: var(--vs); height: var(--vs); perspective: 1000px; flex: none; }
.spin { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: cube-spin 30s linear infinite; }
@keyframes cube-spin { from { transform: rotateX(-20deg) rotateY(0deg); } to { transform: rotateX(-20deg) rotateY(360deg); } }
.face { position: absolute; inset: 0; border-radius: 6px; background: linear-gradient(150deg, #ffffff 0%, #f4f4f4 50%, #dadada 100%); box-shadow: inset 0 0 24px rgba(0,0,0,0.08); }
.f-front { transform: translateZ(calc(var(--vs) / 2)); }
.f-back { transform: rotateY(180deg) translateZ(calc(var(--vs) / 2)); background: linear-gradient(150deg, #efefef, #cfcfcf); }
.f-right { transform: rotateY(90deg) translateZ(calc(var(--vs) / 2)); background: linear-gradient(150deg, #f2f2f2, #d2d2d2); }
.f-left { transform: rotateY(-90deg) translateZ(calc(var(--vs) / 2)); background: linear-gradient(150deg, #f7f7f7, #dcdcdc); }
.f-top { transform: rotateX(90deg) translateZ(calc(var(--vs) / 2)); background: linear-gradient(150deg, #ffffff, #ececec); }
.f-bottom { transform: rotateX(-90deg) translateZ(calc(var(--vs) / 2)); background: #bdbdbd; }
.viewer-shadow { position: absolute; left: 10%; right: 10%; bottom: -46px; height: 26px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(0,0,0,0.28), rgba(0,0,0,0) 70%); }
.viewer-info { color: #fff; max-width: 340px; }
.viewer-name, .viewer-cost { margin: 0; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.viewer-cost { margin-top: 6px; }
.viewer-contents { margin: 22px 0 0; font-size: 30px; font-weight: 300; line-height: 1.25; overflow-wrap: anywhere; }
.viewer-close { position: absolute; top: 18px; right: 22px; background: none; border: 0; color: #fff; font-size: 34px; line-height: 1; cursor: pointer; padding: 4px 10px; }
@media (max-width: 820px) { .viewer { --vs: 150px; } .viewer-body { flex-direction: column; gap: 70px; } .viewer-info { text-align: center; } .viewer-contents { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; transform: rotateX(-20deg) rotateY(-30deg); } }

.viewer { --gs: 480px; }
.viewer-stage.gl { width: var(--gs); height: var(--gs); perspective: none; }
.viewer-stage.gl .spin, .viewer-stage.gl .viewer-shadow { display: none; }
.viewer-stage canvas { width: 100%; height: 100%; display: block; }
.viewer-body { gap: 40px; }
@media (max-width: 820px) { .viewer { --gs: 300px; } .viewer-body { gap: 10px; } }

.viewer-stage canvas { transform: translateY(36px); }

.panel input[type="text"] { background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(247,247,247,0.92) 45%, rgba(228,228,228,0.9) 100%); border: 1px solid rgba(255,255,255,0.75); color: #141414; box-shadow: inset 0 1px 0 #fff, inset 0 -2px 5px rgba(0,0,0,0.09), 0 1px 4px rgba(0,0,0,0.22); }
.panel button { position: relative; overflow: hidden; background: linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.16) 48%, rgba(255,255,255,0) 50%), linear-gradient(180deg, #34c16f 0%, #1c9b53 50%, #16863f 100%); border: 1px solid #148040; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,0.3); box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), inset 0 -2px 4px rgba(0,0,0,0.2), 0 2px 5px rgba(0,0,0,0.28); transition: filter 120ms ease, box-shadow 120ms ease; }
.panel button:hover:not(:disabled) { filter: brightness(1.08); }
.panel button:active:not(:disabled) { filter: brightness(0.95); box-shadow: inset 0 2px 4px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.2); }
.panel button:disabled { background: linear-gradient(180deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0.14) 48%, rgba(255,255,255,0) 50%), linear-gradient(180deg, #6fcb97 0%, #54ae7b 50%, #4a9f6f 100%); border-color: #4a9f6f; opacity: 0.92; }

.panel input[type="text"] { background: rgba(255,255,255,0.88); border: 1px solid #7a7a7a; box-shadow: inset 0 1px 0 rgba(255,255,255,0.95); }
.panel button { background: #1f9d55; border: 1px solid #1f9d55; text-shadow: none; box-shadow: inset 0 1px 0 rgba(255,255,255,0.5); }
.panel button:disabled { background: #5fae80; border-color: #5fae80; opacity: 1; }
.panel button:active:not(:disabled) { filter: brightness(0.94); box-shadow: inset 0 1px 0 rgba(255,255,255,0.3); }

.cube.stool, .cell.next .cube.stool { background: none; box-shadow: none; border-radius: 0; }
.cube.stool::before, .cube.stool::after { display: none; }
.stool-icon { position: absolute; inset: 0; transition: opacity 120ms ease; pointer-events: none; }
.stool-icon svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 3px rgba(0,0,0,0.28)); }
.cell.sold:hover .stool-icon, .cell.sold:focus-visible .stool-icon, .cell.next:hover .stool-icon, .cell.next:focus-within .stool-icon { opacity: 0.22; }
.cube.stool .buy-label { color: #6e6e6e; }

.panel input.locked { cursor: default; background: rgba(255,255,255,0.62); color: #3a3a3a; border-color: #9a9a9a; box-shadow: none; }

.panel input.locked { pointer-events: none; }
