.light-field-main {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: #080810;
}

.light-field-page,
.light-field-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.light-field-stage {
  isolation: isolate;
  background: #080810;
}

.light-field-canvas {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.light-field-hint {
  position: absolute;
  z-index: 8;
  top: max(28px, env(safe-area-inset-top));
  left: 50%;
  margin: 0;
  color: rgba(220, 228, 232, 0.42);
  font-size: 11px;
  letter-spacing: 0.12em;
  white-space: nowrap;
  opacity: 1;
  transform: translateX(-50%);
  transition: opacity 1s ease;
  pointer-events: none;
}

.light-field-hint.is-fading {
  opacity: 0;
}

.light-center-glow {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(242, 237, 225, 0.18);
  filter: blur(34px);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.75);
  pointer-events: none;
}

.light-field-stage.is-pulsing .light-center-glow {
  animation: light-center-pulse 1.15s ease-out;
}

.light-bubble {
  position: absolute;
  z-index: 2;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(236, 240, 243, 0.9);
  cursor: pointer;
  transform: translate(-50%, -50%);
  translate: var(--move-x, 0px) var(--move-y, 0px);
  transition: width 0.4s ease, height 0.4s ease, left 0.5s ease, top 0.5s ease, opacity 0.55s ease, filter 0.55s ease, transform 0.55s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.light-bubble.is-dragging {
  z-index: 6;
  cursor: grabbing;
  transition: none;
}

.light-bubble.is-dragging .light-bubble-text {
  opacity: 1;
}

.light-bubble:focus-visible {
  outline: 1px solid rgba(180, 211, 215, 0.8);
  outline-offset: 5px;
}

.light-field-stage.has-selection .light-bubble:not(.is-selected) {
  opacity: 0.28;
  filter: saturate(0.65);
  transform: translate(-50%, -50%) scale(0.9);
}

.light-field-stage.has-selection .light-bubble.is-selected {
  z-index: 3;
}

.soap-links {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.soap-links line {
  stroke: #dce1e5;
  stroke-linecap: round;
  stroke-dasharray: 1.5 6;
  vector-effect: non-scaling-stroke;
}

.light-bubble-orb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  filter: brightness(1);
  transition: filter 0.85s ease, opacity 0.3s ease;
}

.light-bubble:not(.is-current) {
  opacity: 0.88;
}

.light-bubble:not(.is-current).is-near,
.light-bubble:not(.is-current).is-selected,
.light-bubble:not(.is-current):focus-visible {
  opacity: 1;
}

.light-star {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: 72%;
  height: 72%;
  opacity: var(--star-alpha, 0.72);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.light-bubble.is-current .light-star {
  width: 58%;
  height: 58%;
}

.light-star-halo {
  position: absolute;
  inset: -65%;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(250, 249, 244, calc(var(--star-alpha, 0.72) * 0.42)) 0,
    rgba(var(--bubble-rgb), calc(var(--star-alpha, 0.72) * 0.2)) 16%,
    rgba(215, 222, 228, calc(var(--star-alpha, 0.72) * 0.08)) 36%,
    transparent 70%);
  filter: blur(1.4px);
}

.light-bubble.is-current .light-star-halo {
  inset: -90%;
  filter: blur(2px);
}

.light-star-rays {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: rgba(240, 242, 243, var(--star-alpha, 0.72));
  stroke-width: 0.65;
  stroke-linecap: round;
  filter: drop-shadow(0 0 1.5px rgba(241, 242, 240, 0.6));
}

.light-star-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(4px * var(--star-core-scale, 1));
  height: calc(4px * var(--star-core-scale, 1));
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0 24%, rgba(249, 248, 242, 0.96) 42%, rgba(232, 237, 240, 0.5) 70%, transparent 100%);
  box-shadow: 0 0 3px rgba(255, 255, 250, 0.95), 0 0 10px rgba(223, 230, 235, 0.65);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.light-bubble.is-current .light-star-core {
  width: calc(6px * var(--star-core-scale, 1));
  height: calc(6px * var(--star-core-scale, 1));
  box-shadow: 0 0 4px rgba(255, 255, 250, 0.98), 0 0 16px rgba(229, 232, 235, 0.72);
}

