:root {
  --bg: #0c0c0e;
  --surface: #141418;
  --border: #2a2a30;
  --fg: #e8e6e3;
  --muted: #8a8680;
  --accent: #c4a574;
  --user-bg: #1c1c22;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.volley-page {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

.volley-header {
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  max-width: 42rem;
  margin: 0 auto;
  width: 100%;
}

.volley-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

.volley-sub {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.volley-inline-link {
  color: var(--accent);
  text-decoration: none;
}

.volley-inline-link:hover {
  text-decoration: underline;
}

.volley-model-meta {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.volley-model-pill {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-size: 0.72rem;
}

.volley-controls-row {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.volley-auth-row {
  margin-top: 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.volley-auth-btn {
  border: 1px solid var(--accent);
  background: rgba(196, 165, 116, 0.12);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.24rem 0.62rem;
  font-size: 0.71rem;
  cursor: pointer;
}

.volley-auth-btn.google {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.volley-google-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
}

.volley-auth-btn.secondary {
  border-color: var(--border);
  color: var(--muted);
  background: transparent;
}

.volley-auth-status {
  font-size: 0.73rem;
  color: var(--muted);
}

.volley-style-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.volley-style-select {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.74rem;
  padding: 0.2rem 0.45rem;
}

.volley-context-bar {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.volley-context-chip {
  border: 1px solid var(--border);
  background: rgba(196, 165, 116, 0.1);
  color: var(--fg);
  border-radius: 999px;
  padding: 0.16rem 0.52rem;
  font-size: 0.71rem;
}

.volley-context-chip.clear {
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.volley-main {
  flex: 1;
  max-width: 92rem;
  margin: 0 auto;
  width: 100%;
  padding: 1rem 1.25rem 1.5rem;
  min-height: 0;
}

.volley-layout {
  display: grid;
  grid-template-columns: minmax(15rem, 18.5rem) minmax(0, 1fr) minmax(14rem, 22rem);
  gap: 1rem;
  min-height: 0;
  height: 100%;
  align-items: stretch;
}

.volley-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 0;
}

.volley-chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.volley-tools-explorer {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: min(70vh, 42rem);
}

.volley-tools-explorer-intro {
  margin: 0;
  padding: 0 0.65rem 0.45rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
  border-bottom: 1px solid var(--border);
}

.volley-tools-explorer-body {
  padding: 0.5rem 0.65rem 0.65rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.volley-explorer-section {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.volley-explorer-section-title {
  margin: 0;
  padding: 0 0 0.15rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.volley-explorer-tool {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
  padding: 0;
}

.volley-explorer-tool summary {
  cursor: pointer;
  list-style: none;
  padding: 0.4rem 0.5rem;
  font-size: 0.74rem;
}

.volley-explorer-tool summary::-webkit-details-marker {
  display: none;
}

.volley-explorer-tool summary::before {
  content: "";
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  margin-right: 0.4rem;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  transform: rotate(-45deg);
  vertical-align: 0.15rem;
  opacity: 0.7;
}

.volley-explorer-tool[open] summary::before {
  transform: rotate(45deg);
  vertical-align: 0.05rem;
}

.volley-explorer-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--accent);
  word-break: break-all;
}

.volley-explorer-desc {
  margin: 0 0.5rem 0.45rem;
  font-size: 0.74rem;
  color: var(--fg);
  line-height: 1.45;
}

.volley-explorer-params {
  margin: 0 0.5rem 0.5rem;
  padding: 0;
  list-style: none;
  font-size: 0.7rem;
  color: var(--muted);
}

.volley-explorer-params li {
  margin-top: 0.28rem;
  padding-left: 0.55rem;
  border-left: 2px solid var(--border);
}

.volley-explorer-param-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #b9b6b2;
}

.volley-explorer-param-meta {
  color: var(--muted);
  font-size: 0.66rem;
}

.volley-explorer-param-desc {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.35;
}

.volley-tools-explorer-body.volley-tools-explorer-loading,
.volley-tools-explorer-body.volley-tools-explorer-error {
  font-size: 0.76rem;
  color: var(--muted);
}

.volley-tools {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  margin: 0;
}

.volley-history {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.volley-history-actions {
  padding: 0.45rem 0.65rem 0;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.volley-history-share-status {
  padding: 0.35rem 0.65rem 0;
  font-size: 0.68rem;
  color: var(--muted);
}

.volley-history-list {
  padding: 0.45rem 0.65rem 0.6rem;
  min-height: 2rem;
  max-height: 16rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.volley-history-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  padding: 0.4rem 0.52rem;
  text-align: left;
  cursor: pointer;
}

.volley-history-item.active {
  border-color: var(--accent);
  background: rgba(196, 165, 116, 0.1);
}

.volley-history-item-title {
  font-size: 0.76rem;
}

.volley-history-item-meta {
  color: var(--muted);
  font-size: 0.67rem;
  margin-top: 0.2rem;
}

.volley-tools-head {
  padding: 0.45rem 0.65rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}

.volley-tools-body {
  padding: 0.5rem 0.65rem;
  min-height: 2rem;
  max-height: 18rem;
  overflow: auto;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}

.volley-tool-line.active {
  color: var(--fg);
}

.volley-tool-detail {
  margin: 0.2rem 0 0.05rem;
  border-left: 2px solid var(--border);
  padding-left: 0.45rem;
}

.volley-tool-detail summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.72rem;
}

.volley-tool-pre {
  margin: 0.25rem 0 0;
  font-size: 0.7rem;
  color: #b9b6b2;
  white-space: pre-wrap;
}

.volley-quick-actions {
  margin-top: 0.3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.volley-quick-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  border-radius: 999px;
  font-size: 0.66rem;
  padding: 0.12rem 0.46rem;
  cursor: pointer;
}

.volley-thread {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
  min-height: 12rem;
}

.volley-msg {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.volley-msg.user {
  background: var(--user-bg);
  align-self: flex-end;
  max-width: 92%;
}

.volley-msg.assistant {
  background: var(--surface);
  align-self: flex-start;
  max-width: 100%;
}

.volley-msg .volley-role {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.volley-msg-meta {
  margin-top: 0.4rem;
  font-size: 0.68rem;
  color: var(--muted);
}

.volley-composer {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.volley-composer-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.volley-composer-input-row .volley-input {
  flex: 1;
}

.volley-starter-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding-left: 0.1rem;
}

.volley-starter-btn {
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(127, 192, 172, 0.1);
  color: #9dd4c4;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}

.volley-starter-btn:hover:not(:disabled) {
  background: rgba(127, 192, 172, 0.18);
  border-color: rgba(127, 192, 172, 0.45);
}

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

.volley-starter-hint {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
  max-width: 18rem;
}

.volley-input {
  flex: 1;
  resize: vertical;
  min-height: 2.75rem;
  max-height: 10rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
}

.volley-input:focus {
  outline: 2px solid rgba(196, 165, 116, 0.35);
  outline-offset: 1px;
}

.volley-send {
  padding: 0.6rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: rgba(196, 165, 116, 0.12);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
}

.volley-send:hover:not(:disabled) {
  background: rgba(196, 165, 116, 0.22);
}

.volley-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.volley-status {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.25em;
}

.volley-sr {
  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) {
  .volley-layout {
    grid-template-columns: 1fr;
  }

  .volley-tools-explorer {
    max-height: min(50vh, 28rem);
  }

  .volley-history-list {
    max-height: 11rem;
  }

  .volley-tools-body {
    max-height: 10rem;
  }
}
