.field-help {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.field-help a {
  color: #86efac;
}

.dialog-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  min-height: unset;
  padding: 0 4px;
  cursor: pointer;
}

.dialog-close:hover {
  color: var(--text);
}

.ai-settings-dialog {
  background: #1e2d3d;
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 20px;
  max-width: 420px;
  width: calc(100vw - 32px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.ai-settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.ai-settings-dialog label {
  font-size: 0.74rem;
}

.ai-settings-dialog input {
  font-size: 0.78rem;
}

.ai-settings-dialog>form>div:not(:last-child) {
  margin-bottom: 12px;
}

.ai-settings-dialog #aiKeyLink {
  color: #86efac;
  font-size: 0.8rem;
  white-space: nowrap;
}

.ai-settings-dialog select {
  appearance: none;
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M1 1.5 6 6.5 11 1.5'/></svg>") no-repeat right 12px center / 12px 8px;
  color: var(--text);
  font-size: 0.85rem;
}

.ai-settings-dialog .provider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-settings-dialog .provider-row select {
  flex: 1;
  min-width: 0;
}

.ai-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ai-settings-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.ai-settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 20px;
}

.inline-banner {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
}

.ai-prompts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 680px) and (pointer: fine) {
  .ai-prompts {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ai-prompt-btn {
  padding: 14px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
}

.ai-prompt-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  opacity: 0.9;
  margin-bottom: 4px;
  font-size: 24px;
  line-height: 1;
}

.ai-prompt-label {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}

.ai-prompt-btn:hover {
  border-color: var(--accent);
  background: rgba(34, 197, 94, 0.08);
}

.ai-prompt-btn.active {
  border-color: var(--accent);
  background: rgba(34, 197, 94, 0.15);
}

.more-like-dialog {
  background: #1e2d3d;
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 16px;
  max-width: 680px;
  width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.more-like-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.more-like-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

@media (max-width: 520px) {
  .more-like-dialog {
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    height: var(--app-height);
    max-height: var(--app-height);
    border: 0;
    border-radius: 0;
    margin: 0;
    padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
  }
}

.more-like-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.more-like-back {
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  min-height: unset;
}

.more-like-title {
  flex: 1;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.more-like-title em {
  font-style: normal;
  color: var(--text);
}

@media (max-width: 680px) {
  #aiContent {
    overflow-y: auto;
  }

  #aiDialogResults {
    flex: 1;
    min-height: 0;
    grid-template-rows: repeat(var(--rows, 2), minmax(0, 1fr));
    grid-auto-columns: auto;
  }

  #aiDialogResults .row-item {
    width: auto;
    height: 100%;
  }

  #aiDialogResults .row-item .item-card {
    width: auto;
    height: 100%;
    aspect-ratio: 2/3;
  }
}
