/* Gaya khusus untuk modul simulasi Kekenyalan (Hukum Hooke) */
.hooke-module {
  --hk-ink: #252137;
  --hk-mut: #5c5670;
  --hk-line: #dcd5e8;
  --hk-line2: #cabfe0;
  --hk-soft: #ede8f6;
  --hk-inset: #f4f1fa;
  --hk-inset2: #ebe6f5;
  --hk-amber: #f59e0b;
  --hk-pri: #855300;
  --hk-peach: #ffddb8;
  --hk-peach2: #fff2e2;
  --hk-ok: #047857;
  --hk-okbg: #d1fae5;
  --hk-bad: #9f4122;
  --hk-badbg: #ffe3d1;
  --hk-teal: #0e7490;
  font-variant-numeric: tabular-nums;
}

.hooke-module #lab.lab-wrap {
  width: min(100% - 32px, 1460px);
}

.hooke-module .lab-module-logo {
  color: var(--hk-pri);
  background: var(--hk-peach2);
  border: 1px solid var(--hk-peach);
}

/* Unified studio workbench shell (no separated card boxes) */
.hooke-studio {
  background: #fff;
  border: 1px solid var(--hk-line);
  border-radius: 18px;
  box-shadow: 0 12px 32px -20px rgba(37, 33, 55, 0.25), 0 1px 0 #fff inset;
  overflow: hidden;
  margin-bottom: 18px;
}

/* Segmented controls (gravity on stage header & mode inside notes) */
.hooke-tool-lbl {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--hk-mut);
}

.hooke-seg {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--hk-inset2);
  border: 1px solid var(--hk-line);
}

.hooke-seg button {
  min-height: 36px;
  padding: 5px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--hk-mut);
  font-size: 0.81rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.hooke-seg button:hover {
  color: var(--hk-ink);
}

.hooke-seg button.on {
  background: var(--hk-ink);
  color: #fff;
  box-shadow: 0 2px 8px -2px rgba(37, 33, 55, 0.35);
}

.hooke-seg-g button {
  min-height: 28px;
  padding: 3px 9px;
  font-size: 0.78rem;
}

.hooke-seg-g button.on {
  background: var(--hk-amber);
  color: #2b1a00;
}

.hooke-g-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hooke-g-lbl,
.hooke-g-unit {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--hk-mut);
  white-space: nowrap;
}

.hooke-g-lbl {
  font-style: italic;
  color: var(--hk-ink);
}

.hooke-mode-dock {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--hk-line);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Flush mission banner inside studio */
.hooke-mission {
  padding: 14px 18px;
  background: var(--hk-peach2);
  border-bottom: 1px solid var(--hk-peach);
}

.hooke-mission .mtop {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hooke-mission .mnum {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--hk-ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex: none;
}

.hooke-mission .mtop b {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--hk-ink);
}

.stars {
  letter-spacing: 2px;
  color: var(--hk-amber);
  font-size: 0.95rem;
}

.stars i {
  font-style: normal;
  opacity: 0.28;
}

.stars i.on {
  opacity: 1;
}

.hooke-mini-btn {
  margin-inline-start: auto;
  min-height: 38px;
  border: 1px solid var(--hk-peach);
  background: #fff;
  color: var(--hk-ink);
  border-radius: 999px;
  padding: 6px 13px;
  font-weight: 700;
  font-size: 0.8rem;
}

.hooke-mini-btn:hover {
  background: var(--hk-peach);
}

.hooke-mission .mtxt {
  margin: 9px 0 2px;
  font-size: 0.9rem;
  line-height: 1.55;
  font-weight: 500;
  color: #3b3652;
  max-width: 78ch;
}

.hooke-mission .mtxt b {
  color: var(--hk-pri);
  font-weight: 800;
}

.hooke-mission .mans {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
  max-width: 540px;
}

.hooke-mission .mans input[type="text"] {
  flex: 1;
  min-width: 120px;
  min-height: 44px;
  background: #fff;
  border: 1.5px solid var(--hk-peach);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--hk-ink);
  outline: none;
}

