/* The 3D frame: the sword fills the window; a few round controls float over the dark studio. Phone first.
   Colours as the shop and the 3D test page: black, sage (#8ba399), light grey text. No outside fonts. */
:root { --sage: #8ba399; --glass: rgba(8, 10, 11, .72); --line: #3a4246; --text: #dfe5e3; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; overscroll-behavior: none; }
html { -webkit-text-size-adjust: 100%; }
body { color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

.f { position: fixed; inset: 0; overflow: hidden; background: radial-gradient(120% 90% at 50% 40%, #0c1012 0, #000 72%); touch-action: none; }
.still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; transition: opacity .45s; }
.f[data-state="ready"] .still { opacity: 0; pointer-events: none; }
.f[data-state="failed"] .still { object-fit: contain; }
.gl, .gl canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* every direction of a swipe on the sword turns it: the page around the frame never scrolls from here */
.gl canvas { display: block; cursor: grab; touch-action: none; outline: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.gl canvas:active { cursor: grabbing; }
.f:not([data-state="ready"]) .gl { visibility: hidden; }

.load { position: absolute; left: 50%; bottom: 14px; z-index: 3; transform: translateX(-50%); margin: 0; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; color: #e6ebe9; }
.f[data-state="ready"] .load { display: none; }
.f[data-state="failed"] .load { max-width: calc(100% - 24px); white-space: normal; text-align: center; letter-spacing: .02em; text-transform: none; font-size: 13px; }
.hint { position: absolute; left: 0; right: 0; bottom: 52px; z-index: 2; margin: 0; padding: 0 8px; text-align: center; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #aab3b0; pointer-events: none; transition: opacity .6s; }
.hint.off, .f:not([data-state="ready"]) .hint { opacity: 0; }

/* top right: hand, grip, full screen. The sword runs from the top left (pommel) to the bottom right in a named look, so
   this corner stays clear of the hilt. */
.top { position: absolute; right: max(10px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); z-index: 4; display: flex; align-items: center; gap: 8px; }
.f:not([data-state="ready"]) .top > :not(#full):not(#close) { visibility: hidden; }
.btn { flex: none; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.btn svg { width: 19px; height: 19px; fill: #e6ebe9; }
.btn .off, .is-full .btn .on { display: none; }
.is-full .btn .off { display: inline; }
.grip-btn[aria-expanded="true"] { border-color: var(--sage); }
.dot { display: block; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(135deg, var(--a, #6e1e2a) 50%, var(--b, var(--a, #6e1e2a)) 50%); box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }

.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.seg button { display: inline-flex; align-items: center; height: 30px; padding: 0 11px; border: 0; border-radius: 999px; background: none; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #cfd6d8; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--sage); color: #07100c; }
.seg .long { display: none; }

/* the grip tray: opens above the part buttons */
.tray { position: absolute; left: 50%; bottom: 52px; z-index: 5; transform: translateX(-50%); width: min(360px, calc(100% - 20px)); padding: 12px 12px 12px; border: 1px solid var(--line); border-radius: 16px; background: rgba(8, 10, 11, .88); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.tray-name { margin: 0 2px 10px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #aab3b0; }
.tray-name b { margin-left: 6px; font-weight: 600; letter-spacing: 0; text-transform: none; font-size: 14px; color: #fff; }
.dots { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 10px 8px; justify-items: center; margin-bottom: 12px; }
.dots button { width: 30px; height: 30px; padding: 0; border: 2px solid #000; border-radius: 50%; outline: 1px solid #454e52; background: linear-gradient(135deg, var(--a) 50%, var(--b, var(--a)) 50%); }
.dots button[aria-pressed="true"] { outline: 2px solid #fff; }
.seg-wide { display: flex; }
.seg-wide button { flex: 1; justify-content: center; }

.chips { position: absolute; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 4; display: flex; gap: 6px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #cfd6d8; white-space: nowrap; }
.chips button:first-child { margin-left: auto; }
.chips button:last-child { margin-right: auto; }
.chips button[aria-pressed="true"] { border-color: var(--sage); color: #fff; }
.f:not([data-state="ready"]) .chips { visibility: hidden; }

@media (max-width: 359px) {
  .chips { gap: 4px; padding: 0 4px; }
  .chips button { padding: 0 8px; font-size: 10.5px; letter-spacing: .02em; }
  .seg button { padding: 0 9px; }
}
@media (min-width: 600px) and (min-height: 420px) {
  .seg .long { display: inline; }
  .btn { width: 40px; height: 40px; }
  .chips { bottom: max(14px, env(safe-area-inset-bottom)); }
  .chips button { height: 32px; padding: 0 13px; font-size: 12px; }
  .hint { bottom: 60px; }
  .tray { bottom: 58px; }
}
@media (prefers-reduced-motion: reduce) { .still, .hint { transition: none; } }
