:root,
[data-theme="light"] {
  --vv-bg: #f4f3f0;
  --vv-bg2: #ebeae6;
  --vv-surface: rgba(255, 255, 255, 0.72);
  --vv-border: rgba(0, 0, 0, 0.08);
  --vv-text: #111111;
  --vv-muted: #5c5c5c;
  --vv-blue: #0a84ff;
  --vv-blue-dim: rgba(10, 132, 255, 0.12);
  --vv-blue-glow: rgba(10, 132, 255, 0.35);
  --vv-shadow: 0 12px 40px rgba(0, 0, 0, 0.06);
  --vv-logo-plate: transparent;
  --vv-logo-plate-border: transparent;
  --vv-bubble-user-bg: #111;
  --vv-bubble-user-text: #f5f5f5;
  --vv-input-bg: #fff;
  --vv-btn-primary-bg: #111;
  --vv-radius: 14px;
  --vv-font: "DM Sans", system-ui, sans-serif;
  --vv-mono: "JetBrains Mono", ui-monospace, monospace;
}

[data-theme="dark"] {
  --vv-bg: #0c0c0e;
  --vv-bg2: #16161a;
  --vv-surface: rgba(22, 22, 26, 0.88);
  --vv-border: rgba(255, 255, 255, 0.08);
  --vv-text: #ececec;
  --vv-muted: #9a9aa3;
  --vv-blue: #3d9eff;
  --vv-blue-dim: rgba(61, 158, 255, 0.14);
  --vv-blue-glow: rgba(61, 158, 255, 0.28);
  --vv-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --vv-logo-plate: #f0f0f3;
  --vv-logo-plate-border: rgba(255, 255, 255, 0.14);
  --vv-bubble-user-bg: #3d9eff;
  --vv-bubble-user-text: #0a0a0c;
  --vv-input-bg: #1a1a1f;
  --vv-btn-primary-bg: #3d9eff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--vv-blue-dim), transparent 55%),
    var(--vv-bg);
  color: var(--vv-text);
  font-family: var(--vv-font);
  font-size: 15px;
  line-height: 1.5;
  transition: background 0.2s, color 0.2s;
}

.vv-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 12px;
}

.vv-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--vv-border);
}

.vv-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 200px;
}

.vv-brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.vv-brand-lockup--hero {
  align-items: center;
  margin-bottom: 8px;
}

.vv-tagline {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--vv-blue);
  opacity: 0.92;
}

.vv-tagline--hero {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
}

.vv-wordmark {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--vv-text);
  line-height: 1;
  white-space: nowrap;
}

.vv-wordmark--hero {
  font-size: 1.85rem;
  letter-spacing: 0.22em;
}

.vv-i-accent {
  color: var(--vv-blue);
  letter-spacing: 0;
}

.vv-logo-plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--vv-logo-plate);
  border: 1px solid var(--vv-logo-plate-border);
  box-shadow: none;
  width: fit-content;
}

[data-theme="light"] .vv-logo-plate {
  background: none;
  border: none;
  padding: 0;
  box-shadow: none;
}

[data-theme="dark"] .vv-logo-plate {
  background: #f0f0f3;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .vv-logo--img {
  display: none;
}

[data-theme="light"] .vv-logo--text {
  display: block;
}

[data-theme="dark"] .vv-logo--img {
  display: block;
}

[data-theme="dark"] .vv-logo--text {
  display: none;
}

.vv-logo-plate--hero {
  margin: 0 auto;
  padding: 14px 22px;
}

[data-theme="light"] .vv-logo-plate--hero {
  padding: 0;
}

.vv-logo,
.vv-empty-logo {
  height: auto;
  max-height: 48px;
  width: auto;
  max-width: min(240px, 72vw);
  object-fit: contain;
  object-position: center;
  display: block;
}

.vv-empty-logo.vv-logo--text {
  max-height: none;
  object-fit: unset;
}

.vv-empty-logo { max-height: 56px; }

.vv-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--vv-bg2);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--vv-border);
}

.vv-nav-btn {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--vv-muted);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.vv-nav-btn:hover { color: var(--vv-text); }

.vv-nav-btn.active {
  background: var(--vv-input-bg);
  color: var(--vv-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.vv-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vv-theme-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--vv-border);
  background: var(--vv-input-bg);
  color: var(--vv-text);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s, transform 0.1s;
}

.vv-theme-btn:hover { background: var(--vv-bg2); }
.vv-theme-btn:active { transform: scale(0.94); }

.vv-live {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--vv-muted);
  font-family: var(--vv-mono);
}

.vv-live.ok { color: #1a9e5f; }
.vv-live.warn { color: #c9a227; }

.vv-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 16px;
}

.vv-pane {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: 0;
}

.vv-pane.active { display: flex; }

.vv-pane-intro {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--vv-muted);
}

.vv-chat-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--vv-surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius);
  box-shadow: var(--vv-shadow);
  overflow: hidden;
}

.vv-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  min-height: 280px;
  max-height: calc(100dvh - 220px);
}

.vv-chat-empty {
  text-align: center;
  padding: 24px 16px 40px;
  color: var(--vv-muted);
}

.vv-chat-empty.hidden { display: none; }

.vv-chat-empty h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  color: var(--vv-text);
}

.vv-chat-empty p {
  margin: 0 auto 16px;
  max-width: 420px;
  font-size: 0.92rem;
}

.vv-hints {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 360px;
  text-align: left;
  font-size: 0.88rem;
}

.vv-hints li {
  padding: 6px 0 6px 1.2em;
  position: relative;
}