.hooke-mission .mans input:focus {
  border-color: var(--hk-amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.24);
}

.hooke-mission .mans .u {
  font-weight: 700;
  color: var(--hk-mut);
  font-size: 0.9rem;
}

.hooke-mission .mfb {
  margin-top: 8px;
  font-size: 0.86rem;
  font-weight: 700;
}

.hooke-mission .mfb:empty {
  display: none;
}

.hooke-mission .mfb.err { color: var(--hk-bad); }
.hooke-mission .mfb.ok { color: var(--hk-ok); }
.hooke-mission .mfb.info { color: var(--hk-teal); }

.shake {
  animation: hookeShake 0.35s;
}

@keyframes hookeShake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.mprog {
  height: 8px;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  margin-top: 10px;
  max-width: 540px;
}

.mprog span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--hk-amber);
  transition: width 0.12s;
}

/* 3-Column Seamless Studio Grid: Left Graph | Center Stage | Right Controls */
.hooke-studio-grid {
  display: grid;
  grid-template-columns: clamp(290px, 24vw, 340px) minmax(0, 1fr) clamp(290px, 24vw, 340px);
  align-items: stretch;
}

/* Left Wing: Graph + Telemetry */
.hooke-wing-left {
  display: flex;
  flex-direction: column;
  background: #fbf9ff;
  border-right: 1px solid var(--hk-line);
  min-width: 0;
}

.hooke-analysis-pane {
  padding: 14px 15px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hooke-graph-pane {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hooke-analysis-pane h2,
.hooke-telemetry h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--hk-ink);
  display: flex;
  align-items: center;
  gap: 7px;
  letter-spacing: -0.015em;
}

.hooke-telemetry h2 {
  font-size: 0.92rem;
}

.hooke-analysis-pane h2 svg,
.hooke-telemetry h2 svg,
.hooke-tray-head h3 svg,
.hooke-theory-section h2 svg,
.theory summary svg {
  color: var(--hk-pri);
  flex: none;
}

.hooke-module .hooke-analysis-pane .hooke-table-pane {
  max-height: 260px;
  overflow-y: auto;
}

.hooke-table-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}

.hooke-table-actions .hooke-btn {
  min-height: 36px;
  padding: 5px 11px;
  font-size: 0.8rem;
}

#graphWrap {
  position: relative;
  width: 100%;
  height: 256px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--hk-soft);
  overflow: hidden;
}

#graph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hooke-telemetry {
  padding: 13px 15px 15px;
  border-top: 1px solid var(--hk-line);
}

.hooke-telemetry h2 {
  margin-bottom: 9px;
}

.hooke-telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--hk-line);
  border-radius: 11px;
  overflow: hidden;
  background: #fff;
}

.hooke-telemetry-grid > div {
  padding: 8px 10px;
  border-right: 1px solid var(--hk-soft);
  border-bottom: 1px solid var(--hk-soft);
  min-width: 0;
}

.hooke-telemetry-grid > div:nth-child(2n) {
  border-right: 0;
}

.hooke-telemetry-grid > div:nth-last-child(-n+2) {
  border-bottom: 0;
}

.hooke-telemetry-grid dt {
  color: var(--hk-mut);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.3;
  margin-bottom: 2px;
}

.hooke-telemetry-grid dd {
  margin: 0;
  color: var(--hk-ink);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.hooke-telemetry-grid dd small {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--hk-mut);
}

/* Center Column: Apparatus Stage + Slotted Mass Dock */
.hooke-center {
  display: flex;
  flex-direction: column;
  background: #fff;
  min-width: 0;
}

.hooke-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hk-soft);
}

.hooke-stage-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--hk-ink);
  letter-spacing: -0.015em;
}

.hooke-chip {
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--hk-inset);
  color: var(--hk-mut);
  border: 1px solid var(--hk-line);
}

.hooke-chip.ok {
  background: var(--hk-okbg);
  color: var(--hk-ok);
  border-color: #a7f3d0;
}

