.lyric-settings {
  display: grid;
  gap: 7px;
}

.lyric-setting-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}

.inline-select {
  display: grid;
  gap: 5px;
}

.select-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.inline-select select {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-container);
  color: var(--ink);
  padding: 0 30px 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.inline-select select:hover {
  border-color: rgba(37, 99, 235, 0.42);
  background: var(--surface-tonal);
}

.content-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  flex: 1;
}

.chat-panel,
.inspector {
  min-height: 0;
  border: 1px solid rgba(220, 228, 238, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-3);
}

.chat-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  box-shadow: 0 18px 46px rgba(23, 37, 84, 0.11);
}

.messages {
  overflow: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.035), transparent 150px),
    radial-gradient(circle at 100% 0%, rgba(22, 163, 184, 0.05), transparent 34%),
    var(--surface);
}

.message {
  position: relative;
  max-width: min(820px, 86%);
  border-radius: var(--radius);
  padding: 12px 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  animation: rise 180ms ease both;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary), #1646c7);
  color: white;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.18);
}

.message.agent {
  align-self: flex-start;
  background: #ffffff;
  color: var(--ink);
  border: 1px solid rgba(220, 228, 238, 0.92);
  padding-right: 42px;
  white-space: normal;
}

.message-content {
  min-width: 0;
}

.message-content > :first-child {
  margin-top: 0;
}

.message-content > :last-child {
  margin-bottom: 0;
}

.message-content p {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.62;
}

.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
  margin: 14px 0 8px;
  color: var(--ink);
  line-height: 1.28;
  letter-spacing: 0;
}

.message-content h3 {
  font-size: 16px;
}

.message-content h4,
.message-content h5,
.message-content h6 {
  font-size: 14px;
}

.message-content strong {
  color: #0f172a;
  font-weight: 900;
}

.message-content a {
  color: var(--primary-dark);
  font-weight: 800;
  text-decoration: none;
}

.message-content a:hover {
  text-decoration: underline;
}

.message-content ul,
.message-content ol {
  margin: 8px 0 12px;
  padding-left: 22px;
  color: var(--ink);
}

.message-content li {
  margin: 5px 0;
  line-height: 1.55;
}

.message-content blockquote {
  margin: 10px 0 12px;
  border-left: 3px solid rgba(22, 163, 184, 0.48);
  padding: 8px 12px;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  white-space: pre-wrap;
}

.message-content :not(pre) > code {
  border: 1px solid rgba(22, 163, 184, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  color: #0e7490;
  padding: 2px 5px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
  font-weight: 800;
}

.message-content pre {
  position: relative;
  margin: 10px 0 14px;
  overflow: auto;
  border: 1px solid rgba(220, 228, 238, 0.95);
  border-radius: var(--radius);
  background: #f8fafc;
  color: #172033;
  padding: 34px 14px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.message-content pre::before {
  content: attr(data-language);
  position: absolute;
  top: 9px;
  left: 12px;
  color: #0e7490;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.copy-code-button {
  position: absolute;
  top: 7px;
  right: 8px;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 6px;
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: none;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.copy-code-button:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: none;
  transform: none;
}

.copy-code-button.copied {
  border-color: rgba(15, 159, 110, 0.28);
  background: rgba(15, 159, 110, 0.1);
  color: #047857;
}

.message-content pre code {
  display: block;
  color: inherit;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.58;
}

.message-actions {
  position: absolute;
  top: 8px;
  right: 8px;
}

.message-menu-button {
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.message-menu-button:hover,
.message-menu-button[aria-expanded="true"] {
  border-color: rgba(22, 163, 184, 0.28);
  background: var(--secondary-soft);
  color: var(--primary-dark);
  box-shadow: none;
}

.message-menu {
  position: absolute;
  z-index: 30;
  top: 32px;
  right: 0;
  width: 48px;
  display: none;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  white-space: normal;
}

.message-menu.open {
  display: grid;
  gap: 4px;
}

.message-menu button {
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.message-menu button:hover {
  background: var(--secondary-soft);
  color: var(--primary-dark);
  box-shadow: none;
  transform: none;
}

.message.tool {
  align-self: stretch;
  max-width: 100%;
  border: 1px dashed rgba(245, 158, 11, 0.48);
  background: var(--secondary-soft);
  color: #744100;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  box-shadow: none;
}

.message.thinking {
  align-self: flex-start;
  width: min(620px, 100%);
  max-width: 92%;
  border: 1px solid rgba(22, 163, 184, 0.24);
  background: linear-gradient(180deg, #f8fdff, #ffffff);
  color: var(--ink);
  padding: 0;
  overflow: hidden;
}

.message.agent.thinking {
  padding-right: 0;
}

.thinking-header {
  min-height: 48px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
}

.thinking-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(18, 165, 111, 0.12);
}

.thinking.running .thinking-dot {
  background: var(--secondary);
  animation: pulse 900ms ease-in-out infinite;
}

.thinking-title {
  overflow: hidden;
  color: var(--ink);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thinking-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.thinking-body {
  border-top: 1px solid rgba(215, 222, 234, 0.8);
  background: rgba(241, 245, 249, 0.72);
  padding: 10px 13px 12px;
}

.thinking-body p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.thinking-body ol {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.thinking-body li {
  color: #334155;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.agent-thinking-status {
  min-height: 38px;
  display: grid;
  grid-template-columns: 18px auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border-top: 1px solid rgba(22, 163, 184, 0.2);
  background: linear-gradient(90deg, rgba(232, 251, 255, 0.96), rgba(233, 241, 255, 0.96));
  color: var(--ink);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
}

.agent-thinking-status[hidden] {
  display: none;
}

.agent-thinking-status .thinking-dot {
  width: 9px;
  height: 9px;
  background: var(--secondary);
  animation: pulse 900ms ease-in-out infinite;
}

.agent-thinking-status strong {
  color: var(--primary-dark);
  font-weight: 900;
}

.agent-thinking-status span:last-child {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}
