/* 只在開機模組存在時留出卡帶空間，完成後恢復機殼原本排版。 */
body:has(#boot-stage .okrboot-rig) #shell { margin-top: 270px; }
/* 後備模式以牆紙、踢腳板、木桌與地板分層，保留機殼的可操作性。 */
body:has(#boot-stage .okrboot-rig) {
  background:
    linear-gradient(180deg, transparent 0 43%, #c9a77c 43% 44%, transparent 44%),
    repeating-linear-gradient(175deg, transparent 0 12px, #895c3626 13px 14px),
    linear-gradient(180deg, #f2e6cc 0 44%, #d3a069 44% 91%, #9b6d47 91% 93%, #b9a58a 93%);
  background-attachment: fixed;
}

#boot-stage .okrboot-rig {
  position: absolute;
  height: 190px;
  font-family: "Fusion Pixel 12px Proportional Traditional Chinese", monospace;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

#boot-stage .okrboot-well { position: relative; height: 150px; overflow: hidden; }

#boot-stage .okrboot-slot {
  position: absolute;
  z-index: 1;
  top: 122px;
  width: 100%;
  height: 28px;
  border: 3px solid #211b49;
  border-radius: 8px 8px 5px 5px;
  background: #101020;
  box-shadow: inset 0 5px 0 #070711, 0 3px 0 #8c7ce0;
}

#boot-stage .okrboot-slot::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 12px;
  left: -3px;
  right: -3px;
  height: 13px;
  border-radius: 0 0 5px 5px;
  background: #352a80;
  border-top: 3px solid #8c7ce0;
}

#boot-stage .okrboot-slot span {
  position: absolute;
  right: 7px;
  top: 0;
  font-size: 10px;
  line-height: 12px;
  letter-spacing: 1px;
  color: #a99bd8;
}

#boot-stage .okrboot-cartridge {
  position: absolute;
  z-index: 2;
  top: 0;
  left: calc(50% - 75px);
  width: 150px;
  height: 110px;
  border: 3px solid #4a3020;
  border-radius: 10px 10px 5px 5px;
  background: linear-gradient(90deg, #b88838 0 7%, #f8d890 7% 93%, #c89060 93%);
  clip-path: polygon(7% 0, 93% 0, 93% 9%, 100% 9%, 100% 100%, 0 100%, 0 9%, 7% 9%);
  box-shadow: inset 0 4px 0 #fff0c0, inset 0 -6px 0 #b88838;
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
  will-change: transform;
}

#boot-stage .okrboot-cartridge:active { cursor: grabbing; }
#boot-stage .okrboot-cartridge.rebound { transition: transform 280ms cubic-bezier(.2, .8, .25, 1.18); }
#boot-stage .okrboot-cartridge.inserted { opacity: 0; transition: opacity 100ms linear; pointer-events: none; }

#boot-stage .okrboot-ridges {
  position: absolute;
  inset: 11px 5px 13px;
  background: repeating-linear-gradient(180deg, transparent 0 7px, #b88838 7px 10px);
}

#boot-stage .okrboot-label {
  position: absolute;
  inset: 8px 19px 14px;
  border: 2px solid #4a3020;
  border-radius: 4px;
  background: linear-gradient(155deg, #2850b8 0 62%, #4878d0 62% 78%, #183078 78%);
  color: #fff;
  text-align: center;
  box-shadow: inset 0 2px 0 #88b0e8;
}

#boot-stage .okrboot-label small { display: block; padding-top: 3px; font-size: 9px; line-height: 11px; }
#boot-stage .okrboot-label strong {
  display: block;
  font-size: 20px;
  line-height: 19px;
  letter-spacing: 2px;
  color: #f8d848;
  text-shadow: 2px 0 #183078, -2px 0 #183078, 0 2px #183078;
}
#boot-stage .okrboot-label span { display: block; font-size: 10px; line-height: 12px; }
#boot-stage .okrboot-label i { display: block; font-style: normal; color: #f8d848; font-size: 9px; line-height: 10px; }
#boot-stage .okrboot-cartridge b { position: absolute; bottom: -2px; width: 100%; text-align: center; color: #825428; font-size: 12px; }

