:root {
  --bg: #0b0b0d;
  --panel: rgba(18, 18, 21, 0.88);
  --text: #e6e0d6;
  --muted: #8f887e;
  --line: rgba(230, 224, 214, 0.12);
  --accent: #b89a61;
  --success: #d2b97f;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, #1b1b1f 0%, #0b0b0d 58%, #060607 100%);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
}
.page-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; }
.puzzle-panel {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}
.scene-area, .content-wrap { min-width: 0; }
.image-wrap { margin: 0; }
.tree-scene { position: relative; }
.puzzle-image { display: block; width: 100%; height: auto; border: 1px solid var(--line); }
.image-button { display: block; width: 100%; padding: 0; border: 0; background: var(--bg); cursor: pointer; }
.image-button:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
.hotspot { position: absolute; left: 54.3%; top: 61.9%; width: 3.2%; height: 3.9%; padding: 0; border: 0; background: transparent; cursor: pointer; outline: none; }
.phase-label { margin: 0 0 12px; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.22em; }
.meta-marker { margin-left: 8px; font-size: 0.65rem; letter-spacing: 0.08em; opacity: 0.65; }
.opening { color: var(--muted); line-height: 1.6; margin: 24px 0; }
.riddle { margin: 24px 0 26px; font-size: clamp(1.9rem, 3vw, 2.8rem); line-height: 1.15; font-weight: 400; }
.answer-form { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.answer-input { flex: 1 1 220px; min-width: 0; padding: 14px 16px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--text); font: inherit; outline: none; }
.answer-input::placeholder { color: #716b63; }
.answer-input:focus { border-color: rgba(184,154,97,0.6); box-shadow: 0 0 0 1px rgba(184,154,97,0.18); }
.submit-button { padding: 14px 20px; border: 1px solid rgba(184,154,97,0.38); background: rgba(184,154,97,0.08); color: var(--text); font: inherit; cursor: pointer; }
.submit-button:hover { background: rgba(184,154,97,0.14); border-color: var(--accent); }
.submit-button:disabled { opacity: 0.45; cursor: default; }
.response-message { min-height: 1.5em; margin: 0 0 18px; color: #9f8060; font-size: 0.96rem; }
.success-panel { padding: 16px 18px; border-left: 2px solid rgba(210,185,127,0.5); background: rgba(210,185,127,0.05); color: var(--success); }
.success-panel p { margin: 0 0 10px; }
.proceed-control { display: block; width: fit-content; margin: 16px 0 0 auto; padding: 7px 0; color: var(--success); font-size: 0.78rem; letter-spacing: 0.16em; text-decoration: none; border-bottom: 1px solid transparent; }
.proceed-control:hover, .proceed-control:focus-visible { border-bottom-color: transparent; }
.page-shell:has(.space-mode) { padding: 16px; }
.space-mode { width: min(1240px, 100%); grid-template-columns: 1fr; padding: 16px; gap: 12px; }
.space-mode .content-wrap { grid-row: 1; }
.space-mode .phase-label { margin: 0; }
.space-mode .response-message { margin: 0; min-height: 0; }
#space-scene { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: center; gap: 20px; }
.solar-scroll { min-width: 0; }
.solar-system { position: relative; width: min(100%, calc(100dvh - 100px)); margin-inline: auto; aspect-ratio: 1; background: radial-gradient(circle, #191b23, #090b10 65%); user-select: none; -webkit-user-select: none; }
.space-notes { min-width: 0; }
.space-clue { margin: 0 0 14px; font-size: 1.25rem; line-height: 1.3; color: var(--text); }
.space-instruction { margin: 0 0 16px; font-size: 0.85rem; line-height: 1.4; color: var(--muted); }
.coupling-panel { padding: 12px; border: 1px solid var(--line); background: rgba(184,154,97,0.03); }
.coupling-panel h2 { margin: 0 0 10px; color: var(--accent); font-size: 0.72rem; font-weight: 400; letter-spacing: 0.16em; }
.coupling-panel table { width: 100%; border-collapse: collapse; font-size: 0.72rem; line-height: 1.35; }
.coupling-panel caption { padding-bottom: 10px; text-align: left; color: var(--muted); }
.coupling-panel th, .coupling-panel td { padding: 4px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: top; font-weight: 400; }
.coupling-panel th { padding-right: 10px; }
.coupling-panel thead { color: var(--muted); }
.coupling-panel tbody th { white-space: nowrap; }
.orbit { position: absolute; border: 1px solid rgba(230,224,214,0.12); border-radius: 50%; transform: translate(-50%, -50%); left: 50%; top: 50%; pointer-events: none; }
.guide { position: absolute; left: 6%; top: 50%; width: 88%; height: 1px; background: rgba(230,224,214,0.055); pointer-events: none; }
.position-dot { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #696972; opacity: 0.48; transform: translate(-50%, -50%); pointer-events: none; }
.sun { position: absolute; left: 50%; top: 50%; width: 4.5%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%); background: radial-gradient(circle at 35% 30%, #ffedaf, #c48734 65%, #714215); box-shadow: 0 0 28px #c4873444; }
.planet { position: absolute; width: 28px; height: 28px; padding: 0; border: 0; color: var(--text); background: transparent; transform: translate(-50%, -50%); cursor: grab; touch-action: none; z-index: 2; }
.planet:focus-visible { outline: 1px solid var(--accent); border-radius: 50%; outline-offset: 2px; }
.planet.dragging { cursor: grabbing; z-index: 3; }
.planet-body { display: block; margin: auto; width: var(--size); height: var(--size); border-radius: 50%; background: radial-gradient(circle at 30% 25%, #ffffff88, transparent 50%), var(--color); box-shadow: inset -4px -3px 5px #0009; pointer-events: none; }
.planet-name { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); font-size: clamp(0.65rem, 1.1vw, 0.8rem); white-space: nowrap; pointer-events: none; text-shadow: 0 1px 3px #000; }
.planet.saturn .planet-body::after { content: ""; display: block; position: absolute; width: 32px; height: 10px; border: 2px solid #ad9a75; border-radius: 50%; top: 9px; left: -2px; transform: rotate(-25deg); }
.planet.colliding { transition: left 700ms ease-in, top 700ms ease-in; }
.impact { position: absolute; width: 90px; height: 90px; border-radius: 50%; opacity: 0; transform: translate(-50%, -50%); background: radial-gradient(circle, #fff6dc, #e9bc7177 30%, transparent 70%); pointer-events: none; z-index: 4; }
.impact.active { animation: impact 600ms ease-out; }
@keyframes impact { 0% { opacity: 0; scale: 0.2; } 25% { opacity: 1; } 100% { opacity: 0; scale: 2; } }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 820px) {
  .puzzle-panel { grid-template-columns: 1fr; padding: 16px; gap: 20px; }
  .page-shell { padding: 18px 10px; }
}
@media (max-width: 900px) {
  #space-scene { grid-template-columns: 1fr; }
  .solar-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
  .solar-system { width: 100%; min-width: 620px; }
  .space-notes { max-width: 620px; width: 100%; margin-inline: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .planet.colliding { transition-duration: 100ms; }
  .impact.active { animation: none; }
}

.proceed-control:focus:not(:focus-visible) { outline: none; }
