:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --museum-ink: #edf4ee;
  --museum-muted: #9aada4;
  --museum-jade: #6eb89b;
  --museum-jade-dark: #2e735b;
  --museum-brass: #d8ad55;
  --museum-panel: rgba(20, 38, 33, 0.94);
  --museum-line: rgba(215, 231, 222, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  min-height: 100svh;
  color: var(--museum-ink);
  background:
    radial-gradient(circle at 16% 8%, rgba(109, 160, 139, 0.16), transparent 25rem),
    radial-gradient(circle at 90% 82%, rgba(172, 126, 55, 0.12), transparent 30rem),
    linear-gradient(145deg, #13221e 0%, #0d1916 52%, #0a1210 100%);
}

button,
a,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.museum-shell {
  width: min(100%, 590px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

.museum-shell.museum-shell--r2 {
  width: min(100%, 760px);
}

.museum-header {
  min-height: 62px;
  padding: 0 4px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.museum-eyebrow {
  margin: 0 0 3px;
  color: #88a297;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: clamp(25px, 6vw, 36px);
  letter-spacing: 0.06em;
}

.legacy-link {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid var(--museum-line);
  border-radius: 999px;
  color: #b9c9c1;
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.artifact-nav {
  margin: 0 2px 10px;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  border: 1px solid rgba(202, 224, 213, 0.1);
  border-radius: 16px;
  background: rgba(5, 14, 11, 0.34);
}

.artifact-nav a {
  padding: 9px 10px;
  border-radius: 12px;
  color: #84978e;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.artifact-nav a span {
  margin-right: 5px;
  color: #c7a45c;
  letter-spacing: 0.08em;
}

.artifact-nav a.is-active {
  color: #eff5f1;
  background: linear-gradient(135deg, rgba(57, 119, 95, 0.72), rgba(33, 79, 62, 0.78));
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.2);
}

.artifact-nav--all {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.artifact-nav--all a {
  min-width: 0;
  padding-inline: 5px;
  font-size: 9px;
}

.museum-card {
  overflow: hidden;
  border: 1px solid rgba(202, 224, 213, 0.14);
  border-radius: 28px;
  background: rgba(21, 39, 34, 0.88);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.operation-stage {
  position: relative;
  width: 100%;
  background: #10211c;
}

.operation-toolbar {
  min-height: 62px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(215, 231, 222, 0.1);
  background: linear-gradient(135deg, rgba(27, 52, 44, 0.98), rgba(15, 34, 29, 0.98));
}

.operation-toolbar-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.operation-toolbar-copy strong {
  color: #eef6f1;
  font-size: 13px;
}

.operation-toolbar-copy span {
  color: #92a99f;
  font-size: 10px;
  line-height: 1.4;
}

.focus-view-button {
  min-width: 142px;
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(232, 195, 113, 0.52);
  border-radius: 14px;
  color: #fff3cf;
  background: linear-gradient(135deg, rgba(139, 101, 37, 0.68), rgba(52, 112, 87, 0.9));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font-size: 12px;
  font-weight: 900;
  touch-action: manipulation;
}

.focus-view-button:hover,
.focus-view-button:focus-visible {
  border-color: rgba(255, 222, 145, 0.84);
  background: linear-gradient(135deg, rgba(164, 121, 45, 0.82), rgba(60, 133, 101, 0.96));
  outline: 2px solid rgba(126, 204, 172, 0.34);
  outline-offset: 2px;
}

.operation-stage:fullscreen,
.operation-stage.is-focus-fallback {
  --focus-canvas-width: min(calc(100vw - 24px), 820px);
  width: 100vw;
  height: 100dvh;
  padding: max(8px, env(safe-area-inset-top)) 0 max(8px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  color: var(--museum-ink);
  background:
    radial-gradient(circle at 50% 16%, rgba(89, 150, 124, 0.18), transparent 36rem),
    #07130f;
}

.operation-stage.is-focus-fallback {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.operation-stage:fullscreen .operation-toolbar,
.operation-stage.is-focus-fallback .operation-toolbar,
.operation-stage:fullscreen .museum-canvas-frame,
.operation-stage.is-focus-fallback .museum-canvas-frame {
  width: var(--focus-canvas-width);
  flex: 0 0 auto;
}

.operation-stage:fullscreen .operation-toolbar,
.operation-stage.is-focus-fallback .operation-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border: 1px solid rgba(215, 231, 222, 0.18);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
}

.operation-stage:fullscreen .museum-canvas-frame,
.operation-stage.is-focus-fallback .museum-canvas-frame {
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.52);
}

body.museum-focus-lock {
  overflow: hidden;
}

body.museum-focus-lock .museum-card {
  overflow: visible;
}

.museum-statusbar {
  min-height: 66px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--museum-line);
}

.artifact-title {
  display: grid;
  gap: 1px;
}

.artifact-title span {
  color: #8da198;
  font-size: 10px;
  letter-spacing: 0.12em;
}

.artifact-title strong {
  font-size: 17px;
}

.mode-switch {
  padding: 3px;
  display: flex;
  border: 1px solid rgba(196, 220, 208, 0.14);
  border-radius: 999px;
  background: rgba(5, 14, 11, 0.48);
}

.mode-switch button {
  min-width: 58px;
  padding: 7px 10px;
  border: 0;
  border-radius: 999px;
  color: #8fa29a;
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.mode-switch button.is-active {
  color: #f3f7f4;
  background: linear-gradient(135deg, #347a62, #215441);
  box-shadow: 0 6px 14px rgba(13, 45, 34, 0.42);
}

.museum-canvas-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 720 / 1000;
  overflow: hidden;
  background: #11221d;
  isolation: isolate;
}

#museumCanvas,
#referenceCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

#museumCanvas {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#museumCanvas.is-dragging {
  cursor: grabbing;
}

.camera-zoom-tools {
  position: absolute;
  z-index: 4;
  top: 12px;
  left: 12px;
  width: 148px;
  padding: 6px;
  display: grid;
  gap: 5px;
  border: 1px solid rgba(224, 236, 229, 0.18);
  border-radius: 13px;
  color: #edf5f0;
  background: rgba(17, 34, 29, 0.86);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(9px);
}

.camera-zoom-label {
  color: #f5e5b7;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-align: center;
}

.camera-zoom-stepper {
  display: grid;
  grid-template-columns: 40px 54px 40px;
  overflow: hidden;
  border: 1px solid rgba(224, 236, 229, 0.12);
  border-radius: 10px;
}

.camera-zoom-tools button,
.camera-zoom-tools output {
  display: grid;
  min-width: 0;
  min-height: 40px;
  place-items: center;
  border: 0;
  color: inherit;
  background: transparent;
  font: 800 12px/1 "Microsoft YaHei", sans-serif;
}

.camera-zoom-tools button {
  cursor: pointer;
  font-size: 20px;
  touch-action: manipulation;
}

.camera-zoom-tools button:hover:not(:disabled),
.camera-zoom-tools button:focus-visible {
  background: rgba(88, 151, 123, 0.28);
  outline: none;
}

.camera-zoom-tools button:disabled {
  color: rgba(225, 235, 229, 0.34);
  cursor: default;
}

.camera-zoom-tools output {
  border-right: 1px solid rgba(224, 236, 229, 0.12);
  border-left: 1px solid rgba(224, 236, 229, 0.12);
  color: #c9e5d8;
  font-size: 11px;
  font-weight: 900;
}

.canvas-tools {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  display: grid;
  gap: 7px;
}

.canvas-tools button {
  padding: 8px 10px;
  border: 1px solid rgba(224, 236, 229, 0.16);
  border-radius: 12px;
  color: #e1ebe5;
  background: rgba(17, 34, 29, 0.82);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(9px);
  font-size: 10px;
  font-weight: 800;
}

.canvas-tools button.is-blocked {
  border-color: rgba(218, 165, 75, 0.58);
  animation: blocked 260ms ease 2;
}

.museum-toast {
  position: absolute;
  left: 50%;
  bottom: 20px;
  z-index: 5;
  max-width: calc(100% - 34px);
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: #fff;
  background: rgba(11, 27, 22, 0.92);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
}

.museum-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.reference-panel,
.phase-panel {
  position: absolute;
  inset: 0;
  z-index: 6;
}

.reference-panel[hidden],
.phase-panel[hidden],
.assist-confirm[hidden] {
  display: none;
}

.reference-panel {
  padding: 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  background: rgba(8, 19, 16, 0.92);
  backdrop-filter: blur(12px);
}

.reference-panel header,
.reference-panel footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reference-panel header > div {
  display: grid;
  gap: 2px;
}

.reference-panel header span,
.reference-panel footer {
  color: #93a69d;
  font-size: 10px;
}

.reference-panel header strong {
  font-size: 13px;
}

.reference-panel header button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--museum-line);
  border-radius: 50%;
  color: #e9f1ec;
  background: rgba(255, 255, 255, 0.05);
  font-size: 22px;
}

.reference-viewport {
  overflow: hidden;
  border: 1px solid rgba(214, 230, 222, 0.14);
  border-radius: 20px;
  background: #11221d;
}

#referenceCanvas {
  transform-origin: 50% 50%;
  transition: transform 160ms ease;
}

.reference-panel footer {
  justify-content: center;
}

.reference-panel footer input {
  width: min(60%, 260px);
  accent-color: var(--museum-jade);
}

.phase-panel {
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(14, 29, 24, 0.9);
  backdrop-filter: blur(10px);
  animation: reveal 260ms ease both;
}

.phase-seal {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border: 2px solid #d2a650;
  border-radius: 50%;
  color: #f0cb78;
  box-shadow: 0 0 0 6px rgba(210, 166, 80, 0.09), inset 0 0 18px rgba(210, 166, 80, 0.12);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 38px;
}

.phase-panel h2 {
  margin: 5px 0 8px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 38px;
}

.phase-panel > p:not(.museum-eyebrow) {
  max-width: 320px;
  color: #a8b9b0;
  font-size: 13px;
  line-height: 1.7;
}

.phase-panel > button {
  margin-top: 8px;
  padding: 11px 25px;
  border: 0;
  border-radius: 999px;
  color: #f4f8f5;
  background: linear-gradient(135deg, #438c70, #2b6651);
  box-shadow: 0 10px 24px rgba(5, 22, 16, 0.36);
  font-weight: 800;
}

.hint-copy {
  min-height: 66px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  border-top: 1px solid var(--museum-line);
  border-bottom: 1px solid var(--museum-line);
}

.hint-copy > span {
  min-width: 42px;
  padding: 5px 7px;
  border: 1px solid rgba(104, 180, 151, 0.28);
  border-radius: 999px;
  color: #8ed0b5;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.hint-copy p {
  margin-bottom: 0;
  color: #a5b6ae;
  font-size: 11px;
  line-height: 1.55;
}

.museum-controls {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 8px;
}

.museum-controls button {
  min-height: 38px;
  padding: 7px 8px;
  border: 1px solid rgba(210, 229, 219, 0.13);
  border-radius: 12px;
  color: #bac9c1;
  background: rgba(255, 255, 255, 0.035);
  font-size: 10px;
  font-weight: 800;
}

.museum-controls .hint-button {
  color: #f1cc7f;
  border-color: rgba(218, 174, 85, 0.25);
  background: rgba(193, 139, 47, 0.08);
}

.hint-button > span:first-child {
  width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
  margin-right: 3px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.assist-confirm {
  margin: 0 12px 12px;
  padding: 10px;
  border: 1px solid rgba(218, 174, 85, 0.25);
  border-radius: 14px;
  background: rgba(174, 120, 38, 0.08);
}

.assist-confirm p {
  margin-bottom: 8px;
  color: #c8b58c;
  font-size: 10px;
  line-height: 1.5;
}

.assist-confirm > div {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.assist-confirm button {
  padding: 7px 10px;
  border: 1px solid rgba(230, 208, 161, 0.18);
  border-radius: 9px;
  color: #d9c9a7;
  background: rgba(255, 255, 255, 0.04);
  font-size: 10px;
  font-weight: 800;
}

#assistAccept {
  color: #17251f;
  background: #d4ae62;
}

.demo-note {
  margin: 10px 8px 0;
  color: #768a80;
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

/* R3 uses the shared shell but keeps its mechanical-status overlays scoped. */
.museum-shell--r3 .museum-card--r3 {
  position: relative;
}

.r3-state-strip {
  position: absolute;
  z-index: 3;
  top: 92px;
  left: 50%;
  width: min(390px, calc(100% - 330px));
  min-width: 280px;
  padding: 7px 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  border: 1px solid rgba(216, 232, 223, 0.14);
  border-radius: 999px;
  color: #c7d7cf;
  background: rgba(10, 24, 19, 0.78);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  font-size: 9px;
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.r3-state-strip span + span {
  border-left: 1px solid rgba(215, 231, 222, 0.11);
}

.r3-ownership-key {
  position: absolute;
  z-index: 4;
  top: 130px;
  left: 50%;
  width: min(420px, calc(100% - 46px));
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid rgba(221, 235, 227, 0.12);
  border-radius: 999px;
  color: #c8d9d0;
  background: rgba(7, 20, 16, 0.76);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  font-size: 9px;
  font-weight: 800;
  transform: translateX(-50%);
  pointer-events: none;
}

.r3-ownership-key span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.r3-ownership-key i {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.58), 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.r3-ownership-key .is-jade i {
  background: #75c5a5;
}

.r3-ownership-key .is-brass i {
  background: #d49838;
}

.r3-storage-tray {
  position: absolute;
  z-index: 5;
  right: 22px;
  bottom: 96px;
  width: min(280px, calc(100% - 32px));
  min-height: 152px;
  padding: 10px 12px 8px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  border: 1px solid rgba(224, 190, 112, 0.58);
  border-radius: 22px;
  color: #cddbd4;
  background:
    linear-gradient(155deg, rgba(74, 69, 48, 0.98), rgba(27, 43, 36, 0.98) 48%, rgba(12, 28, 23, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 242, 194, 0.2),
    inset 0 -14px 30px rgba(0, 0, 0, 0.28),
    0 16px 34px rgba(0, 0, 0, 0.34);
  font-size: 9px;
  transform: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.r3-storage-tray::before,
.r3-storage-tray::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 12px;
  height: 54px;
  border: 1px solid rgba(227, 194, 117, 0.46);
  background: #2e372d;
  transform: translateY(-50%);
}

.r3-storage-tray::before {
  left: -8px;
  border-radius: 8px 0 0 8px;
}

.r3-storage-tray::after {
  right: -8px;
  border-radius: 0 8px 8px 0;
}

.r3-storage-tray > header,
.r3-storage-tray > footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.r3-storage-tray > header span {
  color: #f4e5bd;
  font-size: 11px;
  font-weight: 900;
}

.r3-storage-tray > header strong {
  color: #82cdb0;
  font-size: 9px;
  letter-spacing: 0.12em;
}

.r3-storage-tray > footer {
  justify-content: center;
  color: #a7bab0;
}

.r3-storage-well {
  position: relative;
  min-height: 92px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(232, 202, 133, 0.3);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 42%, rgba(39, 77, 63, 0.82), rgba(7, 18, 14, 0.9) 68%),
    #0b1c17;
  box-shadow:
    inset 0 12px 22px rgba(0, 0, 0, 0.48),
    inset 0 0 0 5px rgba(0, 0, 0, 0.14);
}

.r3-storage-well::after {
  content: "R3";
  position: absolute;
  right: 10px;
  bottom: 6px;
  color: rgba(220, 194, 127, 0.35);
  font: 900 18px/1 Georgia, serif;
}

.r3-storage-empty {
  color: #9cafA5;
  font-size: 10px;
  font-weight: 700;
}

.r3-storage-piece {
  position: relative;
  z-index: 2;
  width: 104px;
  height: 86px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: grab;
  touch-action: none;
}

.r3-storage-piece:hover,
.r3-storage-piece:focus-visible {
  filter: drop-shadow(0 0 10px rgba(121, 214, 177, 0.5));
  outline: none;
}

.r3-storage-piece.is-being-carried {
  opacity: 0.18;
}

.r3-storage-piece svg,
.r3-drag-proxy svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.r3-piece-ring {
  fill: none;
  stroke: #76c5a5;
  stroke-width: 10;
  stroke-linecap: round;
  filter: drop-shadow(0 4px 2px rgba(0, 0, 0, 0.42));
}

.r3-piece-ring path {
  stroke: #76c5a5;
}

.r3-piece-ring circle {
  fill: #8cd7b8;
  stroke: #2e6f59;
  stroke-width: 2;
}

.r3-storage-tray.is-occupied {
  border-color: rgba(125, 211, 175, 0.72);
}

.r3-storage-tray.is-drop-target {
  border-color: #9ce7c7;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 0 30px rgba(65, 158, 119, 0.32),
    0 0 0 5px rgba(114, 220, 177, 0.2),
    0 18px 42px rgba(0, 0, 0, 0.4);
  transform: scale(1.02);
}

.r3-drag-proxy {
  --r3-drag-size: 220px;
  --r3-drag-angle: 0deg;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: var(--r3-drag-size);
  height: var(--r3-drag-size);
  pointer-events: none;
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.48));
  transform: translate(-50%, -50%) rotate(var(--r3-drag-angle));
  transform-origin: center;
  transition: width 100ms ease, height 100ms ease, filter 100ms ease;
}

.r3-drag-proxy[hidden] {
  display: none;
}

.r3-drag-proxy.is-over-tray,
.r3-drag-proxy.is-over-groove {
  filter: drop-shadow(0 0 16px rgba(132, 237, 194, 0.84));
}

.museum-shell--r3 #museumCanvas.is-drop-target {
  outline: 4px solid rgba(126, 232, 188, 0.4);
  outline-offset: -5px;
}

.museum-shell--r3 #carryModeButton.is-active {
  border-color: rgba(124, 223, 182, 0.78);
  color: #dffbef;
  background: rgba(43, 119, 89, 0.9);
  box-shadow: 0 0 0 3px rgba(98, 195, 155, 0.13);
}

.museum-shell--r3 #carryModeButton:disabled {
  opacity: 0.66;
}

.museum-controls--r3 {
  grid-template-columns: 1.25fr 1fr;
}

/* R3 focus view pins every control and the physical parts tray needed to finish. */
.operation-stage--r3:fullscreen .camera-zoom-tools,
.operation-stage--r3.is-focus-fallback .camera-zoom-tools {
  position: fixed;
  top: max(78px, calc(env(safe-area-inset-top) + 72px));
  left: max(12px, calc(50vw - 398px));
  z-index: 42;
}

.operation-stage--r3:fullscreen .canvas-tools,
.operation-stage--r3.is-focus-fallback .canvas-tools {
  position: fixed;
  top: max(78px, calc(env(safe-area-inset-top) + 72px));
  right: max(12px, calc(50vw - 398px));
  z-index: 42;
}

.operation-stage--r3:fullscreen .r3-state-strip,
.operation-stage--r3.is-focus-fallback .r3-state-strip {
  position: fixed;
  top: max(158px, calc(env(safe-area-inset-top) + 152px));
  left: 50%;
  z-index: 41;
}

.operation-stage--r3:fullscreen .r3-storage-tray,
.operation-stage--r3.is-focus-fallback .r3-storage-tray {
  position: fixed;
  bottom: max(8px, env(safe-area-inset-bottom));
  right: max(12px, env(safe-area-inset-right));
  left: auto;
  z-index: 42;
}

.operation-stage--r3:fullscreen .museum-toast,
.operation-stage--r3.is-focus-fallback .museum-toast {
  position: fixed;
  bottom: max(82px, calc(env(safe-area-inset-bottom) + 76px));
  left: 50%;
  z-index: 43;
  transform: translate(-50%, 8px);
}

.operation-stage--r3:fullscreen .museum-toast.is-visible,
.operation-stage--r3.is-focus-fallback .museum-toast.is-visible {
  transform: translate(-50%, 0);
}

.operation-stage--r3:fullscreen .phase-panel,
.operation-stage--r3.is-focus-fallback .phase-panel {
  position: fixed;
  inset: max(72px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  z-index: 60;
  width: min(720px, calc(100vw - 24px));
  margin: auto;
  border-radius: 22px;
}

@media (max-width: 620px) {
  .r3-state-strip {
    top: 108px;
    width: min(320px, calc(100% - 30px));
    min-width: 0;
    font-size: 8px;
  }

  .r3-ownership-key {
    top: 148px;
    width: min(330px, calc(100% - 24px));
    gap: 7px;
    padding-inline: 7px;
    font-size: 7px;
  }

  .r3-storage-tray {
    right: auto;
    left: 50%;
    bottom: 12px;
    width: min(310px, calc(100% - 24px));
    min-height: 132px;
    padding: 8px 10px 6px;
    transform: translateX(-50%);
  }

  .r3-storage-tray.is-drop-target {
    transform: translateX(-50%) scale(1.02);
  }

  .r3-storage-well {
    min-height: 76px;
  }

  .r3-storage-piece {
    width: 88px;
    height: 70px;
  }

  .museum-shell--r3 .camera-zoom-tools {
    top: 10px;
    left: 10px;
  }

  .museum-shell--r3 .canvas-tools {
    top: 10px;
    right: 10px;
  }
}

button:active,
.legacy-link:active {
  transform: translateY(1px);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
}

@keyframes blocked {
  50% {
    transform: translateX(4px);
  }
}

@media (max-height: 820px) and (min-width: 420px) {
  .museum-shell {
    width: min(100%, 500px);
    padding-top: 8px;
  }

  .museum-header {
    min-height: 45px;
    padding-bottom: 7px;
  }

  .museum-header .museum-eyebrow {
    display: none;
  }

  h1 {
    font-size: 26px;
  }

  .museum-card {
    border-radius: 22px;
  }

  .museum-statusbar {
    min-height: 54px;
    padding-block: 7px;
  }

  .hint-copy {
    min-height: 54px;
    padding-block: 7px;
  }
}

@media (max-width: 419px) {
  .operation-toolbar {
    min-height: 66px;
    padding-inline: 10px;
    gap: 8px;
  }

  .operation-toolbar-copy strong {
    font-size: 12px;
  }

  .operation-toolbar-copy span {
    max-width: 155px;
    font-size: 9px;
  }

  .focus-view-button {
    min-width: 132px;
    min-height: 44px;
    padding-inline: 10px;
    font-size: 11px;
  }

  .operation-stage:fullscreen,
  .operation-stage.is-focus-fallback {
    --focus-canvas-width: min(calc(100vw - 10px), 820px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Shared, data-driven R4-R9 exhibit shell. */
.museum-shell--series {
  width: min(100%, 820px);
}

.artifact-nav--series {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.artifact-nav--series a {
  min-width: 0;
  padding-inline: 6px;
}

.museum-card--series,
.operation-stage--series {
  position: relative;
}

.museum-canvas-frame--series {
  aspect-ratio: 720 / 1000;
}

.series-state-strip {
  position: absolute;
  z-index: 4;
  top: 96px;
  left: 50%;
  width: min(430px, calc(100% - 330px));
  min-width: 270px;
  padding: 7px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px 10px;
  border: 1px solid rgba(218, 233, 224, 0.15);
  border-radius: 16px;
  color: #d3dfd9;
  background: rgba(7, 20, 16, 0.84);
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.24);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.series-state-strip span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.series-state-strip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d69b43;
  box-shadow: 0 0 0 2px rgba(214, 155, 67, 0.18);
}

.series-state-strip .is-open i,
.series-state-strip .is-stored i {
  background: #72d0aa;
  box-shadow: 0 0 0 2px rgba(114, 208, 170, 0.18);
}

.series-storage-tray {
  position: relative;
  z-index: 7;
  right: auto;
  left: auto;
  top: auto;
  bottom: auto;
  width: min(620px, calc(100% - 24px));
  margin: 12px auto;
  min-height: 162px;
  padding: 10px 12px 9px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 7px;
  border: 1px solid rgba(224, 190, 112, 0.58);
  border-radius: 22px;
  color: #d4dfda;
  background: linear-gradient(155deg, rgba(80, 72, 49, 0.98), rgba(27, 43, 36, 0.98) 48%, rgba(9, 24, 19, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 242, 194, 0.2), inset 0 -16px 34px rgba(0, 0, 0, 0.3), 0 18px 38px rgba(0, 0, 0, 0.36);
}

.series-storage-tray.is-minimized {
  width: min(320px, calc(100% - 24px));
  min-height: 112px;
  padding: 7px 8px 6px;
}

.series-storage-tray.is-minimized .series-storage-slot {
  min-height: 56px;
}

.series-storage-tray.is-minimized .series-storage-piece,
.series-storage-tray.is-minimized .series-storage-piece canvas {
  min-height: 48px;
  height: 48px;
}

.series-storage-tray > header,
.series-storage-tray > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 9px;
}

.series-storage-tray > header span {
  color: #f5e5b8;
  font-size: 11px;
  font-weight: 900;
}

.series-storage-tray > header strong {
  color: #8bd1b5;
  letter-spacing: 0.08em;
}

.series-storage-tray > footer {
  justify-content: center;
  color: #a9bbb2;
}

.series-storage-slots {
  display: grid;
  grid-template-columns: repeat(var(--series-slot-count, 1), minmax(0, 1fr));
  gap: 8px;
}

.series-storage-slot {
  position: relative;
  min-width: 0;
  min-height: 98px;
  padding: 6px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(233, 204, 136, 0.28);
  border-radius: 16px;
  color: #a8bbb1;
  background: radial-gradient(circle at 50% 42%, rgba(41, 77, 64, 0.82), rgba(6, 17, 13, 0.94) 70%);
  box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.46), inset 0 0 0 5px rgba(0, 0, 0, 0.12);
  font-size: 9px;
  font-weight: 800;
  text-align: center;
  touch-action: none;
}

.series-storage-slot::after {
  content: attr(data-label);
  position: absolute;
  right: 7px;
  bottom: 5px;
  color: rgba(223, 196, 128, 0.33);
  font: 900 14px/1 Georgia, serif;
}

.series-storage-slot.is-drop-target {
  border-color: #9be8c7;
  box-shadow: inset 0 0 28px rgba(77, 171, 132, 0.34), 0 0 0 4px rgba(117, 220, 178, 0.18);
}

.series-storage-piece {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 82px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
}

.series-storage-piece canvas {
  width: 100%;
  height: 82px;
  display: block;
}

.series-storage-piece:hover,
.series-storage-piece:focus-visible {
  filter: drop-shadow(0 0 9px rgba(126, 224, 184, 0.62));
  outline: none;
}

.series-storage-piece.is-being-carried {
  opacity: 0.18;
}

.series-drag-proxy {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: var(--series-drag-size, 210px);
  height: var(--series-drag-size, 210px);
  pointer-events: none;
  filter: drop-shadow(0 18px 20px rgba(0, 0, 0, 0.48));
  transform: translate(-50%, -50%);
}

.series-drag-proxy[hidden] {
  display: none;
}

.series-drag-proxy canvas {
  width: 100%;
  height: 100%;
}

.series-reference-panel footer {
  justify-content: center;
  color: #aebfb7;
  font-size: 10px;
}

.series-next-link {
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(219, 190, 123, 0.4);
  border-radius: 14px;
  color: #f2dfad;
  background: rgba(120, 86, 31, 0.38);
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
}

.operation-stage--series:fullscreen .camera-zoom-tools,
.operation-stage--series.is-focus-fallback .camera-zoom-tools {
  position: fixed;
  top: max(78px, calc(env(safe-area-inset-top) + 72px));
  left: max(12px, calc(50vw - 408px));
  z-index: 42;
}

.operation-stage--series:fullscreen .canvas-tools,
.operation-stage--series.is-focus-fallback .canvas-tools {
  position: fixed;
  top: max(78px, calc(env(safe-area-inset-top) + 72px));
  right: max(12px, calc(50vw - 408px));
  z-index: 42;
}

.operation-stage--series:fullscreen .series-storage-tray,
.operation-stage--series.is-focus-fallback .series-storage-tray {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(360px, calc(100% - 24px));
  margin: 0;
  z-index: 43;
}

@media (min-width: 1000px) {
  .museum-shell--series {
    width: min(100%, 1160px);
  }

  .operation-stage--series:not(:fullscreen):not(.is-focus-fallback) {
    display: grid;
    grid-template-columns: 300px minmax(0, 820px);
    grid-template-rows: auto auto;
    justify-content: center;
    align-items: start;
    column-gap: 12px;
    padding-bottom: 12px;
  }

  .operation-stage--series:not(:fullscreen):not(.is-focus-fallback) .operation-toolbar {
    grid-column: 1 / -1;
  }

  .operation-stage--series:not(:fullscreen):not(.is-focus-fallback) .series-storage-tray {
    position: sticky;
    grid-column: 1;
    grid-row: 2;
    top: 12px;
    width: 100%;
    margin: 12px 0 0;
  }

  .operation-stage--series:not(:fullscreen):not(.is-focus-fallback) .museum-canvas-frame--series {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    margin-top: 12px;
  }
}

@media (max-width: 620px) {
  .museum-shell--series {
    padding-inline: 5px;
  }

  .artifact-nav--series {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .series-state-strip {
    top: 84px;
    width: min(340px, calc(100% - 24px));
    min-width: 0;
    font-size: 8px;
  }

  .museum-shell--series .camera-zoom-tools {
    top: 8px;
    left: 8px;
    transform: scale(0.86);
    transform-origin: top left;
  }

  .museum-shell--series .canvas-tools {
    top: 8px;
    right: 8px;
  }

  .series-storage-tray {
    position: fixed;
    right: auto;
    left: 50%;
    top: auto;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: min(370px, calc(100% - 16px));
    margin: 0;
    min-height: 142px;
    padding: 8px 9px 7px;
    transform: translateX(-50%);
  }

  .series-storage-tray.is-minimized {
    width: min(250px, calc(100% - 16px));
    min-height: 104px;
  }

  .series-storage-slot {
    min-height: 82px;
  }

  .series-storage-piece,
  .series-storage-piece canvas {
    min-height: 68px;
    height: 68px;
  }
}