#boot-stage .okrboot-rig .okrboot-top { position: fixed; }
#boot-stage .okrboot-rig:not([data-phase="cartridge"]):not([data-phase="inserting"]) { visibility: hidden; }
#boot-stage.done { display: none; }

@keyframes okrboot-nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  #boot-stage .okrboot-auto { animation: none !important; }
  #boot-stage .okrboot-cartridge.rebound { transition-duration: 80ms; }
}

/* 載入期間也顯示暖色牆面與木桌，避免背景跳回深灰。 */
#boot-stage .okrboot-three {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    repeating-linear-gradient(175deg, transparent 0 18px, #8d613426 19px 20px),
    linear-gradient(180deg, #f2e6cc 0 59%, #c9a77c 59% 61%, #dab17e 61% 92%, #b19572 92%);
  color: #eee;
  font-family: "Fusion Pixel 12px Proportional Traditional Chinese", monospace;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
}
#boot-stage .okrboot-loading { display: grid; place-items: center; font-size: 16px; }
#boot-stage .okrboot-three-canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}
#boot-stage .okrboot-three.dragging .okrboot-three-canvas { cursor: grabbing; }
#boot-stage .okrboot-wait {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: #6b4a33;
}
/* 頂部：大標題＋唯一的「放入卡帶」按鈕，置中、不擋住下方的卡帶與桌面。 */
#boot-stage .okrboot-top {
  position: absolute;
  z-index: 5;
  top: calc(27% + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  box-sizing: border-box;
  pointer-events: none;
  text-align: center;
}
#boot-stage .okrboot-title {
  margin: 0;
  max-width: 100%;
  font: inherit;
  font-size: clamp(30px, 8.4vw, 56px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 1px;
  color: #fff3c4;
  -webkit-text-stroke: 7px #4a3020;
  paint-order: stroke fill;
  text-shadow: 0 5px 0 #4a3020, 0 8px 0 #30251f55;
}
#boot-stage .okrboot-auto {
  position: static;
  box-sizing: border-box;
  max-width: calc(100vw - 24px);
  min-height: 56px;
  padding: 10px 34px;
  border: 3px solid #4a3020;
  border-radius: 999px;
  background: #ff7ab8;
  color: #3a0f26;
  box-shadow: 3px 3px 0 #3a0f26, 0 0 18px #ff7ab888;
  font: inherit;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 3px;
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  animation: okrboot-nudge 1.8s ease-in-out infinite;
}
#boot-stage .okrboot-auto:hover { background: #ff9cca; }
#boot-stage .okrboot-auto:focus-visible { outline: 2px solid #f8d848; outline-offset: 4px; }
#boot-stage .okrboot-auto:disabled { opacity: 0; pointer-events: none; }

/* DOM 後備流程沿用第一輪結構，配色跟隨灰色機殼。 */
#boot-stage .okrboot-slot { border-color: #555154; box-shadow: inset 0 5px 0 #08080b, 0 3px 0 #c4bebb; }
#boot-stage .okrboot-slot::after { background: #8f8b89; border-color: #dcd8d5; }
#boot-stage .okrboot-slot span { color: #ccc; }
#boot-stage .okrboot-cartridge {
  border-color: #706b6a;
  background: linear-gradient(90deg, #8f8b89 0 7%, #c4bebb 7% 93%, #8f8b89 93%);
  box-shadow: inset 0 4px 0 #dcd8d5, inset 0 -6px 0 #8f8b89;
}
#boot-stage .okrboot-ridges { background: repeating-linear-gradient(180deg, transparent 0 7px, #8f8b89 7px 10px); }
#boot-stage .okrboot-cartridge b { color: #555154; }