.hooke-chip.bad {
  background: var(--hk-badbg);
  color: var(--hk-bad);
  border-color: #fdba74;
}

#stageWrap {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 480px;
  height: clamp(480px, 60vh, 620px);
  background: var(--hk-inset);
  overflow: hidden;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
}

.hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--floor-h, 74px);
  pointer-events: none;
  z-index: 2;
}

.hooke-badge {
  position: absolute;
  top: calc(50% + 2px);
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(37, 33, 55, 0.14);
  border-radius: 10px;
  padding: 6px 11px;
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1.25;
  color: var(--hk-ink);
  box-shadow: 0 4px 12px -6px rgba(37, 33, 55, 0.28);
  white-space: nowrap;
}

#hudR {
  left: 12px;
}

#hudL {
  left: var(--spring-x, 50%);
  transform: translate(-50%, -50%);
}

.hooke-badge b {
  color: var(--hk-pri);
  font-weight: 800;
}

#toast {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translate(-50%, -10px);
  background: var(--hk-ink);
  color: #fff;
  padding: 9px 15px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.82rem;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
  z-index: 5;
  box-shadow: 0 10px 24px -10px rgba(37, 33, 55, 0.6);
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--floor-h, 74px) + 12px);
  transform: translateX(-50%);
  background: var(--hk-ink);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.3;
  padding: 8px 14px;
  border-radius: 16px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100% - 24px);
  text-align: center;
  animation: hookeBob 1.8s ease-in-out infinite;
  box-shadow: 0 10px 24px -10px rgba(37, 33, 55, 0.55);
}

#hint.hide {
  display: none;
}

@keyframes hookeBob {
  50% { transform: translate(-50%, -4px); }
}

#flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(220, 70, 40, 0.38), transparent 65%);
  opacity: 0;
  pointer-events: none;
}

#flash.go {
  animation: hookeFlash 0.6s ease-out;
}

@keyframes hookeFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Slotted mass dock flush under center stage */
.hooke-tray-card {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--hk-line);
  background: #fff;
}

.hooke-tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.hooke-tray-head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--hk-ink);
  display: flex;
  align-items: center;
  gap: 7px;
  letter-spacing: -0.015em;
}

.tray {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 1px 0 3px;
}

.item {
  min-width: 0;
  position: relative;
  background: var(--hk-inset);
  border: 1.5px solid var(--hk-line);
  border-radius: 10px;
  padding: 5px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  cursor: grab;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.item:hover,
.item:focus-visible {
  transform: translateY(-2px);
  border-color: var(--hk-amber);
  background: var(--hk-peach2);
}

.item canvas {
  width: 44px;
  height: 26px;
  flex: none;
  pointer-events: none;
}

.item b {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--hk-ink);
  line-height: 1.2;
}

.item span {
  font-size: 0.65rem;
  color: var(--hk-mut);
  font-weight: 600;
  line-height: 1.2;
}

.item.dragging {
  opacity: 0.4;
}

.hooke-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.hooke-btn {
  white-space: nowrap;
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  padding: 6px 11px;
  font-weight: 700;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.1s, background 0.2s;
}

.hooke-btn:active {
  transform: scale(0.97);
}

.hooke-btn.go {
  background: var(--hk-ink);
  color: #fff;
}

.hooke-btn.go:hover {
  background: #3a3556;
}

.hooke-btn.sec {
  background: var(--hk-inset);
  color: var(--hk-ink);
  border: 1px solid var(--hk-line);
}

.hooke-btn.sec:hover {
  background: var(--hk-peach2);
  border-color: var(--hk-peach);
}

.hooke-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hooke-jump-graph {
  display: none;
}

.grow {
  flex: 1;
}

.hooke-note {
  font-size: 0.77rem;
  color: var(--hk-mut);
  margin: 7px 0 0;
  line-height: 1.48;
  font-weight: 500;
}

.hooke-note b {
  color: var(--hk-ink);
  font-weight: 700;
}