.thought-detail {
  position: absolute;
  z-index: 14;
  width: 258px;
  padding: 13px 15px;
  border: 1px solid rgba(180, 202, 231, 0.18);
  border-radius: 14px;
  background: rgba(17, 20, 36, 0.86);
  color: rgba(225, 233, 242, 0.78);
  font-size: 12px;
  line-height: 1.6;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.thought-detail p { margin: 0 0 6px; }
.thought-detail p:last-child { margin-bottom: 0; }
.thought-detail-keyword { color: rgba(246, 249, 255, 0.96); font-size: 16px; }
.thought-detail-hint { color: rgba(185, 201, 218, 0.62); font-size: 11px; }
.thought-detail-note { color: rgba(218, 199, 230, 0.78); }

.thought-editor {
  position: absolute;
  z-index: 20;
  left: 50%;
  top: 50%;
  width: min(360px, calc(100vw - 40px));
  padding: 20px;
  border: 1px solid rgba(183, 202, 231, 0.2);
  border-radius: 18px;
  background: rgba(19, 23, 39, 0.94);
  color: rgba(232, 239, 247, 0.9);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(16px);
}

.thought-editor label { display: block; margin-bottom: 12px; font-size: 13px; }
.thought-editor input,
.thought-editor textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  border: 1px solid rgba(183, 202, 231, 0.24);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font: inherit;
}

.thought-editor-actions { display: flex; gap: 10px; justify-content: flex-end; }

.light-bubble-text {
  position: absolute;
  z-index: 5;
  left: calc(50% + 20px);
  top: 50%;
  width: max-content;
  max-width: 190px;
  color: rgba(242, 243, 244, 0.94);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.025em;
  overflow: hidden;
  overflow-wrap: anywhere;
  opacity: 0.94;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.96), 0 0 12px rgba(0, 0, 0, 0.88);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  transform: translateY(-50%);
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.light-bubble.is-current .light-bubble-text {
  left: 50%;
  top: calc(50% + 30px);
  max-width: 240px;
  color: rgba(248, 246, 240, 0.98);
  font-size: 16px;
  opacity: 0.98;
  transform: translateX(-50%);
}

.light-bubble.is-near .light-bubble-text,
.light-bubble.is-selected .light-bubble-text,
.light-bubble.is-glowing .light-bubble-text {
  opacity: 1;
}

.light-bubble-crack {
  position: absolute;
  z-index: 2;
  inset: 10%;
  width: 80%;
  height: 80%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 140;
  stroke-dashoffset: var(--crack-offset, 140px);
  opacity: var(--crack-opacity, 0);
  pointer-events: none;
}

.light-bubble.is-pressing .light-bubble-crack {
  opacity: var(--crack-opacity, 0.82);
}

.light-bubble.is-newborn {
  opacity: var(--birth-opacity, 1);
  scale: var(--birth-scale, 1);
  rotate: var(--birth-rotation, 0deg);
}

.light-bubble::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid rgba(225, 229, 232, 0);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.light-bubble.is-selected:not(.is-glowing) .light-bubble-orb,
.light-bubble.is-near .light-bubble-orb {
  filter: brightness(1.12);
}

.light-bubble.is-pressing .light-bubble-orb {
  animation: none;
  transform: scale(0.9);
  filter: brightness(0.86);
  transition: transform 0.65s ease, filter 0.65s ease;
}

.light-bubble.is-glowing .light-bubble-orb {
  filter: brightness(1.28);
}

.light-bubble.is-glowing::after {
  animation: light-bubble-ring 1.15s ease-out;
}

.light-bubble.is-bursting {
  pointer-events: none;
}

.light-bubble.is-bursting .light-bubble-orb {
  animation: light-bubble-burst 0.38s ease-in forwards;
}

.light-bubble.is-arriving {
  animation: light-bubble-arrive 0.45s ease-out;
}

.light-particles {
  position: absolute;
  z-index: 4;
  left: var(--x);
  top: var(--y);
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.light-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(var(--particle-rgb), 0.82);
  box-shadow: 0 0 8px rgba(var(--particle-rgb), 0.5);
  animation: light-particle-fade 0.58s ease-out forwards;
}

