* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0f1117;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  color: #e0e0e0;
  overflow: hidden;
  overscroll-behavior: none;
}

/* ========== ORACLE (bubble + FAB) ========== */
.oracle-container {
  position: fixed;
  bottom: 36px;
  right: 48px;
  z-index: 9998;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.oracle-container.ready { display: flex; }
.oracle-container > * { pointer-events: auto; }

/* Bubbles area */
.oracle-bubbles {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: 320px;
  width: max-content;
}

.oracle-bubble {
  max-width: 320px;
  padding: 8px 14px;
  font-size: 13px;
  line-height: 1.55;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  animation: oracleBubbleIn 0.3s ease-out;
  transition: opacity 0.6s ease;
}
.oracle-bubble.fade-out { opacity: 0; }

.oracle-bubble--user {
  background: rgba(74, 144, 217, 0.18);
  color: #c8daf8;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.oracle-bubble--ai {
  background: rgba(255, 255, 255, 0.07);
  color: #ccc;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

@keyframes oracleBubbleIn {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* FAB */
.oracle-fab {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: rgba(26, 29, 39, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #9aa3b8;
  line-height: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.oracle-wave-icon {
  display: block;
  overflow: visible;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 10px rgba(0, 0, 0, 0.25));
}
.oracle-fab:hover .oracle-wave-icon,
.oracle-fab:focus-visible .oracle-wave-icon,
.oracle-fab.active .oracle-wave-icon {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 12px rgba(74, 144, 217, 0.15));
}
.oracle-wave-icon rect {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: transform 0.08s ease-out;
}

.oracle-fab:hover {
  background: rgba(26, 29, 39, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
  color: #e8eaef;
}
.oracle-fab.active {
  background: rgba(26, 29, 39, 0.5);
  border-color: rgba(255, 255, 255, 0.06);
  color: #9aa3b8;
}
.oracle-fab.active:hover {
  background: rgba(26, 29, 39, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
  color: #e8eaef;
}
.oracle-fab:focus-visible {
  outline: none;
  border-color: #4A90D9;
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.35);
}

/* モバイル配置 */
@media (max-width: 768px) {
  .oracle-container {
    bottom: 24px;
    right: 24px;
    left: 24px;
    align-items: center;
  }
  .oracle-bubbles {
    max-width: 100%;
    align-items: center;
  }
  .oracle-bubble {
    max-width: 100%;
    font-size: 15px;
  }
  .oracle-fab {
    width: 72px;
    height: 72px;
  }
}