/* Right Wing: Seamless Control Panel (overrides workbench border/radius) */
.hooke-module .hooke-wing-right {
  border: 0;
  border-radius: 0;
  border-left: 1px solid var(--hk-line);
  padding: 16px 16px 18px;
  background: #fff;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hooke-module .hooke-wing-right .lab-control-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--hk-ink);
}

.hooke-module .lab-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hooke-module .lab-tab-panes > [inert],
.hooke-module .lab-tab-panes > [inert] * {
  visibility: hidden !important;
  transition: none !important;
  pointer-events: none !important;
}

#tab-table {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#tab-record-count {
  min-width: 1.25rem;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--hk-peach);
  color: var(--hk-pri);
  font-size: 0.72rem;
  font-weight: 800;
}

.hooke-module .lab-tabs button[aria-selected="true"] #tab-record-count {
  background: var(--hk-amber);
  color: #2b1a00;
}

.hooke-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--hk-mut);
  margin-top: 2px;
}

.hooke-subhead strong {
  color: var(--hk-ink);
  font-weight: 800;
}

.sp-tabs {
  display: flex;
  gap: 5px;
  background: var(--hk-inset);
  padding: 4px;
  border-radius: 10px;
}

.sp-tabs button {
  flex: 1;
  min-height: 36px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--hk-mut);
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.sp-tabs button.on {
  color: #fff;
  background: var(--c);
  box-shadow: 0 4px 12px -4px var(--c);
}

.sp-tabs button.off {
  opacity: 0.42;
}

.hooke-lbl {
  font-size: 0.78rem;
  color: var(--hk-mut);
  font-weight: 700;
  margin: 8px 0 3px;
}

.mats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.mats button {
  min-height: 48px;
  border: 1.5px solid var(--hk-line);
  background: #fff;
  border-radius: 10px;
  padding: 6px 8px;
  text-align: left;
  font-weight: 700;
  font-size: 0.81rem;
  color: var(--hk-ink);
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
}

.mats button:hover {
  border-color: var(--hk-line2);
}

.mats button i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex: none;
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.25);
}

.mats button small {
  display: block;
  font-size: 0.67rem;
  color: var(--hk-mut);
  font-weight: 500;
}

.mats button.on {
  border-color: var(--hk-amber);
  background: var(--hk-peach2);
}

.mats button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modern pill-gradient sliders inside control panel */
.hooke-slider-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--hk-soft);
}

.hooke-slider-row .slt {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.hooke-slider-row .slt label {
  font-size: 0.84rem;
  font-weight: 750;
  color: var(--hk-ink);
  cursor: pointer;
}

.hooke-slider-row output {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--hk-pri);
  font-variant-numeric: tabular-nums;
}

.hooke-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #fbbf24 0%, #f59e0b 55%, #d97706 100%) left / var(--pct, 40%) 100% no-repeat,
    #dedae9;
  box-shadow: inset 0 2px 4px rgba(37, 33, 55, 0.16), inset 0 -1px 0 rgba(255, 255, 255, 0.72);
  outline: none;
  cursor: pointer;
  margin: 4px 0 3px;
}

.hooke-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid rgba(180, 83, 9, 0.45);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.16), 0 2px 7px rgba(37, 33, 55, 0.28);
  transition: transform 0.15s, box-shadow 0.15s;
}

.hooke-range:hover::-webkit-slider-thumb,
.hooke-range:active::-webkit-slider-thumb {
  transform: scale(1.06);
  border-color: rgba(180, 83, 9, 0.72);
  box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.24), 0 4px 10px rgba(37, 33, 55, 0.3);
}

.hooke-range::-moz-range-track {
  height: 14px;
  border-radius: 999px;
  background: #dedae9;
  box-shadow: inset 0 2px 4px rgba(37, 33, 55, 0.16), inset 0 -1px 0 rgba(255, 255, 255, 0.72);
}

.hooke-range::-moz-range-progress {
  height: 14px;
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 55%, #d97706 100%);
}