.corpus-box-button {
  position: absolute;
  z-index: 9;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(192, 211, 216, 0.18);
  border-radius: 50%;
  background: transparent;
  color: rgba(213, 224, 228, 0.48);
  font-family: var(--font-body);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.corpus-box-button:hover,
.corpus-box-button:focus-visible,
.corpus-box-button[aria-expanded="true"] {
  border-color: rgba(190, 214, 218, 0.5);
  background: rgba(196, 215, 221, 0.05);
  color: rgba(235, 239, 241, 0.92);
}

.corpus-box-button:focus-visible {
  outline: 1px solid rgba(190, 214, 218, 0.72);
  outline-offset: 4px;
}

.corpus-panel {
  position: absolute;
  z-index: 12;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(74px, calc(env(safe-area-inset-bottom) + 52px));
  width: min(310px, calc(100vw - 44px));
  max-height: 46vh;
  padding: 16px;
  overflow-y: auto;
  border: 1px solid rgba(180, 202, 221, 0.18);
  border-radius: 14px;
  background: rgba(12, 14, 24, 0.96);
  color: rgba(225, 232, 237, 0.84);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

.corpus-panel[hidden] { display: none; }
.corpus-panel-title { margin: 0 0 10px; font-size: 13px; color: rgba(195, 210, 219, 0.7); }
.corpus-panel-list { display: grid; gap: 8px; }
.corpus-empty { margin: 0; font-size: 13px; color: rgba(195, 210, 219, 0.62); }

.corpus-restore {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid rgba(180, 202, 221, 0.16);
  border-radius: 9px;
  background: rgba(197, 214, 224, 0.035);
  color: rgba(225, 232, 237, 0.84);
  font-family: var(--font-body);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.corpus-restore span:last-child { flex: none; color: rgba(195, 210, 219, 0.64); font-size: 12px; }
.corpus-restore:hover, .corpus-restore:focus-visible { border-color: rgba(190, 214, 218, 0.48); }
.corpus-panel-close { margin-top: 12px; padding: 6px 0; border: 0; background: none; color: rgba(195, 210, 219, 0.68); font-family: var(--font-body); font-size: 12px; cursor: pointer; }
.corpus-panel-close:hover, .corpus-panel-close:focus-visible { color: rgba(235, 239, 241, 0.94); }

.light-field-exit {
  position: absolute;
  z-index: 9;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0 0 2px;
  border: 1px solid rgba(192, 211, 216, 0.16);
  border-radius: 50%;
  background: transparent;
  color: rgba(213, 224, 228, 0.52);
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.35s ease, color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.light-field-exit:hover,
.light-field-exit.is-near,
.light-field-exit:focus {
  border-color: rgba(190, 214, 218, 0.5);
  background: rgba(196, 215, 221, 0.05);
  color: rgba(235, 239, 241, 0.94);
  opacity: 0.9;
}

.light-field-exit:focus-visible {
  outline: 1px solid rgba(190, 214, 218, 0.8);
  outline-offset: 4px;
}

@keyframes light-crack-grow {
  0% { opacity: 0; stroke-dashoffset: 140; }
  22% { opacity: 0.35; }
  100% { opacity: 0.82; stroke-dashoffset: 0; }
}

@keyframes light-bubble-drift {
  from { transform: translate3d(calc(var(--dx) * -0.5px), calc(var(--dy) * -0.5px), 0); }
  to { transform: translate3d(calc(var(--dx) * 0.5px), calc(var(--dy) * 0.5px), 0); }
}

@keyframes light-center-pulse {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.72); }
  35% { opacity: 0.62; transform: translate(-50%, -50%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.32); }
}

@keyframes light-bubble-ring {
  0% { opacity: 0.72; transform: scale(0.9); border-color: rgba(181, 246, 232, 0.72); }
  100% { opacity: 0; transform: scale(1.45); border-color: rgba(181, 246, 232, 0); }
}

@keyframes light-bubble-burst {
  0% { opacity: 0.9; transform: scale(0.86); filter: brightness(0.82); }
  45% { opacity: 0.48; transform: scale(0.68); filter: brightness(1.08); }
  100% { opacity: 0; transform: scale(0.38); filter: brightness(0.9); }
}

@keyframes light-bubble-arrive {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.76); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes light-particle-fade {
  from { opacity: 0.95; transform: translate(0, 0) scale(1); }
  to { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.2); }
}

@media (max-width: 640px) {
  .light-field-hint { top: max(16px, env(safe-area-inset-top)); font-size: 12px; }
  .light-bubble::before {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
  }
  .light-bubble-text {
    left: 50%;
    top: calc(50% + 18px);
    max-width: 112px;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    transform: translateX(-50%);
    -webkit-line-clamp: 2;
  }
  .light-bubble.is-right-edge .light-bubble-text {
    right: calc(50% + 8px);
    left: auto;
    text-align: right;
    transform: none;
  }
  .light-bubble.is-left-edge .light-bubble-text {
    left: calc(50% + 8px);
    text-align: left;
    transform: none;
  }
  .light-bubble.is-current .light-bubble-text { top: calc(50% + 32px); max-width: 150px; font-size: 14px; }
  .light-field-exit { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .light-field-hint,
  .light-bubble,
  .light-bubble::after,
  .light-bubble-orb,
  .light-center-glow,
  .light-particle {
    animation: none !important;
    transition: none !important;
  }
  .light-bubble { translate: none !important; }
  .light-bubble.is-pressing .light-bubble-crack { opacity: 0.75; stroke-dashoffset: 0; }
  .light-bubble.is-glowing .light-bubble-orb { filter: brightness(1.16); }
}
