* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #111; color: #c4a882;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  height: 100vh; overflow: hidden;
}

/* ── Canvas (3D space) ── */
.canvas {
  position: absolute; inset: 0; overflow: hidden;
  perspective: 1400px;
  perspective-origin: 50% 50%;
  background: radial-gradient(ellipse at 40% 40%, #1e1812 0%, #111 60%, #0a0a08 100%);
}

.canvas-space {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(.23,1,.32,1);
  pointer-events: none;
}
.v-block { pointer-events: auto; }

.greeting {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px; font-weight: 200; color: rgba(196,168,130,0.12);
  letter-spacing: 8px; text-transform: lowercase;
  transition: opacity 0.8s;
}
.greeting.hidden { opacity: 0; pointer-events: none; }

/* ── Thinking indicator ── */
.thinking {
  position: fixed; top: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px; align-items: center;
  opacity: 0; transition: opacity 0.4s;
  z-index: 80;
}
.thinking.visible { opacity: 1; }
.thinking-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(196,168,130,0.5);
  animation: pulse-dot 1.4s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse-dot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* ── Visual blocks ── */
.v-block {
  position: absolute;
  background: rgba(255,252,248,0.88); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 12px;
  min-width: 180px; max-width: 460px;
  transform-style: preserve-3d;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.3);
  overflow: hidden;
  user-select: none; -webkit-user-select: none;
  pointer-events: auto;
  transition: transform 0.5s, opacity 0.5s, filter 0.5s, box-shadow 0.5s, border-color 0.5s;
}
.v-block, .v-block * {
  cursor: grab !important;
}
.v-block:active, .v-block:active * {
  cursor: grabbing !important;
}
.v-block:hover {
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  border-color: rgba(255,255,255,0.6);
}
.v-block.selected {
  border-color: rgba(255,200,120,0.6);
  box-shadow: 0 0 40px rgba(255,200,120,0.5), 0 0 80px rgba(255,180,100,0.25), 0 0 120px rgba(255,160,80,0.12), 0 8px 32px rgba(0,0,0,0.3);
  z-index: 200 !important;
}
.v-block.selected.glow-breathe {
  animation: glow-pulse 2.5s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 40px rgba(255,200,120,0.5), 0 0 80px rgba(255,180,100,0.25), 0 0 120px rgba(255,160,80,0.12), 0 8px 32px rgba(0,0,0,0.3); }
  50% { box-shadow: 0 0 55px rgba(255,200,120,0.7), 0 0 100px rgba(255,180,100,0.4), 0 0 150px rgba(255,160,80,0.2), 0 8px 32px rgba(0,0,0,0.3); }
}

/* Window title bar */
.v-block .win-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: rgba(180,150,110,0.06);
  border-bottom: 1px solid rgba(180,150,110,0.08);
  font-size: 9px; color: rgba(140,110,80,0.4);
  text-transform: uppercase; letter-spacing: 1px;
}
.v-block .win-dot {
  width: 6px; height: 6px; border-radius: 50%;
  border: 1px solid rgba(180,150,110,0.2);
}

.v-block .win-body { padding: 14px; }