.hooke-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid rgba(180, 83, 9, 0.45);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.16), 0 2px 7px rgba(37, 33, 55, 0.28);
}

.hooke-range:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Dark spring-constant meter box */
.kbox {
  margin: 0 0 10px;
  background: var(--hk-ink);
  color: #fff;
  border-radius: 12px;
  padding: 11px 12px;
}

.kbox .kv {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.kbox i {
  font-style: normal;
  font-size: 0.75rem;
  color: #c4bdd9;
  font-weight: 600;
  margin-inline-end: auto;
}

.kbox .kv b {
  font-size: 1.55rem;
  line-height: 1;
  color: #fbbf24;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.kbox u {
  text-decoration: none;
  color: #c4bdd9;
  font-weight: 600;
  font-size: 0.75rem;
}

.kbar {
  height: 6px;
  border-radius: 6px;
  background: #36304f;
  margin: 7px 0 5px;
  overflow: hidden;
}

.kbar span {
  display: block;
  height: 100%;
  width: 30%;
  background: var(--hk-amber);
  border-radius: 6px;
  transition: width 0.25s;
}

.kmini {
  font-size: 0.73rem;
  color: #d5cfe8;
  font-weight: 500;
  line-height: 1.45;
}

.kmini b {
  color: #fff;
}

.prow {
  display: flex;
  gap: 6px;
  margin-top: 7px;
  flex-wrap: wrap;
}

.pre,
.hooke-btn-sm {
  min-height: 40px;
  border: 1px solid var(--hk-line);
  background: var(--hk-inset);
  color: var(--hk-ink);
  border-radius: 9px;
  padding: 5px 9px;
  font-weight: 700;
  font-size: 0.77rem;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.pre:hover,
.hooke-btn-sm:hover {
  background: var(--hk-peach2);
  border-color: var(--hk-peach);
}

.pre:disabled,
.hooke-btn-sm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Topology tab */
.topos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 4px;
}

.topo {
  border: 1.5px solid var(--hk-line);
  background: #fff;
  border-radius: 10px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-weight: 700;
  font-size: 0.71rem;
  color: var(--hk-mut);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  line-height: 1.15;
  text-align: center;
}

.topo:hover {
  border-color: var(--hk-line2);
}

.topo canvas {
  width: 50px;
  height: 44px;
  flex: none;
  pointer-events: none;
}

.topo.on {
  border-color: var(--hk-amber);
  background: var(--hk-peach2);
  color: var(--hk-ink);
}

.topo:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hooke-formula {
  margin-top: 8px;
  background: var(--hk-inset);
  border: 1px solid var(--hk-line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--hk-ink);
  line-height: 1.5;
}

.hooke-formula b {
  color: var(--hk-pri);
  font-size: 0.88rem;
  font-weight: 800;
}

.ps {
  display: grid;
  grid-template-columns: 22px 1fr 1fr 1fr;
  gap: 6px;
  align-items: center;
  background: var(--hk-inset);
  border-radius: 10px;
  padding: 7px 10px;
  margin-top: 6px;
  font-size: 0.77rem;
  font-weight: 700;
}

.ps b {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.74rem;
}

.ps span small {
  display: block;
  color: var(--hk-mut);
  font-size: 0.65rem;
  font-weight: 600;
}

.ps.bad {
  box-shadow: inset 0 0 0 1.5px var(--hk-amber);
}

/* Table tab */
.hooke-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.83rem;
  font-weight: 750;
  color: var(--hk-ink);
}

.hooke-table-head .hooke-btn-sm {
  flex: none;
  min-height: 32px;
  padding: 4px 10px;
}

.hooke-module .lab-live-table table {
  table-layout: auto;
  width: 100%;
}

.hooke-module .lab-live-table :is(td, th) {
  padding: 6px 5px;
  font-size: 0.77rem;
}

.hooke-module tr.new td {
  animation: hookeRowIn 0.8s ease-out;
}

@keyframes hookeRowIn {
  0% { background: var(--hk-peach); }
  100% { background: transparent; }
}