.vv-hints li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--vv-blue);
}

.msg {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  animation: vv-fade-in 0.25s ease;
}

@keyframes vv-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.msg.user { flex-direction: row-reverse; }

.msg-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--vv-bg2);
  border: 1px solid var(--vv-border);
}

.msg.vi .msg-avatar {
  background: linear-gradient(135deg, #111, #333);
  color: var(--vv-blue);
  border-color: rgba(10, 132, 255, 0.25);
}

[data-theme="dark"] .msg.vi .msg-avatar {
  background: linear-gradient(135deg, #1a1a22, #2a2a35);
}

.msg.user .msg-avatar {
  background: var(--vv-input-bg);
  color: var(--vv-text);
}

.msg-body { flex: 1; min-width: 0; max-width: 88%; }
.msg.user .msg-body { display: flex; flex-direction: column; align-items: flex-end; }

.bubble {
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--vv-input-bg);
  border: 1px solid var(--vv-border);
  line-height: 1.55;
  word-break: break-word;
}

.msg.user .bubble {
  background: var(--vv-bubble-user-bg);
  color: var(--vv-bubble-user-text);
  border-color: transparent;
}

.msg.vi .bubble pre,
.msg.vi .bubble code {
  font-family: var(--vv-mono);
  font-size: 0.86em;
}

.msg.vi .bubble pre {
  overflow-x: auto;
  padding: 10px;
  background: var(--vv-bg2);
  border-radius: 8px;
}

.meta {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--vv-blue-dim);
  color: var(--vv-blue);
}

.badge.behavior {
  background: rgba(128, 128, 128, 0.12);
  color: var(--vv-muted);
}

.vv-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--vv-border);
  background: var(--vv-surface);
}

#chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--vv-border);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  min-height: 46px;
  max-height: 140px;
  background: var(--vv-input-bg);
  color: var(--vv-text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#chat-input:focus {
  border-color: var(--vv-blue);
  box-shadow: 0 0 0 3px var(--vv-blue-dim);
}

.vv-send {
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 12px;
  background: var(--vv-btn-primary-bg);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}

[data-theme="dark"] .vv-send { color: #0a0a0c; }
.vv-send:hover { opacity: 0.9; }
.vv-send:active { transform: scale(0.96); }
.vv-send:disabled { opacity: 0.45; cursor: not-allowed; }

.vv-sandbox {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 420px;
}

.vv-sandbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.vv-sandbox-lang {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--vv-muted);
}

.vv-sandbox-lang select {
  font: inherit;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--vv-border);
  background: var(--vv-input-bg);
  color: var(--vv-text);
}

.vv-sandbox-actions { display: flex; gap: 8px; }

.vv-btn {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--vv-border);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.vv-btn.primary {
  background: var(--vv-btn-primary-bg);
  color: #fff;
  border-color: transparent;
}

[data-theme="dark"] .vv-btn.primary { color: #0a0a0c; }

.vv-btn.ghost {
  background: var(--vv-input-bg);
  color: var(--vv-text);
}

.vv-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.vv-sandbox-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}

@media (max-width: 720px) {
  .vv-sandbox-grid { grid-template-columns: 1fr; }
  .vv-header { justify-content: center; text-align: center; }
  .vv-brand { align-items: center; }
}

.vv-sandbox-editor,
.vv-sandbox-io {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.vv-sandbox-editor label,
.vv-sandbox-io label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--vv-muted);
}

#sandbox-code,
#sandbox-stdin {
  font-family: var(--vv-mono);
  font-size: 0.84rem;
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius);
  padding: 12px;
  background: var(--vv-input-bg);
  color: var(--vv-text);
  resize: vertical;
  outline: none;
}

#sandbox-code { flex: 1; min-height: 260px; }
#sandbox-stdin { min-height: 64px; }

.vv-sandbox-out {
  flex: 1;
  min-height: 160px;
  margin: 0;
  padding: 12px;
  font-family: var(--vv-mono);
  font-size: 0.82rem;
  background: #111;
  color: #e8e8e8;
  border-radius: var(--vv-radius);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.vv-sandbox-out.ok { border: 1px solid rgba(26, 158, 95, 0.35); }
.vv-sandbox-out.err { border: 1px solid rgba(220, 60, 60, 0.4); }

.vv-guide {
  background: var(--vv-surface);
  border: 1px solid var(--vv-border);
  border-radius: var(--vv-radius);
  padding: 24px 20px 32px;
  box-shadow: var(--vv-shadow);
}

.vv-guide h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
}

.vv-guide-lead {
  margin: 0 0 20px;
  font-weight: 600;
  color: var(--vv-blue);
  letter-spacing: 0.03em;
}

.vv-guide h3 {
  margin: 20px 0 8px;
  font-size: 1rem;
}

.vv-guide p,
.vv-guide ul {
  margin: 0 0 12px;
  color: var(--vv-muted);
  font-size: 0.92rem;
}

.vv-guide ul { padding-left: 1.2em; }
.vv-guide li { margin-bottom: 6px; }
.vv-guide code {
  font-family: var(--vv-mono);
  font-size: 0.88em;
  background: var(--vv-bg2);
  padding: 2px 6px;
  border-radius: 4px;
}

.vv-guide a { color: var(--vv-blue); }

.vv-inline-ok { color: #1a9e5f; font-weight: 600; }

.vv-footer {
  padding: 14px 0 6px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--vv-muted);
  letter-spacing: 0.04em;
}

.vv-footer-link {
  color: var(--vv-blue);
  text-decoration: none;
}

.vv-footer-link:hover { text-decoration: underline; }