/* Block content — dark text on light card */
.v-block h2 { color: #4a3520; font-size: 16px; font-weight: 500; margin-bottom: 6px; letter-spacing: -0.3px; }
.v-block h3 { color: #6a5030; font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.v-block .sub { color: #8a7a60; font-size: 12px; margin-bottom: 8px; }
.v-block .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.v-block .tag { color: #7a6a50; font-size: 10px; background: rgba(180,150,110,0.1); padding: 2px 8px; border-radius: 3px; border: 1px solid rgba(180,150,110,0.08); }
.v-block img { width: 100%; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.v-block .footer { color: #9a8a70; font-size: 11px; margin-top: 8px; }

.v-block .big-num { font-size: 38px; font-weight: 200; color: #6a4a20; letter-spacing: -1px; text-align: center; }
.v-block .big-label { color: #8a7a60; font-size: 10px; text-align: center; text-transform: uppercase; letter-spacing: 1.5px; margin-top: 4px; }

.v-block .list-item { padding: 5px 0; border-bottom: 1px solid rgba(180,150,110,0.08); color: #5a4a38; font-size: 12px; }
.v-block .list-item:last-child { border-bottom: none; }

.v-block .md-body { font-size: 13px; line-height: 1.7; color: #5a4a38; }
.v-block .md-body h1,.v-block .md-body h2,.v-block .md-body h3 { color: #3a2a18; margin: 10px 0 4px; }
.v-block .md-body p { margin-bottom: 6px; }
.v-block .md-body code { background: rgba(180,150,110,0.1); padding: 1px 4px; border-radius: 2px; font-size: 12px; }
.v-block .md-body a { color: #8a5a20; }
.v-block .md-body strong { color: #3a2a18; }

.v-block .quote { color: #4a3a28; font-size: 15px; line-height: 1.7; font-style: italic; font-weight: 300; }
.v-block .attribution { color: #8a7a60; font-size: 11px; margin-top: 6px; }

.v-block .highlight { font-size: 18px; color: #6a4a20; text-align: center; line-height: 1.5; font-weight: 300; padding: 6px 0; }

.v-block .progress-track { background: rgba(180,150,110,0.1); height: 4px; border-radius: 3px; overflow: hidden; margin: 8px 0; }
.v-block .progress-bar { background: linear-gradient(90deg, #b08040, #c4a060); height: 100%; border-radius: 3px; transition: width 0.8s; }

.v-block .cols { display: grid; gap: 10px; }
.v-block .col h4 { color: #5a4a38; font-size: 12px; font-weight: 500; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid rgba(180,150,110,0.1); }
.v-block .col-item { color: #7a6a58; font-size: 12px; padding: 2px 0; }

.v-block .tl-item { position: relative; padding-left: 18px; padding-bottom: 12px; border-left: 1px solid rgba(180,150,110,0.15); }
.v-block .tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.v-block .tl-item::before { content: ''; position: absolute; left: -3px; top: 4px; width: 5px; height: 5px; border-radius: 50%; background: #b08040; }
.v-block .tl-time { color: #8a7a60; font-size: 10px; }
.v-block .tl-title { color: #5a4a38; font-size: 12px; }
.v-block .tl-detail { color: #7a6a58; font-size: 11px; margin-top: 2px; }

.v-block .img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; padding: 14px; }
.v-block .img-grid img { aspect-ratio: 16/10; object-fit: cover; border-radius: 3px; }

/* ── AI Speech (top-center) ── */
.bubble {
  position: fixed; top: 20px; left: 50%;
  transform: translateX(-50%);
  max-width: 500px; font-size: 14px; line-height: 1.7;
  color: rgba(196,168,130,0.5); font-weight: 300;
  letter-spacing: 0.3px; text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s;
  z-index: 100;
}
.bubble.visible { opacity: 1; }
.bubble.fading { opacity: 0; }

/* ── Input Bar (floating) ── */
.input-bar {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 8px; align-items: center;
  z-index: 90;
}
.input-bar input {
  width: 520px;
  background: rgba(28,24,18,0.7); backdrop-filter: blur(12px);
  border: 1px solid rgba(196,168,130,0.1);
  border-radius: 28px; color: #a08060; padding: 14px 22px;
  font-size: 15px; outline: none;
  transition: border-color 0.3s, background 0.3s;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.input-bar input:focus {
  border-color: rgba(196,168,130,0.25);
  background: rgba(28,24,18,0.85);
}
.input-bar input::placeholder { color: rgba(196,168,130,0.2); }

/* ── Config ── */
.gear-btn {
  position: fixed; top: 14px; right: 14px; z-index: 50;
  background: none; border: none; color: rgba(196,168,130,0.15);
  font-size: 18px; cursor: pointer; transition: color 0.3s;
}
.gear-btn:hover { color: rgba(196,168,130,0.4); }

.config-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10,10,8,0.8); backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
}
.config-overlay.open { display: flex; }

.config-box {
  background: rgba(28,24,18,0.95); border: 1px solid rgba(196,168,130,0.08);
  border-radius: 10px; padding: 24px; width: 340px;
}
.config-box .field { margin-bottom: 12px; }
.config-box label {
  font-size: 10px; color: rgba(196,168,130,0.3); display: block;
  margin-bottom: 3px; text-transform: uppercase;
  letter-spacing: 1px; font-weight: 500;
}
.config-box input, .config-box select {
  background: rgba(0,0,0,0.3); border: 1px solid rgba(196,168,130,0.06);
  border-radius: 6px; color: #a08060; padding: 8px 12px;
  font-size: 13px; width: 100%; outline: none;
}
.config-box input:focus { border-color: rgba(196,168,130,0.2); }
.config-close {
  width: 100%; margin-top: 8px; padding: 9px;
  background: rgba(196,168,130,0.06); border: 1px solid rgba(196,168,130,0.08);
  border-radius: 6px; color: #c4a882; font-size: 13px;
  cursor: pointer; transition: background 0.3s;
}
.config-close:hover { background: rgba(196,168,130,0.12); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .v-block { max-width: 90vw; }
  .bubble { max-width: 80%; font-size: 13px; }
}