/* Full-width Editorial Theory Section below studio */
.hooke-theory-section {
  background: #fff;
  border: 1px solid var(--hk-line);
  border-radius: 16px;
  padding: 18px 22px;
}

.hooke-theory-section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 1.075rem;
  font-weight: 800;
  color: var(--hk-ink);
  letter-spacing: -0.015em;
}

.hooke-theory-section .theory {
  columns: 2 380px;
  column-gap: 32px;
  column-rule: 1px solid var(--hk-soft);
  font-size: 0.87rem;
  line-height: 1.62;
  color: #3b3652;
  font-weight: 500;
}

.theory details {
  break-inside: avoid;
  border-top: 1px solid var(--hk-soft);
  padding: 9px 0;
}

.theory details:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.theory summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--hk-ink);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.theory summary::-webkit-details-marker {
  display: none;
}

.theory summary::after {
  content: "+";
  margin-inline-start: auto;
  color: var(--hk-pri);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1;
}

.theory details[open] summary::after {
  content: "–";
}

.theory p {
  margin: 6px 0;
  color: #3b3652;
}

.eq {
  background: var(--hk-peach2);
  border: 1px solid var(--hk-peach);
  border-radius: 10px;
  padding: 7px 10px;
  margin: 8px 0;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--hk-pri);
  text-align: center;
}

.theory table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
  font-size: 0.8rem;
}

.theory td,
.theory th {
  text-align: left;
  padding: 5px 4px;
  border-bottom: 1px solid var(--hk-line);
}

.theory th {
  color: var(--hk-mut);
  font-weight: 700;
}

.hooke-model-foot {
  margin: 10px 0 4px;
  color: var(--hk-mut);
  font-size: 0.78rem;
  text-align: center;
  line-height: 1.5;
}

/* Modal sheets */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(37, 33, 55, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}

.sheet.show {
  opacity: 1;
  pointer-events: auto;
}

.sheetBody {
  background: #fbf8ff;
  border-radius: 22px;
  width: min(720px, 100%);
  max-height: 88vh;
  max-height: 88dvh;
  overflow: auto;
  padding: 20px;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.25s;
  box-shadow: 0 30px 80px -20px rgba(37, 33, 55, 0.6);
}

.sheet.show .sheetBody {
  transform: none;
}

.sheetHead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.sheetHead b {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--hk-ink);
}

.sheetHead small {
  display: block;
  color: var(--hk-mut);
  font-weight: 500;
  font-size: 0.82rem;
}

.sheetHead button {
  margin-inline-start: auto;
  border: 0;
  background: var(--hk-inset2);
  color: var(--hk-ink);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 0.95rem;
  font-weight: 800;
}

.rank {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--hk-ink);
  color: #fff;
  border-radius: 16px;
  padding: 11px 15px;
  margin-bottom: 14px;
}

.rank b {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--hk-amber);
}

.rank small {
  color: #c4bdd9;
  font-weight: 600;
  font-size: 0.78rem;
}

.rank .xpbar {
  flex: 1;
  height: 8px;
  border-radius: 6px;
  background: #36304f;
  overflow: hidden;
  min-width: 60px;
}

.rank .xpbar span {
  display: block;
  height: 100%;
  background: var(--hk-amber);
}

.mgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mcard {
  border: 1.5px solid var(--hk-line);
  background: #fff;
  border-radius: 16px;
  padding: 11px 13px;
  text-align: left;
  display: flex;
  gap: 11px;
  align-items: center;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}

.mcard:hover {
  border-color: var(--hk-amber);
  background: var(--hk-peach2);
  transform: translateY(-2px);
}

.mcard em {
  font-style: normal;
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--hk-inset);
  display: grid;
  place-items: center;
  flex: none;
}

.mcard b {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--hk-ink);
}

.mcard small {
  color: var(--hk-mut);
  font-weight: 500;
  font-size: 0.76rem;
}

.win {
  text-align: center;
}

.win h2 {
  font-size: 1.8rem;
  margin: 4px 0;
  font-weight: 800;
  color: var(--hk-ink);
}

.win .big {
  font-size: 2.2rem;
  letter-spacing: 6px;
  color: var(--hk-amber);
}

.win .big i {
  font-style: normal;
  opacity: 0.25;
}

.win .big i.on {
  opacity: 1;
}

.win .expl {
  background: var(--hk-inset);
  border-radius: 14px;
  padding: 12px 15px;
  text-align: left;
  font-weight: 500;
  line-height: 1.65;
  margin: 12px 0;
  font-size: 0.88rem;
  color: var(--hk-ink);
}

.win .xp {
  color: var(--hk-ok);
  font-weight: 800;
}

#ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: auto;
  height: auto;
  pointer-events: none;
  z-index: 70;
  transform: translate(-999px, -999px);
  filter: drop-shadow(0 10px 14px rgba(37, 33, 55, 0.35));
}

@media (prefers-reduced-motion: reduce) {
  #hint { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* Tablet / Compact Laptop: Stage + Controls on top, Graph + Telemetry below */
@media (max-width: 1140px) {
  .hooke-studio-grid {
    grid-template-columns: minmax(0, 1fr) clamp(290px, 34vw, 345px);
  }
  .hooke-center {
    order: 1;
  }
  .hooke-module .hooke-wing-right {
    order: 2;
  }
  .hooke-wing-left {
    order: 3;
    grid-column: 1 / -1;
    border-right: 0;
    border-top: 1px solid var(--hk-line);
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    align-items: stretch;
  }
  .hooke-telemetry {
    border-top: 0;
    border-left: 1px solid var(--hk-line);
    margin-top: 0;
  }
  .hooke-jump-graph {
    display: inline-flex;
  }
}

/* Mobile & narrow tablet: Single vertical studio stack */
@media (max-width: 860px) {
  .hooke-module #lab.lab-wrap {
    width: calc(100% - 20px);
  }
  .hooke-studio-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .hooke-center {
    order: 1;
  }
  .hooke-module .hooke-wing-right {
    order: 2;
    border-left: 0;
    border-top: 1px solid var(--hk-line);
  }
  .hooke-wing-left {
    order: 3;
    display: flex;
    flex-direction: column;
  }
  .hooke-telemetry {
    border-left: 0;
    border-top: 1px solid var(--hk-line);
  }
  .hooke-theory-section {
    padding: 16px;
  }
  .hooke-btn {
    min-height: 42px;
    padding: 8px 13px;
    font-size: 0.84rem;
  }
  .hooke-theory-section .theory {
    columns: 1;
  }
}

@media (max-width: 640px) {
  .mgrid {
    grid-template-columns: 1fr;
  }
  .sheet {
    align-items: flex-end;
    padding: 0;
  }
  .sheetBody {
    border-radius: 22px 22px 0 0;
    padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
  }
  #stageWrap {
    min-height: 400px;
    height: clamp(400px, 56svh, 490px);
  }
  #graphWrap {
    height: 245px;
  }
}

@media (max-width: 560px) {
  .tray {
    gap: 5px;
  }
  .item {
    padding: 6px 2px;
    border-radius: 10px;
  }
  .item canvas {
    width: 42px;
    height: 28px;
  }
  .item b {
    font-size: 0.72rem;
  }
  .item span {
    font-size: 0.64rem;
  }
}

@media (max-width: 480px) {
  .hooke-studio {
    border-radius: 14px;
  }
  .hooke-badge {
    font-size: 0.7rem;
    padding: 4px 7px;
  }
  #hudR {
    left: 8px;
  }
  #hint {
    font-size: 0.76rem;
    padding: 7px 12px;
  }
  .hooke-mission .mans input[type="text"] {
    flex: 1 1 100%;
  }
  .hooke-mission .mans .u {
    margin-inline-end: auto;
  }
  .hooke-stage-head,
  .hooke-tray-card,
  .hooke-graph-pane,
  .hooke-telemetry,
  .hooke-module .hooke-wing-right {
    padding-inline: 13px;
  }
}
